Commit 26ec280c authored by Edwin Carlinet's avatar Edwin Carlinet
Browse files

Move mln in pylene/include/ and add installation targets.

parent f6207975
Pipeline #12409 passed with stages
in 10 minutes and 18 seconds
......@@ -12,50 +12,12 @@ find_package(Qt4)
find_package(range-v3 REQUIRED)
# CONFIGURATION OPTIONS
set(MLN_USE_TBB YES CACHE BOOL "Set to NO to disable use of TBB and parallelization")
option(PYLENE_ENABLE_BENCHMARKS "Require Google Benchmark library. Set to YES to enable the compilation of benchmarks." YES)
option(PYLENE_ENABLE_TESTS "Require Google Test library. Set to YES to enable the compilation of tests." YES)
# Proper project creation
set(MLN_INCLUDE_DIR "${PROJECT_SOURCE_DIR}")
if(MSVC OR APPLE)
#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)
file(GLOB_RECURSE MLN_SOURCES "${MLN_INCLUDE_DIR}/*.hpp")
add_library(Mln_srcs EXCLUDE_FROM_ALL STATIC ${MLN_SOURCES})
set_target_properties(Mln_srcs PROPERTIES LINKER_LANGUAGE CXX)
target_include_directories(Mln_srcs PUBLIC ${MLN_INCLUDE_DIR})
source_group(TREE ${MLN_INCLUDE_DIR} FILES ${MLN_SOURCES})
endif()
add_library(Mln INTERFACE)
target_include_directories(Mln INTERFACE ${MLN_INCLUDE_DIR})
target_link_libraries(Mln INTERFACE range-v3)
include_directories(SYSTEM ${Boost_INCLUDE_DIR})
include_directories(${FreeImage_INCLUDE_DIRS})
link_directories(${FreeImage_LIBRARY_DIR})
link_directories(${Boost_LIBRARY_DIRS})
if (TBB_FOUND AND MLN_USE_TBB)
include_directories(${TBB_INCLUDE_DIRS})
link_directories(${TBB_LIBRARY_DIRS})
link_libraries(${TBB_LIBRARIES})
else()
set(MLN_USE_TBB OFF)
add_definitions(-DMLN_NO_TBB)
endif()
if (UNIX AND NOT APPLE)
link_libraries(rt)
endif()
# Compiler configurations
target_compile_features(Mln INTERFACE cxx_std_17)
if ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
add_compile_options("-Wextra" "-Wall" "-Werror" "-Wno-deprecated-declarations")
endif()
......@@ -86,10 +48,6 @@ endif()
ENABLE_TESTING()
#### Configuration of the Compiler ###
# set BOOST to use variadic macros
add_definitions(-D BOOST_PP_VARIADICS=1)
# Subdirectories
if (PYLENE_ENABLE_BENCHMARKS)
......@@ -99,10 +57,12 @@ if (PYLENE_ENABLE_TESTS)
add_subdirectory(tests EXCLUDE_FROM_ALL)
endif()
add_subdirectory(pylene)
add_subdirectory(doc EXCLUDE_FROM_ALL)
add_subdirectory(apps EXCLUDE_FROM_ALL)
add_subdirectory(cli EXCLUDE_FROM_ALL)
set(CPACK_SOURCE_GENERATOR "TBZ2")
set(CPACK_SOURCE_IGNORE_FILES "${CMAKE_CURRENT_BINARY_DIR}/;/\\\\.git/;.*~;#.*#")
INCLUDE(CPack)
......
......@@ -37,9 +37,9 @@ add_custom_target(benchmarks-run
macro(add_benchmark Executable)
set(Sources ${ARGN})
add_executable(BM${Executable} EXCLUDE_FROM_ALL ${Sources})
add_executable(BM${Executable} ${Sources})
target_link_libraries(BM${Executable} PRIVATE Mln benchmark::benchmark ${FreeImage_LIBRARIES})
target_link_libraries(BM${Executable} PRIVATE Pylene::Pylene benchmark::benchmark ${FreeImage_LIBRARIES})
target_include_directories(BM${Executable} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_dependencies(benchmarks BM${Executable})
......@@ -49,7 +49,7 @@ macro(add_benchmark Executable)
DEPENDS BM${Executable}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
USES_TERMINAL)
add_dependencies(benchmarks-run BM${Executable}_run)
endmacro(add_benchmark)
......
This diff is collapsed.
......@@ -26,7 +26,7 @@ DOXYFILE_ENCODING = UTF-8
# identify the project. Note that if you do not use Doxywizard you need
# to put quotes around the project name if it contains spaces.
PROJECT_NAME = Milena
PROJECT_NAME = Pylene
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or
......@@ -671,7 +671,7 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = ../mln
INPUT = ../pylene/include
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
......
......@@ -35,7 +35,7 @@ add_custom_target(build-images
DEPENDS "${DOCUMENTATION_IMAGES}")
link_libraries(${Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE} ${FreeImage_LIBRARY})
link_libraries(Mln)
link_libraries(Pylene::Pylene)
add_executable(erosion-cli erosion-cli.cpp)
add_executable(staff_lines staff_lines.cpp)
......
include(CMakePackageConfigHelpers)
find_package(Boost 1.42 REQUIRED)
find_package(range-v3 REQUIRED)
find_package(FreeImage REQUIRED)
find_package(TBB)
set(PYLENE_USE_TBB YES CACHE BOOL "Set to NO to disable use of TBB and parallelization")
add_library(Pylene INTERFACE)
if (TBB_FOUND AND PYLENE_USE_TBB)
target_link_libraries(Pylene INTERFACE tbb)
else()
set(PYLENE_USE_TBB OFF)
#FIXME use a config file
target_compile_definitions(Pylene INTERFACE MLN_NO_TBB)
endif()
# FIXME: still useful ?
if (UNIX AND NOT APPLE)
target_link_libraries(Pylene INTERFACE rt)
endif()
# Set dependancies
target_include_directories(Pylene INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_include_directories(Pylene SYSTEM INTERFACE ${Boost_INCLUDE_DIR})
target_include_directories(Pylene INTERFACE ${FreeImage_INCLUDE_DIRS})
set_property(TARGET Pylene APPEND
PROPERTY INTERFACE_LINK_DIRECTORIES ${FreeImage_LIBRARY_DIR} ${Boost_LIBRARY_DIRS})
target_link_libraries(Pylene INTERFACE range-v3)
# Set sources
file(GLOB_RECURSE sources "include/mln/*.hpp")
target_sources(Pylene INTERFACE $<BUILD_INTERFACE:${sources}>)
# Compiler configurations
target_compile_features(Pylene INTERFACE cxx_std_17)
# IDE configuration
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/include/mln FILES ${sources})
add_library(Pylene::Pylene ALIAS Pylene)
install(TARGETS Pylene
EXPORT PyleneTargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
INCLUDES DESTINATION include)
write_basic_package_version_file(
PyleneConfigVersion.cmake
VERSION ${PACKAGE_VERSION}
COMPATIBILITY AnyNewerVersion
)
configure_file(
PyleneConfig.cmake.in
PyleneConfig.cmake
@ONLY
)
install(EXPORT PyleneTargets
FILE PyleneTargets.cmake
NAMESPACE Pylene::
DESTINATION lib/cmake/pylene
)
install(DIRECTORY include/mln
DESTINATION include)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/PyleneConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/PyleneConfigVersion.cmake
DESTINATION lib/cmake/pylene )
include(CMakeFindDependencyMacro)
find_dependency(Boost 1.42 REQUIRED)
find_dependency(range-v3 REQUIRED)
include("${CMAKE_CURRENT_LIST_DIR}/PyleneTargets.cmake")
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