-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
110 lines (95 loc) · 3.33 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
cmake_minimum_required(VERSION 3.16)
# Set Version, Release need cmake
set(PROJECT_VERSION_MAJOR 0)
set(PROJECT_VERSION_MINOR 0)
# use git version as library version
find_package(Git QUIET)
if (Git_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-list --count HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE _git_version
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND ${GIT_EXECUTABLE} log -1 --pretty=format:%h
OUTPUT_VARIABLE PROJECT_GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
WORKING_DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}
)
else ()
set(_git_version 0)
set(PROJECT_GIT_HASH "")
endif ()
project(lessampler LANGUAGES C CXX VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${_git_version})
set(CMAKE_CXX_STANDARD 20)
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -EHsc")
endif ()
# Add support for -DDEBUG_MODE=ON
set(DEBUG_SUFFIX)
if (CMAKE_BUILD_TYPE STREQUAL Debug)
ADD_DEFINITIONS(-DDEBUG_MODE)
set(DEBUG_SUFFIX "d")
endif ()
# Generate Configure file
configure_file(
"${PROJECT_SOURCE_DIR}/config.h.in"
"${PROJECT_BINARY_DIR}/lessconfig.h"
)
if (MSVC)
configure_file(
"${PROJECT_SOURCE_DIR}/assets/lessampler.rc.in"
"${PROJECT_BINARY_DIR}/lessampler.rc"
)
endif ()
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
set(WORLD_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(WORLD_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(FTXUI_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(FTXUI_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(FTXUI_ENABLE_INSTALL OFF CACHE BOOL "" FORCE)
set(INICPP_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(INICPP_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(BUILD_PROGRAMS OFF CACHE BOOL "" FORCE)
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(ENABLE_CPACK OFF CACHE BOOL "" FORCE)
set(ENABLE_MPEG OFF CACHE BOOL "" FORCE)
set(ENABLE_EXTERNAL_LIBS OFF CACHE BOOL "" FORCE)
# Only for rapidjson
set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "" FORCE)
set(RAPIDJSON_BUILD_DOC OFF CACHE BOOL "" FORCE)
set(RAPIDJSON_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(RAPIDJSON_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(RAPIDJSON_BUILD_THIRDPARTY_GTEST OFF CACHE BOOL "" FORCE)
set(RAPIDJSON_BUILD_CXX11 OFF CACHE BOOL "" FORCE)
set(RAPIDJSON_BUILD_CXX17 ON CACHE BOOL "" FORCE)
set(RAPIDJSON_ENABLE_INSTRUMENTATION_OPT OFF CACHE BOOL "" FORCE)
# subdirectory
add_subdirectory(lib/World EXCLUDE_FROM_ALL)
add_subdirectory(lib/dialog EXCLUDE_FROM_ALL)
add_subdirectory(lib/inicpp EXCLUDE_FROM_ALL)
add_subdirectory(lib/ftxui EXCLUDE_FROM_ALL)
add_subdirectory(lib/rapidjson EXCLUDE_FROM_ALL)
add_subdirectory(lib/sndfile EXCLUDE_FROM_ALL)
# include header files
include_directories(
src
lib/dialog
lib/ColorCout/includes
lib/World/src
lib/World/tools
lib/ftxui/include
lib/inicpp/include
lib/rapidjson/include
lib/sndfile/include
${PROJECT_BINARY_DIR}
${PROJECT_BINARY_DIR}/lib/sndfile/include
)
add_subdirectory(src)
add_subdirectory(test)
add_subdirectory(tools)