diff --git a/.drone.yml b/.drone.yml index af99cd6..eefe284 100644 --- a/.drone.yml +++ b/.drone.yml @@ -62,7 +62,7 @@ steps: - update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix - update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix - update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix - - cmake -DCMAKE_BUILD_TYPE=Release . -B build-release-windows -DWINDOWS=ON + - cmake -DCMAKE_BUILD_TYPE=Release . -B build-release-windows -DWINDOWS=ON -DSTATICC=ON - cmake --build build-release-windows --target all -- -j 4 - cp /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll /drone/src/build-release-windows/bin/ - cp /drone/src/build-release-windows/lib/libpkmnLib.so /drone/src/build-release-windows/bin/ diff --git a/CMakeLists.txt b/CMakeLists.txt index d505536..78624e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,11 +89,15 @@ if (WINDOWS) message(STATUS "Using Windows build.") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L ${CMAKE_BINARY_DIR}/bin") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -Wa,-mbig-obj -Wl,-allow-multiple-definition") - # Statically link libraries we need in Windows. - SET(_LINKS ${_LINKS} -static-libgcc -static-libstdc++) - SET(_TESTLINKS ${_TESTLINKS} -static-libgcc -static-libstdc++) endif (WINDOWS) +if (STATICC) + SET(_LINKS ${_LINKS} -static-libgcc -static-libstdc++) + if (NOT DEFINED CONAN_EXPORTED) + SET(_TESTLINKS ${_TESTLINKS} -static-libgcc -static-libstdc++) + endif() +endif() + target_link_libraries(pkmnLib PUBLIC ${_LINKS}) diff --git a/conanfile.py b/conanfile.py index d5e9303..4d85a02 100644 --- a/conanfile.py +++ b/conanfile.py @@ -8,8 +8,8 @@ class PkmnLibConan(ConanFile): url = "https://git.p-epsilon.com/Deukhoofd/PkmnLib" description = "An implementation of CreatureLib to handle Pokemon battling." settings = "os", "compiler", "build_type" - options = {"shared": [True, False], "script_handler": ["angelscript"]} - default_options = {"shared": True, "script_handler": "angelscript"} + options = {"shared": [True, False], "script_handler": ["angelscript"], "staticC": [True, False]} + default_options = {"shared": True, "script_handler": "angelscript", "staticC": False} generators = "cmake" exports_sources = "*" compiler = "clang" @@ -20,6 +20,8 @@ class PkmnLibConan(ConanFile): if self.settings.os == "Windows": self.output.warn("Noticed Windows target, setting Cmake WINDOWS=On.") cmake.definitions["WINDOWS"] = "On" + if self.options.staticC: + cmake.definitions["STATICC"] = "On" cmake.configure() cmake.build()