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 passing Details

This commit is contained in:
Deukhoofd 2020-04-12 10:54:47 +02:00
parent 2e5d463e45
commit e35f860b84
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
3 changed files with 9 additions and 4 deletions

View File

@ -45,7 +45,7 @@ steps:
- update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix - 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-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 - 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 -D CMAKE_C_COMPILER=/usr/bin/x86_64-w64-mingw32-gcc -D CMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ -DWINDOWS=ON - cmake -DCMAKE_BUILD_TYPE=Release . -B build-release-windows -D CMAKE_C_COMPILER=/usr/bin/x86_64-w64-mingw32-gcc -D CMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ -DWINDOWS=ON -DSTATICC=ON
- cmake --build build-release-windows --target all -- -j 4 - cmake --build build-release-windows --target all -- -j 4
- cp /drone/src/build-release-windows/lib/* /drone/src/build-release-windows/bin/ - cp /drone/src/build-release-windows/lib/* /drone/src/build-release-windows/bin/
- cp /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll /drone/src/build-release-windows/bin/ - cp /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll /drone/src/build-release-windows/bin/

View File

@ -61,12 +61,15 @@ if (WINDOWS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L ${CMAKE_BINARY_DIR}/bin") 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") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -Wa,-mbig-obj -Wl,-allow-multiple-definition")
# Statically link libraries we need in Windows. # Statically link libraries we need in Windows.
endif (WINDOWS)
if (STATICC)
target_link_libraries(CreatureLibLibrary -static-libgcc -static-libstdc++) target_link_libraries(CreatureLibLibrary -static-libgcc -static-libstdc++)
target_link_libraries(CreatureLibBattling -static-libgcc -static-libstdc++) target_link_libraries(CreatureLibBattling -static-libgcc -static-libstdc++)
if (NOT DEFINED CONAN_EXPORTED) if (NOT DEFINED CONAN_EXPORTED)
target_link_libraries(CreatureLibTests -static-libgcc -static-libstdc++) target_link_libraries(CreatureLibTests -static-libgcc -static-libstdc++)
endif () endif ()
endif (WINDOWS) endif ()
if (NOT DEFINED CONAN_EXPORTED) if (NOT DEFINED CONAN_EXPORTED)
MESSAGE(WARNING, "Called from Conan. Not building test build.") MESSAGE(WARNING, "Called from Conan. Not building test build.")

View File

@ -7,8 +7,8 @@ class CreatureLibConan(ConanFile):
url = "https://git.p-epsilon.com/Deukhoofd/CreatureLib" url = "https://git.p-epsilon.com/Deukhoofd/CreatureLib"
description = "The core implementation for turn based battling using creatures." description = "The core implementation for turn based battling using creatures."
settings = "os", "compiler" settings = "os", "compiler"
options = {"shared": [True, False]} options = {"shared": [True, False], "staticC": [True, False]}
default_options = {"shared": True} default_options = {"shared": True, "staticC": False}
generators = "cmake" generators = "cmake"
exports_sources = "*" exports_sources = "*"
compiler = "clang" compiler = "clang"
@ -19,6 +19,8 @@ class CreatureLibConan(ConanFile):
if self.settings.os == "Windows": if self.settings.os == "Windows":
self.output.warn("Noticed Windows target, setting Cmake WINDOWS=On.") self.output.warn("Noticed Windows target, setting Cmake WINDOWS=On.")
cmake.definitions["WINDOWS"] = "On" cmake.definitions["WINDOWS"] = "On"
if self.options.staticC:
cmake.definitions["STATICC"] = "On"
cmake.configure() cmake.configure()
cmake.build() cmake.build()