Commit cd6cc860 authored by Michaël Roynard's avatar Michaël Roynard

Package the library

parent 9182242e
Pipeline #1963 passed with stage
in 1 minute and 6 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
......@@ -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
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"
exports_sources = "include/*", "test/*", "CMakeLists.txt"
no_copy_source = True
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