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 --build build-release-windows --target all -- -j 4
- 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"
- name: conan-deploy
image: deukhoofd/linux64builder

View File

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

View File

@ -27,17 +27,6 @@ endif()
file(GLOB_RECURSE SRC_FILES "src/*.cpp" "src/*.hpp" "CInterface/*.cpp" "CInterface/*.hpp")
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 (WINDOWS)
MESSAGE(WARNING, "Using Windows Build.")
@ -54,10 +43,22 @@ if (NOT WINDOWS AND PRETTYTRACES)
endif()
# If we want to link the C and C++ library statically, link those as well.
if (STATICC)
set(LINKS ${LINKS} -static-libgcc -static-libstdc++)
set(LINKS ${LINKS} -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread)
endif(STATICC)
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 (NOT WINDOWS)
install(TARGETS Arbutils