forked from DavidLichtenberger/reaper-csurf-us2400
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
76 lines (61 loc) · 2.68 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
cmake_minimum_required(VERSION 3.19)
project(reaper_csurf_us2400 LANGUAGES CXX)
include(CheckCompilerFlag)
include(CheckIncludeFileCXX)
include(CheckLinkerFlag)
if (MSVC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /experimental:external /external:W0 ")
set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "/external:I ")
endif()
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
if(WIN32)
set(USER_CONFIG_DIR "$ENV{APPDATA}")
elseif(APPLE)
set(USER_CONFIG_DIR "~/Library/Application Support")
else()
set(USER_CONFIG_DIR "~/.config")
endif()
set(CMAKE_INSTALL_PREFIX "${USER_CONFIG_DIR}/REAPER" CACHE PATH
"REAPER resource path where to install ReaFab" FORCE)
endif()
if(CMAKE_OSX_ARCHITECTURES)
list(JOIN CMAKE_OSX_ARCHITECTURES "-" ARCH_NAME)
elseif(MSVC_CXX_ARCHITECTURE_ID)
set(ARCH_NAME ${MSVC_CXX_ARCHITECTURE_ID})
else()
set(ARCH_NAME ${CMAKE_SYSTEM_PROCESSOR})
endif()
STRING(TOLOWER "${ARCH_NAME}" ARCH_NAME)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL ON)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ON)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO ON)
add_library(${PROJECT_NAME} SHARED)
set_target_properties(${PROJECT_NAME} PROPERTIES
PREFIX "" # disable the "lib" prefix
OUTPUT_NAME "reaper_csurf_us2400-${ARCH_NAME}"
)
set(REAPER_USER_PLUGINS "UserPlugins")
install(TARGETS ${PROJECT_NAME}
CONFIGURATIONS Debug Release
RUNTIME DESTINATION "${REAPER_USER_PLUGINS}" # Windows .dll
LIBRARY DESTINATION "${REAPER_USER_PLUGINS}" # Linux .so/macOS .dylib
)
if (MSVC AND CMAKE_BUILD_TYPE MATCHES RELEASE)
set_target_properties( ${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} )
set_target_properties( ${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR} )
set_target_properties( ${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR} )
set_target_properties( ${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_CURRENT_BINARY_DIR} )
set_target_properties( ${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_CURRENT_BINARY_DIR} )
# etc for the other available configuration types (MinSizeRel, RelWithDebInfo)
endif ()
add_subdirectory(${CMAKE_SOURCE_DIR}/source)