-
Notifications
You must be signed in to change notification settings - Fork 12
/
SuperColliderServerPlugin.cmake
83 lines (67 loc) · 2.92 KB
/
SuperColliderServerPlugin.cmake
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
# Brian Heim
# 2018-08-26
# Functions for configuring SuperCollider server plugins
include(SuperColliderCompilerConfig)
function(sc_check_sc_path path)
if(NOT path)
set(sc_path_default "../supercollider")
message(WARNING "No SC_PATH specified, defaulting to '${sc_path_default}'.")
set(path "${sc_path_default}")
endif()
get_filename_component(full_path "${path}" ABSOLUTE BASE_DIR "${CMAKE_SOURCE_DIR}")
# check main paths
if(NOT EXISTS "${full_path}/include/plugin_interface/SC_PlugIn.h")
set(msg_end "\nPlease set SC_PATH to the root folder of the SuperCollider project relative to the folder containing this CMakeLists.txt file")
message(FATAL_ERROR "Could not find SuperCollider3 headers at '${full_path}'.${msg_end}")
endif()
# check supernova paths
if (SUPERNOVA)
if (NOT EXISTS ${full_path}/external_libraries/nova-tt/CMakeLists.txt)
message(FATAL_ERROR "The nova-tt submodule in the SuperCollider repository is missing (required for SuperNova plugins). This probably means you forgot to clone submodules. To fix this, run `git submodule update --init` from the root folder of the SuperCollider repository")
endif()
endif()
set(SC_PATH ${full_path} PARENT_SCOPE)
endfunction()
function(sc_add_server_plugin_properties target is_supernova)
set_target_properties(${target} PROPERTIES
CXX_VISIBILITY_PRESET hidden
PREFIX ""
)
if(APPLE OR WIN32)
set_target_properties(${target} PROPERTIES SUFFIX ".scx")
endif()
target_include_directories(${target} PUBLIC
${SC_PATH}/include/plugin_interface
${SC_PATH}/include/common
${SC_PATH}/common
)
# from CompilerConfig module
sc_config_compiler_flags(${target})
target_compile_definitions(${target} PRIVATE $<$<BOOL:${is_supernova}>:SUPERNOVA>)
list(APPEND all_sc_server_plugins ${target})
set(all_sc_server_plugins ${all_sc_server_plugins} PARENT_SCOPE)
endfunction()
function(sc_add_server_plugin dest_dir name cpp sc schelp)
if(SCSYNTH)
set(sy_name "${name}_scsynth")
add_library(${sy_name} MODULE "${cpp}")
install(TARGETS ${sy_name} LIBRARY DESTINATION ${dest_dir})
sc_add_server_plugin_properties(${sy_name} FALSE)
message(STATUS "Added server plugin target ${sy_name}")
endif()
if(SUPERNOVA)
set(sn_name "${name}_supernova")
add_library(${sn_name} MODULE "${cpp}")
# install scsynth/supernova targets to same dir
install(TARGETS ${sn_name} LIBRARY DESTINATION ${dest_dir})
sc_add_server_plugin_properties(${sn_name} TRUE)
message(STATUS "Added server plugin target ${sn_name}")
endif()
if(sc)
install(FILES ${sc} DESTINATION ${dest_dir}/Classes)
endif()
if(schelp)
install(FILES ${schelp} DESTINATION ${dest_dir}/HelpSource/Classes)
endif()
endfunction()
set(all_sc_server_plugins)