Maybe a fix for the issue with tests not linking properly
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2019-12-31 18:41:41 +01:00
parent 0c8060738f
commit 23a4c64787
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 14 additions and 8 deletions

View File

@ -19,7 +19,7 @@ steps:
CXX: clang++ CXX: clang++
commands: commands:
- conan remote add epsilon-public https://packages.p-epsilon.com/artifactory/api/conan/epsilon-public - conan remote add epsilon-public https://packages.p-epsilon.com/artifactory/api/conan/epsilon-public
- cmake -DCMAKE_BUILD_TYPE=Debug . -B build-debug - cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ . -B build-debug
- cmake --build build-debug --target all -- -j 4 - cmake --build build-debug --target all -- -j 4
- build-debug/bin/pkmnLibtests -s --durations yes --use-colour yes - build-debug/bin/pkmnLibtests -s --durations yes --use-colour yes
- name: test-release-linux - name: test-release-linux
@ -32,7 +32,7 @@ steps:
CXX: clang++ CXX: clang++
commands: commands:
- conan remote add epsilon-public https://packages.p-epsilon.com/artifactory/api/conan/epsilon-public - conan remote add epsilon-public https://packages.p-epsilon.com/artifactory/api/conan/epsilon-public
- cmake -DCMAKE_BUILD_TYPE=Release . -B build-release - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ . -B build-release
- cmake --build build-release --target all -- -j 4 - cmake --build build-release --target all -- -j 4
- build-release/bin/pkmnLibtests -s --durations yes --use-colour yes - build-release/bin/pkmnLibtests -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/CreatureLibTests - valgrind --tool=memcheck --gen-suppressions=all --leak-check=full --leak-resolution=med --track-origins=yes --vgdb=no --error-exitcode=1 build-release/CreatureLibTests

View File

@ -12,14 +12,20 @@ if (WINDOWS)
ADD_DEFINITIONS(-D WINDOWS=1) ADD_DEFINITIONS(-D WINDOWS=1)
endif(WINDOWS) endif(WINDOWS)
message(STATUS "Using ${CMAKE_CXX_COMPILER}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++")
message(STATUS "Using:
\t C ${CMAKE_C_COMPILER}
\t C++ ${CMAKE_CXX_COMPILER}
\t CXX ABI ${CMAKE_CXX_COMPILER_ABI}
\t C++ Version ${CMAKE_CXX_STANDARD}")
if (NOT EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) if (NOT EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
message(WARNING "The file conanbuildinfo.cmake doesn't exist, running conan install.") message(WARNING "The file conanbuildinfo.cmake doesn't exist, running conan install.")
string(REPLACE "." ";" VERSION_LIST "${CMAKE_CXX_COMPILER_VERSION}") string(REPLACE "." ";" VERSION_LIST "${CMAKE_CXX_COMPILER_VERSION}")
list(GET VERSION_LIST 0 MAJOR) list(GET VERSION_LIST 0 MAJOR)
execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build missing -s compiler=clang -s compiler.libcxx=libstdc++ -s compiler.version=${MAJOR}) execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build CreatureLib -s compiler=clang -s compiler.libcxx=libstdc++11 -s compiler.version=${MAJOR})
endif () endif ()
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup() conan_basic_setup()
@ -28,19 +34,19 @@ conan_basic_setup()
# Create Core library with files in src/Core # Create Core library with files in src/Core
file(GLOB_RECURSE CORE_SRC_FILES "src/*.cpp" "src/*.hpp") file(GLOB_RECURSE CORE_SRC_FILES "src/*.cpp" "src/*.hpp")
add_library(pkmnLib SHARED ${CORE_SRC_FILES}) add_library(pkmnLib SHARED ${CORE_SRC_FILES})
set(CMAKE_VERBOSE_MAKEFILE ON)
foreach (_variableName ${CONAN_LIBS}) foreach (_variableName ${CONAN_LIBS})
message(STATUS "Lib: ${_variableName}") message(STATUS "Lib: ${_variableName}")
endforeach() endforeach()
target_link_libraries(pkmnLib ${CONAN_LIBS}) target_link_libraries(pkmnLib PUBLIC ${CONAN_LIBS})
if (NOT DEFINED CONAN_EXPORTED) if (NOT DEFINED CONAN_EXPORTED)
# Create Test executable # Create Test executable
file(GLOB_RECURSE TEST_FILES "tests/*.cpp" "tests/*.hpp") file(GLOB_RECURSE TEST_FILES "tests/*.cpp" "tests/*.hpp")
add_executable(pkmnLibTests ${TEST_FILES} extern/catch.hpp) add_executable(pkmnLibTests ${TEST_FILES} extern/catch.hpp)
target_link_libraries(pkmnLibTests ${CONAN_LIBS} pkmnLib) target_link_libraries(pkmnLibTests PUBLIC ${CONAN_LIBS} pkmnLib)
# Add a definition for the test library # Add a definition for the test library
target_compile_definitions(pkmnLibTests PRIVATE TESTS_BUILD) target_compile_definitions(pkmnLibTests PRIVATE TESTS_BUILD)