CMakeLists.txt 2.66 KB
Newer Older
1 2 3
cmake_minimum_required (VERSION 3.2)
project (ALTA CXX)

4
# Find required packages
5 6 7 8
find_package(EIGEN3)

add_definitions(-DALTA_PLUGIN_DIRECTORY="/usr/lib/alta_plugins")

9
# Add core and library include files
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
include_directories("external/build" "sources" ${EIGEN3_INCLUDE_DIR})
include_directories("external")

#############################
#      Helper functions     #
#############################

function(alta_add_plugin name sources)
	add_library(${name} SHARED sources/plugins/${sources})
	target_link_libraries(${name} core)
	target_compile_features(${name} PRIVATE cxx_range_for)
endfunction(alta_add_plugin)

function(alta_add_soft name sources)
	add_executable(${name} sources/softs/${sources})
	target_link_libraries(${name} core)
	target_compile_features(${name} PRIVATE cxx_range_for)
endfunction(alta_add_soft)


#############################
#         ALTA core         #
#############################

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
35 36 37 38 39 40 41 42 43 44 45 46

add_library(core STATIC sources/core/common.cpp
			sources/core/metrics.cpp
			sources/core/params.cpp
			sources/core/data.cpp
			sources/core/data_storage.cpp
			sources/core/function.cpp
			sources/core/plugins_manager.cpp
			sources/core/vertical_segment.cpp
			sources/core/rational_function.cpp)
target_compile_features(core PRIVATE cxx_range_for)

47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84

#############################
#         Plugins           #
#############################

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins)
set(CMAKE_SHARED_MODULE_PREFIX "")

# Data
alta_add_plugin(data_merl data_io/merl.cpp)
alta_add_plugin(data_utia data_io/utia.cpp)

# Functions
alta_add_plugin(nonlinear_function_diffuse nonlinear_function_diffuse/function.cpp)

# Fitters 
alta_add_plugin(nonlinear_fitter_eigen     nonlinear_fitter_eigen/fitter.cpp)

#############################
#          Softs            #
#############################

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/softs)

add_executable(brdf2data sources/softs/brdf2data/main.cpp)
target_link_libraries(brdf2data core)
target_compile_features(brdf2data PRIVATE cxx_range_for)

alta_add_soft(data2data data2data/main.cpp)
alta_add_soft(data2brdf data2brdf/main.cpp)


#############################
#          Tests            #
#############################

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/tests)

85
include_directories("sources/tests")
86

87 88 89
add_executable(test_data_io sources/tests/core/data-io.cpp)
target_link_libraries(test_data_io core)
target_compile_features(test_data_io PRIVATE cxx_range_for)
90

91 92
enable_testing()
add_test(data_io test_data_io)
93
set_tests_properties(data_io PROPERTIES ENVIRONMENT "TEST_DATA_DIRECTORY=${CMAKE_SOURCE_DIR}/sources/tests")