-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
31 lines (20 loc) · 1.04 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
cmake_minimum_required(VERSION 3.19)
cmake_policy(SET CMP0042 NEW)
set (CMAKE_CXX_STANDARD 11)
project(ffprobe VERSION 1.0.0)
include_directories(${CMAKE_JS_INC})
find_package(PkgConfig REQUIRED)
pkg_check_modules(FFMPEG REQUIRED libavcodec libavutil libavformat)
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})
file(GLOB SOURCE_FILES "src/*.cc")
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${CMAKE_JS_SRC})
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node")
target_link_libraries(${PROJECT_NAME} PRIVATE ${CMAKE_JS_LIB} ${FFMPEG_LIBRARIES})
target_link_directories(${PROJECT_NAME} BEFORE PUBLIC ${FFMPEG_LIBRARY_DIRS})
target_include_directories(${PROJECT_NAME} PUBLIC ${FFMPEG_INCLUDE_DIRS} PRIVATE ${NODE_ADDON_API_DIR})
target_compile_options(${PROJECT_NAME} PUBLIC ${FFMPEG_CFLAGS})
add_definitions(-DNAPI_VERSION=3)