-
Notifications
You must be signed in to change notification settings - Fork 34
/
CMakeLists.txt
129 lines (97 loc) · 3.35 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
118
119
120
121
122
123
124
125
126
127
128
129
cmake_minimum_required(VERSION 3.17)
# include(cmake/ProjectSettings.cmake)
project(SLIDE VERSION "3.0.0"
DESCRIPTION "A simulator for lithium-ion battery degradation"
HOMEPAGE_URL https://github.com/Battery-Intelligence-Lab/SLIDE/
LANGUAGES CXX)
include(cmake/StandardProjectSettings.cmake)
include(cmake/PreventInSourceBuilds.cmake)
enable_testing()
add_subdirectory(src bin)
include(cmake/Coverage.cmake)
add_subdirectory(tests)
# Link this 'library' to use the warnings specified in CompilerWarnings.cmake
add_library(project_warnings INTERFACE)
# Link this 'library' to set the c++ standard / compile-time options requested
add_library(project_options INTERFACE)
target_compile_features(project_options INTERFACE cxx_std_20)
add_executable(slide
src/main.cpp
)
target_link_libraries(slide
PRIVATE
src
project_warnings
project_options
)
target_include_directories(slide
PUBLIC
data
)
# message(STATUS "Project: ${PROJECT_NAME} version ${PROJECT_HOMEPAGE_URL}")
# cmake --build ./build/ --parallel $(($(nproc)-1))
# cmake --build ./build/ --clean-first
# cmake --install build --strip
# cmake --install build --config Debug
# ccmake -G "Unix Makefiles" -S . -B ./build
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
option(ENABLE_BUILD_WITH_TIME_TRACE "Enable -ftime-trace to generate time tracing .json files on clang" OFF)
if(ENABLE_BUILD_WITH_TIME_TRACE)
add_compile_definitions(project_options INTERFACE -ftime-trace)
endif()
endif()
# # enable cache system
# include(cmake/Cache.cmake)
# standard compiler warnings
include(cmake/CompilerWarnings.cmake)
set_project_warnings(project_warnings)
# # sanitizer options if supported by compiler
# include(cmake/Sanitizers.cmake)
# enable_sanitizers(project_options)
# enable doxygen
# include(cmake/Doxygen.cmake)
# enable_doxygen(src doxygen-docs)
# # allow for static analysis options
# include(cmake/StaticAnalyzers.cmake)
# set(CMAKE_INCLUDE_CURRENT_DIR ON)
# set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
# include(GenerateExportHeader)
# generate_export_header(${PROJECT_NAME})
set(LIB_NAME slide-lib)
add_library(${LIB_NAME} INTERFACE)
target_link_libraries(${LIB_NAME}
INTERFACE
src
)
# # install header
# install(FILES "src/slide.hpp" DESTINATION include)
include(GNUInstallDirs)
install(TARGETS ${LIB_NAME} EXPORT ${LIB_NAME}Targets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)
# install(EXPORT MyProject-targets DESTINATION lib/cmake/MyProject)
# # # install the library
# # install(TARGETS MyProject
# # EXPORT MyProject-targets
# # LIBRARY DESTINATION lib
# # ARCHIVE DESTINATION lib
# # )
# # # install export target and config for find_package
# # install(EXPORT ${LIB_NAME}Targets DESTINATION lib/cmake/${LIB_NAME})
# # include(CMakePackageConfigHelpers)
# # configure_package_config_file(
# # "MyProjectConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/MyProjectConfig.cmake"
# # INSTALL_DESTINATION "lib/cmake/${LIB_NAME}"
# # )
# # install(FILES "${CMAKE_CURRENT_BINARY_DIR}/MyProjectConfig.cmake" DESTINATION "lib/cmake/${LIB_NAME}")
# # defines targets and sources CMAKE_BUILD_PARALLEL_LEVEL -> Try this to see if it gets better than -j
# add_subdirectory(src)
# install(TARGETS slide_v3
# CONFIGURATIONS Debug
# RUNTIME DESTINATION Debug/bin)
# install(TARGETS slide_v3
# CONFIGURATIONS Release
# RUNTIME DESTINATION Release/bin)