Better handling of static c handling.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-05-03 12:45:12 +02:00
parent 293386ac0d
commit f65b2f74bd
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
3 changed files with 15 additions and 10 deletions

View File

@ -17,7 +17,7 @@ steps:
CXX: /usr/bin/clang++
commands:
- conan remote add epsilon-public https://packages.p-epsilon.com/
- cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ . -B build-debug
- cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ . -B build-debug -DSTATICC=ON
- cmake --build build-debug --target all -- -j 4
- build-debug/bin/CreatureLibTests -s --durations yes --use-colour yes
- name: test-release-linux
@ -30,7 +30,7 @@ steps:
CXX: /usr/bin/clang++
commands:
- conan remote add epsilon-public https://packages.p-epsilon.com/
- cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ . -B build-release
- cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ . -B build-release -DSTATICC=ON
- cmake --build build-release --target all -- -j 4
- build-release/bin/CreatureLibTests -s --durations yes --use-colour yes
- valgrind --tool=memcheck --gen-suppressions=all --leak-check=full --leak-resolution=med --track-origins=yes --vgdb=no --error-exitcode=1 build-release/bin/CreatureLibTests

View File

@ -16,12 +16,17 @@ if (NOT EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
if (NOT MINOR MATCHES 0)
SET(VERSION ${VERSION}.${MINOR})
endif ()
set(CONAN_STATIC_C False)
if (STATICC)
set(CONAN_STATIC_C True)
endif (STATICC)
if (NOT WINDOWS)
execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build outdated
-s compiler=clang -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION} -o *:shared=True)
-s compiler=clang -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION} -o *:shared=True -o *:staticC=${CONAN_STATIC_C})
else ()
execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build outdated
-s compiler=gcc -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION} -s os=Windows -o *:shared=True)
-s compiler=gcc -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION} -s os=Windows -o *:shared=True -o *:staticC=${CONAN_STATIC_C})
endif ()
endif ()
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
@ -50,6 +55,7 @@ if (WINDOWS)
endif (WINDOWS)
if (STATICC)
message(STATUS "Linking C statically.")
SET(_LIBRARYLINKS ${_LIBRARYLINKS} -static-libgcc -static-libstdc++)
SET(_BATTLINGLINKS ${_BATTLINGLINKS} -static-libgcc -static-libstdc++)
if (NOT DEFINED CONAN_EXPORTED)

View File

@ -7,8 +7,8 @@ class CreatureLibConan(ConanFile):
url = "https://git.p-epsilon.com/Deukhoofd/CreatureLib"
description = "The core implementation for turn based battling using creatures."
settings = "os", "compiler"
options = {"shared": [True, False]}
default_options = {"shared": True}
options = {"shared": [True, False], "staticC": [True, False]}
default_options = {"shared": True, "staticC": False}
generators = "cmake"
exports_sources = "*"
compiler = "clang"
@ -19,13 +19,12 @@ class CreatureLibConan(ConanFile):
if self.settings.os == "Windows":
self.output.warn("Noticed Windows target, setting Cmake WINDOWS=On.")
cmake.definitions["WINDOWS"] = "On"
if self.options.staticC:
self.output.info("Linking C libraries statically")
cmake.definitions["STATICC"] = "ON"
cmake.configure()
cmake.build()
# Explicit way:
# self.run('cmake "%s/src" %s' % (self.source_folder, cmake.command_line))
# self.run("cmake --build . %s" % cmake.build_config)
def package(self):
self.copy("*.hpp", dst="include/CreatureLib", src="src")
self.copy("*.dll", dst="bin", keep_path=False)