forked from codebytere/node-mac-permissions
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCMakeLists.txt
56 lines (43 loc) · 1.7 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
cmake_minimum_required(VERSION 3.20)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED on)
project(permissions)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if (UNIX AND APPLE)
# Source
set(SOURCE_FILES src/permissions.mm)
# Add target
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${CMAKE_JS_SRC})
set(LIBS)
# External libs
if (UNIX AND APPLE)
set(LIBS ${LIBS} "-framework AppKit")
set(LIBS ${LIBS} "-framework AVFoundation")
set(LIBS ${LIBS} "-framework CoreBluetooth")
set(LIBS ${LIBS} "-framework CoreFoundation")
set(LIBS ${LIBS} "-framework CoreLocation")
set(LIBS ${LIBS} "-framework CoreGraphics")
set(LIBS ${LIBS} "-framework Contacts")
set(LIBS ${LIBS} "-framework EventKit")
set(LIBS ${LIBS} "-framework IOKit")
set(LIBS ${LIBS} "-framework Photos")
set(LIBS ${LIBS} "-framework Speech")
set(LIBS ${LIBS} "-framework Storekit")
endif ()
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13)
add_definitions(-DNAPI_DISABLE_CPP_EXCEPTIONS)
add_definitions(-DNAPI_VERSION=4)
# cmake-js
include_directories(${CMAKE_JS_INC})
# node-addon-api
execute_process(COMMAND node -p "require('node-addon-api').include"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE NODE_ADDON_API_DIR
)
string(REGEX REPLACE "[\r\n\"]" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
target_include_directories(${PROJECT_NAME} PRIVATE ${NODE_ADDON_API_DIR})
# Change suffix to *.node
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node")
# BUILD
target_link_libraries(${PROJECT_NAME} ${LIBS} ${CMAKE_JS_LIB})
endif ()