Commit 58a3e4ab authored by Michaël Roynard's avatar Michaël Roynard

Merge branch 'dev' into 'master'

Conan packaging integration

See merge request !3
parents 71b2f244 c6a9b2ca
Pipeline #2001 passed with stage
in 1 minute and 11 seconds
/build*
/cmake-build-*
/qt-creator
/test_package/build/*
/venv
.vs
.idea
compile_commands.json
.DS_Store
.vscode/cquery_*
CMakeLists.txt.user
\ No newline at end of file
CMakeLists.txt.user
......@@ -2,8 +2,7 @@ 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
CONAN_PROFILE: "gcc-release" # default profile to give to conan install
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
......@@ -22,16 +21,14 @@ stages:
- set -e
- export CC=$CC
- export CXX=$CXX
- $CC --version
- $CXX --version
- 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
-pr $CONAN_PROFILE
- cmake $CMAKE_GENERATOR
-DWITH_TESTS=$TESTS
$SOURCE_DIRECTORY
......@@ -42,23 +39,25 @@ stages:
distcheck-linux-gcc-release:
<<: *distcheck-basic-linux
variables:
CONAN_PROFILE: "gcc-release"
distcheck-linux-clang-release:
<<: *distcheck-basic-linux
variables:
CC: "clang"
CXX: "clang++"
COMPILER_VERSION: "6.0"
CONAN_PROFILE: "clang-release"
distcheck-linux-gcc-debug:
<<: *distcheck-basic-linux
variables:
CONAN_PROFILE: "gcc-debug"
RELEASE_TYPE: "Debug"
distcheck-linux-clang-debug:
<<: *distcheck-basic-linux
variables:
RELEASE_TYPE: "Debug"
CC: "clang"
CXX: "clang++"
COMPILER_VERSION: "6.0"
CONAN_PROFILE: "clang-debug"
RELEASE_TYPE: "Debug"
......@@ -3,7 +3,7 @@ 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()
conan_basic_setup(TARGETS)
SET(COMPILER_CLANG OFF)
SET(COMPILER_GCC OFF)
......
from conans import CMake, ConanFile, tools
class GtestconstexprextConan(ConanFile):
name = "gtest-constexpr-ext"
version = "0.1"
license = "MIT"
url = "https://gitlab.lrde.epita.fr/mroynard/gtest-constexpr-ext"
description = "Add macro to detect whether an expression is compile-time."
settings = "os", "compiler", "arch", "build_type", "cppstd"
requires = "gtest/1.8.0@bincrafters/stable"
generators = "cmake"
no_copy_source = True
def source(self):
git = tools.Git()
git.clone(self.url)
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
cmake.test()
def package(self):
self.copy("*.hpp", dst="include/gtest-constexpr-ext", src="include/gtest-constexpr-ext")
def package_id(self):
self.info.header_only()
[requires]
gtest/1.8.0@bincrafters/stable
[generators]
cmake
......@@ -3,7 +3,7 @@ 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})
target_link_libraries(Gtest-constexpr-ext INTERFACE ${CONAN_LIBS})
target_link_libraries(Gtest-constexpr-ext INTERFACE CONAN_PKG::gtest)
# 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)
......@@ -15,4 +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_link_libraries(Gtest-constexpr-ext_srcs PUBLIC ${CONAN_LIBS})
target_link_libraries(Gtest-constexpr-ext_srcs PUBLIC Gtest-constexpr-ext)
......@@ -16,7 +16,7 @@ macro(add_unit_test Executable Source)
target_compile_options(test_${Executable} PRIVATE -Wno-unused-private-field)
endif()
target_link_libraries(Gtest-constexpr-ext INTERFACE ${CONAN_LIBS})
target_link_libraries(Gtest-constexpr-ext INTERFACE CONAN_PKG::gtest)
add_dependencies(tests-compile test_${Executable})
endmacro(add_unit_test)
......
project(PackageTest CXX)
cmake_minimum_required(VERSION 3.8.2)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)
add_executable(example example.cpp)
target_link_libraries(example PRIVATE CONAN_PKG::gtest-constexpr-ext)
target_compile_features(example INTERFACE cxx_std_17)
enable_testing()
add_test(NAME example
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
COMMAND example)
import os
from conans import ConanFile, CMake, tools
class GtestconstexprextTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch", "cppstd"
generators = "cmake"
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def imports(self):
self.copy("*.dll", dst="bin", src="bin")
self.copy("*.dylib*", dst="bin", src="lib")
self.copy('*.so*', dst='bin', src='lib')
def test(self):
if not tools.cross_building(self.settings):
os.chdir("bin")
self.run(".%sexample" % os.sep)
#include <gtest-constexpr-ext/gtest-constexpr-ext.hpp>
int main() {
return 0;
}
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