-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
74 lines (63 loc) · 3.41 KB
/
Copy pathCMakeLists.txt
File metadata and controls
74 lines (63 loc) · 3.41 KB
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
# --------------------------------------------------------------------------- #
# Main CMake file for SMS++ tools #
# #
# This file allows one to build the tests using CMake. #
# To do so, you can use the following commands: #
# #
# $ cmake -S <source-path> -B <build-path> #
# $ cmake --build <build-path> #
# #
# Donato Meoli #
# Dipartimento di Informatica #
# Universita' di Pisa #
# --------------------------------------------------------------------------- #
cmake_minimum_required(VERSION 3.21)
cmake_policy(VERSION 3.15)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/DeriveVersion.cmake)
smspp_derive_version(SMSPP_MODULE_VERSION)
project(SMS++_tools
VERSION ${SMSPP_MODULE_VERSION}
DESCRIPTION "SMS++ tools"
HOMEPAGE_URL https://gitlab.com/smspp/tools
LANGUAGES C CXX)
# These variables make the code harder to read but easier to change.
set(modName ${PROJECT_NAME})
# C-safe form of modName for the preprocessor macros in <modName>Config.h
set(modMacro "SMSpp_tools")
# Find out if it's being called by the umbrella.
get_directory_property(hasParent PARENT_DIRECTORY)
# Utility function to standardize installation and runtime dependency handling
# for SMS++ tools.
function(smspp_install target_name)
if (WIN32 AND BUILD_SHARED_LIBS AND NOT DEFINED ENV{CONDA_BUILD})
# On Windows with shared libraries enabled copies all runtime DLL
# dependencies next to the executable in the build directory
# (POST_BUILD), using CMake's TARGET_RUNTIME_DLLS generator expression
add_custom_command(TARGET ${target_name} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_RUNTIME_DLLS:${target_name}>
$<TARGET_FILE_DIR:${target_name}>
COMMAND_EXPAND_LISTS
COMMENT "Copying runtime DLLs next to ${target_name}.exe")
endif ()
install(TARGETS ${target_name}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endfunction()
# ----- Configuration header ------------------------------------------------ #
# This will generate a *Config.h header in the build directory, which every
# tool sees since the build directory is on their include path.
configure_file(cmake/${modName}Config.h.in ${modName}Config.h)
include_directories(${PROJECT_BINARY_DIR})
# ----- Settings ------------------------------------------------------------ #
# This is needed for setting the runtime path when installing.
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
include(GNUInstallDirs)
# ----- Tools --------------------------------------------------------------- #
add_subdirectory(block_solver)
add_subdirectory(investmentblock_solver)
add_subdirectory(sddp_solver)
add_subdirectory(tssb_solver)
add_subdirectory(mssb_solver)
add_subdirectory(ucblock_solver)
add_subdirectory(chgcfg)
# --------------------------------------------------------------------------- #