Better support for linking C libraries statically.
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2020-05-03 12:27:22 +02:00
parent fe2bec18f5
commit f99243481e
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
4 changed files with 18 additions and 13 deletions

View File

@ -9,7 +9,7 @@ steps:
CC: /usr/bin/clang
CXX: /usr/bin/clang++
commands:
- cmake -DCMAKE_BUILD_TYPE=Debug . -B build-debug
- cmake -DCMAKE_BUILD_TYPE=Debug . -B build-debug -DSTATICC=ON
- cmake --build build-debug --target all -- -j 4
- build-debug/ArbutilsTests -s --durations yes --use-colour yes
- name: test-release-linux
@ -18,7 +18,7 @@ steps:
CC: /usr/bin/clang
CXX: /usr/bin/clang++
commands:
- cmake -DCMAKE_BUILD_TYPE=Release . -B build-release
- cmake -DCMAKE_BUILD_TYPE=Release . -B build-release -DSTATICC=ON
- cmake --build build-release --target all -- -j 4
- build-release/ArbutilsTests -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/ArbutilsTests
@ -34,7 +34,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 -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
- export WINEARCH=win64
- wine build-release-windows/ArbutilsTests.exe -s

View File

@ -25,13 +25,15 @@ endif()
if (WINDOWS)
MESSAGE(WARNING, "Using Windows Build.")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -Wa,-mbig-obj -Wl,-allow-multiple-definition")
# Statically link libraries we need in Windows.
target_link_libraries(Arbutils -static -static-libgcc -static-libstdc++)
if (NOT DEFINED CONAN_EXPORTED)
target_link_libraries(ArbutilsTests -static -static-libgcc -static-libstdc++)
endif()
endif (WINDOWS)
if (STATICC)
target_link_libraries(Arbutils -static-libgcc -static-libstdc++)
if (NOT DEFINED CONAN_EXPORTED)
target_link_libraries(ArbutilsTests -static-libgcc -static-libstdc++)
endif()
endif(STATICC)
if (NOT DEFINED CONAN_EXPORTED)
target_compile_definitions(ArbutilsTests PRIVATE TESTS_BUILD)
endif()

View File

@ -7,8 +7,8 @@ class ArbutilsConan(ConanFile):
url = "https://git.p-epsilon.com/Deukhoofd/Arbutils"
description = "A helper library for the Epsilon project."
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"
@ -24,6 +24,11 @@ class ArbutilsConan(ConanFile):
cmake.definitions["SHARED"] = "On"
else:
self.output.info("Building static library.")
if self.options.staticC:
self.output.info("Linking C libraries statically.")
cmake.definitions["STATICC"] = "On"
cmake.configure()
cmake.build()

View File

@ -2,6 +2,4 @@
Arbutils::__ConstStringCharHolder* Arbutils::CaseInsensitiveConstString::__emptyString =
new __ConstStringCharHolder("", 0);
;
Arbutils::__ConstStringCharHolder* Arbutils::ConstString::__emptyString = new __ConstStringCharHolder("", 0);
;
Arbutils::__ConstStringCharHolder* Arbutils::ConstString::__emptyString = new __ConstStringCharHolder("", 0);