-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
117 lines (95 loc) · 3.77 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
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
35
36
37
38
39
40
41
42
43
44
45
46
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# This file is part of the Leontief distribution (https://github.com/open-risk/leontief).
# Copyright (c) 2024 Open Risk (https://www.openriskmanagement.com)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Project metadata
set(PROJECT_VENDOR "Open Risk")
set(PROJECT_CONTACT "info@openriskmanagement.com")
set(PROJECT_URL "https://github.com/open-risk/leontief")
set(PROJECT_DESCRIPTION "Leontief is a C++ package to work with Input-Output models")
cmake_minimum_required(VERSION 3.19)
# Project name and version
project(leontief)
set(LEONTIEF_VERSION_MAJOR 0)
set(LEONTIEF_VERSION_MINOR 1)
set(LEONTIEF_VERSION_PATCH 0)
set(LEONTIEF_VERSION ${LEONTIEF_VERSION_MAJOR}.${LEONTIEF_VERSION_MINOR}.${LEONTIEF_VERSION_PATCH})
# compiler choices. c++17 is required
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS -std=c++17)
add_definitions("-std=c++17")
# Create verbose output
# TODO Production options
set(CMAKE_VERBOSE_MAKEFILE on)
#set(CMAKE_BUILD_TYPE Debug)
#set(CMAKE_CXX_FLAGS_DEBUG)
set(CMAKE_PREFIX_PATH cmake-build-release)
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
SET(CMAKE_C_FLAGS_RELEASE "-O3")
# Find dependencies (installed via Conan)
find_package(Poco REQUIRED COMPONENTS Foundation Util Net)
find_package(Catch2 REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(OpenMP)
#
# SOURCE FILES
#
include_directories(.)
set(CORE_FILES
core/options.h
core/io_system.h
core/sut_system.h
core/leontief.h
)
set(UTIL_FILES
utils/matrix_generation.h
utils/utils.h
)
set(TEST_FILES
testing/test_sanity.cpp
testing/test_eigen_setup.cpp
testing/test_loading_lib.cpp
testing/test_read_exiobase.cpp
testing/test_load_a_matrix.cpp
testing/test_leontief_inverse.cpp
testing/test_ras.cpp
testing/test_agg.cpp
testing/test_disagg.cpp
testing/test_sut.cpp
)
set(SOURCE_FILES
${CORE_FILES}
${ALGORITHM_FILES}
${UTIL_FILES})
# DEBUG MODE EXAMPLE
add_executable(leontief.dbg examples/aggregation_roundtrip.cpp ${SOURCE_FILES})
target_include_directories(leontief.dbg PRIVATE ${Catch2_INCLUDE_DIRS})
target_include_directories(leontief.dbg PRIVATE ${Eigen3_INCLUDE_DIRS})
target_compile_definitions(leontief.dbg PRIVATE DEBUG_MODE=1 LOG_LEVEL=7 VERSION=${LEONTIEF_VERSION})
target_link_libraries(leontief.dbg Catch2::Catch2WithMain Eigen3::Eigen Poco::Foundation Poco::Util Poco::Net)
# PRODUCTION MODE EXAMPLE
add_executable(leontief.tty examples/inversion_benchmark.cpp ${SOURCE_FILES})
target_include_directories(leontief.tty PRIVATE ${Eigen3_INCLUDE_DIRS})
add_compile_options("-O3")
target_compile_definitions(leontief.tty PRIVATE DEBUG_MODE=0 LOG_LEVEL=7 VERSION=${LEONTIEF_VERSION})
target_link_libraries(leontief.tty Eigen3::Eigen Poco::Foundation Poco::Util Poco::Net)
# CATCH2 TESTING
include(Catch)
include(CTest)
enable_testing()
add_executable(unit_tests ${TEST_FILES} ${SOURCE_FILES})
catch_discover_tests(unit_tests)
target_include_directories(unit_tests PRIVATE ${Catch2_INCLUDE_DIRS})
target_include_directories(unit_tests PRIVATE ${Eigen3_INCLUDE_DIRS})
target_compile_definitions(unit_tests PRIVATE DEBUG_MODE=1 LOG_LEVEL=7 VERSION=${LEONTIEF_VERSION})
target_link_libraries(unit_tests Catch2::Catch2WithMain Eigen3::Eigen Poco::Foundation Poco::Util Poco::Net)