From f873dc97bf6bbe8dc5a6076d79c740eefdad5317 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sat, 11 Jul 2020 13:46:48 +0200 Subject: [PATCH] Several fixes for new build, ensuring we build DLLs for Windows, and that the proper libraries are included. --- .drone.yml | 1 + CMakeLists.txt | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 7819573..2726ddb 100644 --- a/.drone.yml +++ b/.drone.yml @@ -31,6 +31,7 @@ steps: image: deukhoofd/windowsbuilder commands: - cmake -DCMAKE_BUILD_TYPE=Release . -B build-release-windows -D CMAKE_C_COMPILER=/home/wclang/x86_64-w64-mingw32/bin/x86_64-w64-mingw32-clang -D CMAKE_CXX_COMPILER=/home/wclang/x86_64-w64-mingw32/bin/x86_64-w64-mingw32-clang++ -DWINDOWS=ON -DSTATICC=ON + - sed -i 's/-fPIC//g' build-release-windows/CMakeFiles/Arbutils.dir/flags.make - cmake --build build-release-windows --target all -- -j 4 - mv build-release-windows/ArbutilsTests build-release-windows/ArbutilsTests.exe - export WINEARCH=win64 diff --git a/CMakeLists.txt b/CMakeLists.txt index 189bf51..74b83ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,11 +18,16 @@ add_library(Arbutils ${LIBTYPE} ${SRC_FILES}) if (WINDOWS) MESSAGE(WARNING, "Using Windows Build.") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -Wa,-mbig-obj -pthread") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -Wa,-mbig-obj -pthread -wc-use-mingw-linker") + set_target_properties(Arbutils PROPERTIES SUFFIX ".dll") endif (WINDOWS) if (STATICC) - target_link_libraries(Arbutils -static) + if (WINDOWS) + target_link_libraries(Arbutils -wc-static-runtime) + else () + target_link_libraries(Arbutils -static-libgcc -static-libstdc++) + endif (WINDOWS) endif (STATICC) file(GLOB_RECURSE TEST_FILES "tests/*.cpp" "tests/*.hpp")