Commit 845976db authored by Edwin Carlinet's avatar Edwin Carlinet

Update conan build system.

Do not rely on cmake to build.
parent 03d2059f
Pipeline #19800 failed with stages
in 30 minutes and 3 seconds
......@@ -22,9 +22,6 @@ endif ()
find_package(Boost 1.58 COMPONENTS program_options REQUIRED)
find_package(FreeImage REQUIRED)
find_package(TBB)
find_package(Qt4)
# CONFIGURE COMPILER LAUNCHERS
......
from conans import CMake, ConanFile, tools
import os
class Pylene(ConanFile):
name = "pylene"
version = "head"
license = "https://gitlab.lrde.epita.fr/olena/pylene/blob/dev/LICENSE"
license = "MPL v2"
url = "https://gitlab.lrde.epita.fr/olena/pylene"
description = "C++ Generic Image Processing Library."
settings = "os", "compiler", "arch", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
"freeimage": [True, False],
"boost": [True, False]}
"shared": [True, False],
"fPIC": [True, False]
}
default_options = {
"shared": False,
"fPIC": False,
"freeimage": False,
"boost": False,
"gtest:shared": False
"shared": False,
"fPIC": False,
"gtest:shared": False,
"boost:header_only": True
}
generators = [ "cmake", "cmake_paths", "cmake_find_package" ]
exports_sources = ["pylene/*", "cmake/*", "CMakeLists.txt", "LICENSE"]
build_requires = [
"gtest/[>=1.10]",
"benchmark/[>=1.5.0]",
]
requires = [
"range-v3/0.10.0",
"fmt/6.0.0",
"boost/[>=1.69]"
]
def configure(self):
self.settings.compiler.cppstd = "20"
tools.check_min_cppstd(self, "20")
def build(self):
cmake = CMake(self)
......@@ -33,26 +46,20 @@ class Pylene(ConanFile):
cmake.install()
def package(self):
self.copy("*", dst="", src="cmake")
self.copy("FindFreeImage.cmake", dst="", src="cmake")
tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
def package_info(self):
if self.settings.compiler in ["gcc", "clang"]:
self.cpp_info.cppflags = ["-std=c++20"]
# developer dependancies (to be removed)
def build_requirements(self):
self.build_requires("gtest/[>=1.10]", force_host_context=True)
self.build_requires("benchmark/[>=1.5.0]", force_host_context=True)
# Requirements part of the INTERFACE
def requirements(self):
self.requires("range-v3/0.10.0@ericniebler/stable")
self.requires("fmt/6.0.0")
self.cpp_info.system_libs.append("freeimage")
self.cpp_info.names["cmake_find_package"] = "Pylene"
self.cpp_info.names["cmake_find_package_multi"] = "Pylene"
self.cpp_info.libs = [ "Pylene" ]
self.cpp_info.cxxflags.append(tools.cppstd_flag(self.settings))
if self.options.freeimage:
self.requires("freeimage/3.18.0@dutiona/stable")
v = tools.Version(self.settings.compiler.version)
if self.settings.compiler == "gcc" and v.major == "9":
self.cpp_info.cxxflags.append("-fconcepts")
if self.options.boost:
self.requires("boost/1.69.0@conan/stable")
def package_id(self):
del self.info.settings.compiler.cppstd
......@@ -4,7 +4,7 @@ find_package(Boost 1.58 REQUIRED)
find_package(FreeImage REQUIRED)
find_package(TBB)
find_package(range-v3 0.10.0 REQUIRED CONFIG)
find_package(range-v3 0.10.0 REQUIRED)
find_package(fmt 6.0 REQUIRED)
set(PYLENE_USE_TBB YES CACHE BOOL "Set to NO to disable use of TBB and parallelization")
......@@ -36,8 +36,8 @@ target_include_directories(Pylene PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_include_directories(Pylene SYSTEM PUBLIC ${Boost_INCLUDE_DIR})
target_link_libraries(Pylene PUBLIC range-v3)
target_include_directories(Pylene SYSTEM PUBLIC $<BUILD_INTERFACE:${Boost_INCLUDE_DIRS}>)
target_link_libraries(Pylene PUBLIC range-v3::range-v3)
target_link_libraries(Pylene PUBLIC fmt::fmt)
target_link_libraries(Pylene PRIVATE FreeImage::FreeImage)
......@@ -73,7 +73,7 @@ target_sources(Pylene PRIVATE
# Compiler configurations
target_compile_features(Pylene PUBLIC cxx_std_20)
if (CMAKE_COMPILER_IS_GNUCXX)
if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
target_compile_options(Pylene PUBLIC -fconcepts)
endif()
......
project(PyleneTest)
cmake_minimum_required(VERSION 3.8.2)
cmake_minimum_required(VERSION 3.11)
include("${CMAKE_CURRENT_BINARY_DIR}/conan_paths.cmake")
if (EXISTS "${CMAKE_CURRENT_BINARY_DIR}/conan_paths.cmake")
include("${CMAKE_CURRENT_BINARY_DIR}/conan_paths.cmake")
endif()
find_package(Pylene REQUIRED)
find_package(FreeImage REQUIRED)
add_executable(main main.cpp)
target_link_libraries(main Pylene::Pylene FreeImage::FreeImage)
target_link_libraries(main Pylene::Pylene)
......@@ -3,7 +3,7 @@ import os
class PyleneTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = [ "cmake_paths", "cmake_find_package" ]
generators = [ "cmake_find_package" ]
def build(self):
......
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