60 lines
1.9 KiB
CMake
60 lines
1.9 KiB
CMake
cmake_minimum_required(VERSION 3.5)
|
|
project(libtriskele VERSION 1.0.0 LANGUAGES C CXX)
|
|
|
|
# Add custom modules like FindTBB.cmake
|
|
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake)
|
|
|
|
##############################################
|
|
# Find dependencies
|
|
|
|
find_package(Boost REQUIRED system chrono thread program_options date_time serialization filesystem unit_test_framework)
|
|
find_package(GDAL REQUIRED)
|
|
find_package(TBB REQUIRED)
|
|
find_package(Threads REQUIRED)
|
|
find_package(TinyXML)
|
|
|
|
##############################################
|
|
# Create triskele and set properties
|
|
|
|
list(APPEND TRISKELE_SRC
|
|
"src/ArrayTree/triskeleArrayTreeBase.cpp"
|
|
"src/QuadTree/QuadTreeBuilder.cpp"
|
|
"src/IImage.cpp"
|
|
"src/Tree.cpp"
|
|
"src/triskeleBase.cpp"
|
|
"src/triskeleDebug.cpp")
|
|
|
|
if (TinyXML_FOUND)
|
|
list(APPEND TRISKELE_SRC "src/XMLTree/XMLTreeBuilder.cpp")
|
|
message(STATUS "TinyXML found, XMLTreeBuilder will be compiled")
|
|
else()
|
|
message(WARNING "TinyXML not found, XMLTreeBuilder won't be compiled")
|
|
endif(TinyXML_FOUND)
|
|
|
|
add_library(triskele
|
|
${TRISKELE_SRC})
|
|
|
|
target_include_directories(triskele
|
|
PUBLIC
|
|
$<INSTALL_INTERFACE:include>
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
${GDAL_INCLUDE_DIR})
|
|
|
|
target_link_libraries(triskele ${BOOST_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${GDAL_LIBRARY} ${TBB_LIBRARIES})
|
|
# ${TinyXML_LIBRARY})
|
|
|
|
target_compile_definitions(triskele PUBLIC -DNDEBUG -DNO_OTB -DINTEL_TBB_THREAD) # -DBOOST_DISABLE_ASSERTS)
|
|
|
|
# Add Warnings for Unix and Windows, Optimization, MMD and debug for Unix
|
|
if(MSVC)
|
|
# Force to always compile with W4
|
|
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
|
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
else()
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
|
|
endif()
|
|
elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
|
# Update if necessary
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wall -MMD -pthread -g")
|
|
endif()
|