-
Notifications
You must be signed in to change notification settings - Fork 100
/
CMakeLists.txt
120 lines (98 loc) · 3.11 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
cmake_minimum_required(VERSION 3.13.0 FATAL_ERROR)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
IF(CLANG_ANALYZE_CONFIG)
set(CMAKE_C_COMPILER_WORKS 1)
set(CMAKE_CXX_COMPILER_WORKS 1)
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xclang -fexceptions -Xclang -fcxx-exceptions")
ENDIF()
set(VERSION_FULL 0.3.21)
set(VERSION_BUILD 0)
project(obs-studio-node VERSION ${VERSION_FULL}.${VERSION_BUILD})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
# CppCheck
IF( NOT CLANG_ANALYZE_CONFIG)
include(cppcheck)
cppcheck(EXCLUDE "${PROJECT_SOURCE_DIR}/node_modules")
ENDIF()
# Comfigure macos architecture and min version
iF(APPLE)
set(CMAKE_XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET[arch=arm64] "11.0")
set(CMAKE_XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET[arch=x86_64] "10.15")
if (NOT CMAKE_OSX_ARCHITECTURES)
set(CMAKE_OSX_ARCHITECTURES "${CMAKE_HOST_SYSTEM_PROCESSOR}")
endif()
if ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
set(CMAKE_OSX_DEPOLYMENT_TARGET "11.0")
else()
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15")
endif()
# See CMake issue # 21854
# https://gitlab.kitware.com/cmake/cmake/-/issues/21854
# This is necessary because CMAKE_INSTALL_NAME_TOOL is used for obs64 (i.e. obs-studio-server).
set(CMAKE_XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS "-o linker-signed")
ENDIF()
if(WIN32)
# Resource VersionInfo
set(PROJECT_PRODUCT_NAME "OBS Studio for Node.JS")
set(PROJECT_COMPANY_NAME "Streamlabs")
set(PROJECT_COPYRIGHT "Streamlabs © 2017 - 2018")
set(PROJECT_LEGAL_TRADEMARKS_1 "")
set(PROJECT_LEGAL_TRADEMARKS_2 "")
configure_file(
${PROJECT_SOURCE_DIR}/cmake/version.rc.in
${PROJECT_BINARY_DIR}/version.rc
@ONLY
)
# ToDo: Figure out a better way to tell the test setup where to find our binaries.
configure_file(
${PROJECT_SOURCE_DIR}/cmake/obs.js.in
${PROJECT_SOURCE_DIR}/tests/helpers/obs.js
@ONLY
)
endif()
configure_file(
${PROJECT_SOURCE_DIR}/cmake/index.ts.in
${PROJECT_SOURCE_DIR}/tests/osn-tests/osn/index.ts
@ONLY
)
############################
# Setup global dependencies
############################
include(ExternalProject)
include(DownloadProject)
include(FetchContent)
if(MSVC)
add_definitions(/MP)
add_link_options(/debug:fastlink)
endif()
if (WIN32)
# Override a test flag
set(StackWalker_DISABLE_TESTS true CACHE BOOL "" FORCE)
# StackWalker (Callstack rewind
FetchContent_Declare(
stackwalker
GIT_REPOSITORY https://github.com/stream-labs/StackWalker
)
FetchContent_GetProperties(stackwalker)
if(NOT stackwalker_POPULATED)
FetchContent_Populate(stackwalker)
add_subdirectory(${stackwalker_SOURCE_DIR} ${stackwalker_BINARY_DIR})
endif()
endif()
# Nlohmann JSON (modern JSON for C++)
FetchContent_Declare(
nlohmannjson
GIT_REPOSITORY https://github.com/nlohmann/json
GIT_TAG aa0e847e5b57a00696bdcb6a834b927231b81613 # v3.10.3
)
FetchContent_GetProperties(nlohmannjson)
if(NOT nlohmannjson_POPULATED)
FetchContent_Populate(nlohmannjson)
endif()
add_subdirectory(lib-streamlabs-ipc)
add_subdirectory(obs-studio-client)
add_subdirectory(obs-studio-server)
include(CPack)