Commit fdefe49b authored by Michaël Roynard's avatar Michaël Roynard
Browse files

WIP add conan support

parent ed382bff
Pipeline #1945 passed with stage
in 1 minute and 7 seconds
variables:
CC: "gcc" # eg. gcc or clang
CXX: "g++" # eg. g++ or clang++
RELEASE_TYPE: "Release" # default release type
COMPILER_VERSION: "7.3" # version of the compiler
COMPILER_LIBCXX: "libstdc++11" # libcxx with which we link against
CMAKE_GENERATOR: "-G Ninja" # include -G if defined
BUILD_DIRECTORY: "build-in-docker" # build directory name
SOURCE_DIRECTORY: ".." # where cmake search source files from the build directory
......@@ -23,6 +26,12 @@ stages:
- mkdir -p $BUILD_DIRECTORY
- cd $BUILD_DIRECTORY
- if [ "$CLEAN" == "ON" ]; then rm -rf ./*; fi
- conan install ..
--build missing
-s compiler=$CC
-s compiler.version=$COMPILER_VERSION
-s compiler.libcxx=$COMPILER_LIBCXX
-s build_type=$RELEASE_TYPE
- cmake $CMAKE_GENERATOR
-DWITH_TESTS=$TESTS
$SOURCE_DIRECTORY
......@@ -33,23 +42,18 @@ stages:
distcheck-linux-gcc-release:
<<: *distcheck-basic-linux
variables:
RELEASE_TYPE: "Release"
CC: "gcc"
CXX: "g++"
distcheck-linux-clang-release:
<<: *distcheck-basic-linux
variables:
RELEASE_TYPE: "Release"
CC: "clang"
CXX: "clang++"
COMPILER_VERSION: "6.0"
distcheck-linux-gcc-debug:
<<: *distcheck-basic-linux
variables:
RELEASE_TYPE: "Debug"
CC: "gcc"
CXX: "g++"
distcheck-linux-clang-debug:
<<: *distcheck-basic-linux
......@@ -57,3 +61,4 @@ distcheck-linux-clang-debug:
RELEASE_TYPE: "Debug"
CC: "clang"
CXX: "clang++"
COMPILER_VERSION: "6.0"
......@@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.8.2) # required for cxx_std_17
project(GTest-constexpr-ext VERSION 0.0.1 LANGUAGES CXX)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
SET(COMPILER_CLANG OFF)
SET(COMPILER_GCC OFF)
SET(COMPILER_ICC OFF)
......
[requires]
gtest/1.8.0@bincrafters/stable
[generators]
cmake
set(GTEST_CONSTEXPR_EXT_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/include")
add_library(Gtest-constexpr-ext INTERFACE)
target_compile_features(Gtest-constexpr-ext INTERFACE cxx_std_17)
target_include_directories(Gtest-constexpr-ext INTERFACE ${GTEST_CONSTEXPR_EXT_INCLUDE_DIR})
find_package(Threads REQUIRED)
find_package(GTest REQUIRED)
target_include_directories(Gtest-constexpr-ext INTERFACE ${GTEST_INCLUDE_DIRS})
if (PLATFORM_WIN32)
target_link_libraries(Gtest-constexpr-ext INTERFACE ${GTEST_BOTH_LIBRARIES})
else (PLATFORM_WIN32)
target_link_libraries(Gtest-constexpr-ext INTERFACE ${GTEST_BOTH_LIBRARIES} pthread)
endif (PLATFORM_WIN32)
target_link_libraries(Gtest-constexpr-ext INTERFACE ${CONAN_LIBS})
# dummy static project not linked anywere needed so that a vcxproj is generated with the sources in the solution
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
......@@ -24,11 +15,4 @@ set_target_properties(Gtest-constexpr-ext_srcs PROPERTIES LINKER_LANGUAGE CXX)
target_compile_features(Gtest-constexpr-ext_srcs PUBLIC cxx_std_17)
target_include_directories(Gtest-constexpr-ext_srcs PUBLIC ${GTEST_CONSTEXPR_EXT_INCLUDE_DIR})
source_group(TREE ${GTEST_CONSTEXPR_EXT_INCLUDE_DIR} FILES ${GTEST_CONSTEXPR_EXT_SOURCES})
target_include_directories(Gtest-constexpr-ext_srcs PUBLIC ${GTEST_INCLUDE_DIRS})
if (PLATFORM_WIN32)
target_link_libraries(Gtest-constexpr-ext_srcs PUBLIC ${GTEST_BOTH_LIBRARIES})
else (PLATFORM_WIN32)
target_link_libraries(Gtest-constexpr-ext_srcs PUBLIC ${GTEST_BOTH_LIBRARIES} pthread)
endif (PLATFORM_WIN32)
target_link_libraries(Gtest-constexpr-ext_srcs PUBLIC ${CONAN_LIBS})
......@@ -11,17 +11,12 @@ macro(add_unit_test Executable Source)
target_link_libraries(test_${Executable} PRIVATE Gtest-constexpr-ext)
target_include_directories(test_${Executable} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(test_${Executable} PRIVATE ${GTEST_INCLUDE_DIRS})
if(PLATFORM_UNIX AND COMPILER_CLANG)
target_compile_options(test_${Executable} PRIVATE -Wno-unused-private-field)
endif()
if (PLATFORM_WIN32)
target_link_libraries(test_${Executable} PRIVATE ${GTEST_BOTH_LIBRARIES})
else (PLATFORM_WIN32)
target_link_libraries(test_${Executable} PRIVATE ${GTEST_BOTH_LIBRARIES} pthread)
endif (PLATFORM_WIN32)
target_link_libraries(Gtest-constexpr-ext INTERFACE ${CONAN_LIBS})
add_dependencies(tests-compile test_${Executable})
endmacro(add_unit_test)
......@@ -30,9 +25,6 @@ option(WITH_TESTS "Compile and run tests" ON)
if(WITH_TESTS)
find_package(Threads REQUIRED)
find_package(GTest REQUIRED)
add_subdirectory(gtest-constexpr-ext)
endif(WITH_TESTS)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment