Link pthread statically.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-08-20 12:54:37 +02:00
parent a91a57aa0a
commit 8dac6c632b
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
3 changed files with 14 additions and 14 deletions

View File

@ -37,7 +37,6 @@ steps:
- 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 -DTESTS=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 -DTESTS=ON
- cmake --build build-release-windows --target all -- -j 4 - cmake --build build-release-windows --target all -- -j 4
- export WINEARCH=win64 - export WINEARCH=win64
- cp /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll /drone/src/build-release-windows/
- wine build-release-windows/ArbutilsTests.exe -s exclude:"Throw exception get stack trace" - wine build-release-windows/ArbutilsTests.exe -s exclude:"Throw exception get stack trace"
- name: conan-deploy - name: conan-deploy
image: deukhoofd/linux64builder image: deukhoofd/linux64builder

View File

@ -5,7 +5,7 @@
#include <exception> #include <exception>
#include <string> #include <string>
#include "../src/Exception.hpp" #include "../src/Exception.hpp"
#define export extern "C" #define export extern "C" [[maybe_unused]]
#define ArbutilsException 3; #define ArbutilsException 3;

View File

@ -27,17 +27,6 @@ endif()
file(GLOB_RECURSE SRC_FILES "src/*.cpp" "src/*.hpp" "CInterface/*.cpp" "CInterface/*.hpp") file(GLOB_RECURSE SRC_FILES "src/*.cpp" "src/*.hpp" "CInterface/*.cpp" "CInterface/*.hpp")
add_library(Arbutils ${LIBTYPE} ${SRC_FILES}) add_library(Arbutils ${LIBTYPE} ${SRC_FILES})
if (TESTS)
# If we want a tests executable, grab all tests source files
file(GLOB_RECURSE TEST_FILES "tests/*.cpp" "tests/*.hpp")
# And create an executable from it. Also include catch.hpp.
add_executable(ArbutilsTests ${TEST_FILES} extern/catch.hpp)
# And finally link the library to the executable.
target_link_libraries(ArbutilsTests Arbutils)
# Add a compilation definition to the code that we are building a test build.
target_compile_definitions(ArbutilsTests PRIVATE TESTS_BUILD)
endif ()
# If we are building for Windows we need to set some specific variables. # If we are building for Windows we need to set some specific variables.
if (WINDOWS) if (WINDOWS)
MESSAGE(WARNING, "Using Windows Build.") MESSAGE(WARNING, "Using Windows Build.")
@ -54,10 +43,22 @@ if (NOT WINDOWS AND PRETTYTRACES)
endif() endif()
# If we want to link the C and C++ library statically, link those as well. # If we want to link the C and C++ library statically, link those as well.
if (STATICC) if (STATICC)
set(LINKS ${LINKS} -static-libgcc -static-libstdc++) set(LINKS ${LINKS} -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread)
endif(STATICC) endif(STATICC)
target_link_libraries(Arbutils ${LINKS}) target_link_libraries(Arbutils ${LINKS})
if (TESTS)
# If we want a tests executable, grab all tests source files
file(GLOB_RECURSE TEST_FILES "tests/*.cpp" "tests/*.hpp")
# And create an executable from it. Also include catch.hpp.
add_executable(ArbutilsTests ${TEST_FILES} extern/catch.hpp)
# And finally link the library to the executable.
target_link_libraries(ArbutilsTests Arbutils ${LINKS})
# Add a compilation definition to the code that we are building a test build.
target_compile_definitions(ArbutilsTests PRIVATE TESTS_BUILD)
endif ()
# If we aren't building for Windows, also include an option for installing on unix. # If we aren't building for Windows, also include an option for installing on unix.
if (NOT WINDOWS) if (NOT WINDOWS)
install(TARGETS Arbutils install(TARGETS Arbutils