Don't link C libraries statically by default for Windows, as this isn't needed if another library has their own C libraries already has them statically linked.
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2020-04-12 11:20:16 +02:00
parent 499f942104
commit b3290f0672
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
3 changed files with 12 additions and 6 deletions

View File

@ -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/

View File

@ -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})

View File

@ -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()