diff --git a/.drone.yml b/.drone.yml index 85519ef..afe5d83 100644 --- a/.drone.yml +++ b/.drone.yml @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index a5b38f8..b24907b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/conanfile.py b/conanfile.py index dfdd81c..4ef549d 100644 --- a/conanfile.py +++ b/conanfile.py @@ -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() diff --git a/src/ConstString.cpp b/src/ConstString.cpp index 778d98e..4b6613d 100644 --- a/src/ConstString.cpp +++ b/src/ConstString.cpp @@ -2,6 +2,4 @@ Arbutils::__ConstStringCharHolder* Arbutils::CaseInsensitiveConstString::__emptyString = new __ConstStringCharHolder("", 0); -; -Arbutils::__ConstStringCharHolder* Arbutils::ConstString::__emptyString = new __ConstStringCharHolder("", 0); -; \ No newline at end of file +Arbutils::__ConstStringCharHolder* Arbutils::ConstString::__emptyString = new __ConstStringCharHolder("", 0); \ No newline at end of file