CMake/ninja错误:'**/System/Library/Frameworks/CoreAudio.framework/CoreAudio','Release/addon. node'需要,缺少且没有已知的规则来创建它

vyswwuz2  于 12个月前  发布在  其他
关注(0)|答案(1)|浏览(143)

说明:

我正在使用CMake开发一个C++项目,以构建一个依赖于多个依赖项的Node.js插件,包括CoreAudio框架。当我尝试使用CMake和ninja构建项目时,我在macOS上遇到了一个问题。错误消息如下:

ninja: error: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreAudio.framework/CoreAudio', needed by 'Release/addon.node', missing and no known rule to make it.

字符串
我已经验证了CoreAudio框架存在于我的系统上,并且我已经在CMakeLists.txt文件中设置了正确的路径。但是,构建系统似乎无法在构建过程中定位框架。

cmake_minimum_required(VERSION 3.15)
project (addon)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "-D__STDC_CONSTANT_MACROS")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")

set(mediasuite_home .)
get_filename_component(MEDIASUITE_ABSOLUTE_PATH ${mediasuite_home} ABSOLUTE)

if(APPLE)
    set(ENV{PKG_CONFIG_PATH} "${MEDIASUITE_ABSOLUTE_PATH}/deps/ffmpeg/macosx/lib/pkgconfig")
elseif(UNIX)
    set(ENV{PKG_CONFIG_PATH} "${MEDIASUITE_ABSOLUTE_PATH}/deps/ffmpeg/linux/lib/pkgconfig")
elseif(WIN32)
    set(ENV{PKG_CONFIG_PATH} "${MEDIASUITE_ABSOLUTE_PATH}/deps/ffmpeg/windows/lib/pkgconfig")
else()
    message(FATAL_ERROR "Unsupported operating system")
endif()

find_package(PkgConfig REQUIRED)
pkg_check_modules(AVCODEC    REQUIRED IMPORTED_TARGET libavcodec)
pkg_check_modules(AVFORMAT   REQUIRED IMPORTED_TARGET libavformat)
pkg_check_modules(AVUTIL     REQUIRED IMPORTED_TARGET libavutil)
pkg_check_modules(AVFILTER   REQUIRED IMPORTED_TARGET libavfilter)
pkg_check_modules(AVDEVICE   REQUIRED IMPORTED_TARGET libavdevice)
pkg_check_modules(SWRESAMPLE REQUIRED IMPORTED_TARGET libswresample)
pkg_check_modules(SWSCALE    REQUIRED IMPORTED_TARGET libswscale)

include_directories(${CMAKE_JS_INC})
file(GLOB SOURCE_FILES "src/*.cpp" "src/*.h")
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${CMAKE_JS_SRC})

if(APPLE)
        find_library(CORE_AUDIO CoreAudio REQUIRED)
        if(NOT CORE_AUDIO)
                message(FATAL_ERROR "CoreAudio framework not found")
        else()
                message(STATUS "CoreAudio framework found: ${CORE_AUDIO}")
        endif()
        find_library(CORE_MEDIA CoreMedia REQUIRED)
        find_library(VIDEO_TOOLBOX VideoToolBox REQUIRED)
        find_library(AUDIO_TOOLBOX AudioToolBox REQUIRED)
        find_library(CORE_FOUNDATION CoreFoundation REQUIRED)
        find_library(SECURITY Security REQUIRED)
        find_library(CORE_SERVICES CoreServices REQUIRED)
        set(
                frameworks
                ${CORE_AUDIO}/CoreAudio
                ${CORE_MEDIA}/CoreMedia
                ${VIDEO_TOOLBOX}/VideoToolbox
                ${AUDIO_TOOLBOX}/AudioToolbox
                ${CORE_FOUNDATION}/CoreFoundation
                ${SECURITY}/Security
                ${CORE_SERVICES}/CoreServices
        )
elseif(UNIX)
        message(STATUS "UNIX OPERATING SYSTEM CONFIG")
elseif(WIN32)
        message(FATAL_ERROR "WINDOWS OPERATING SYSTEM CONFIG")
else()
        message(FATAL_ERROR "Unsupported operating system")
endif()

set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node")
target_link_libraries(
        ${PROJECT_NAME} 
        ${CMAKE_JS_LIB}
        ${AVCODEC_LDFLAGS} 
        ${AVFORMAT_LDFLAGS} 
        ${AVFILTER_LDFLAGS} 
        ${AVDEVICE_LDFLAGS} 
        ${AVUTIL_LDFLAGS}
        ${SWRESAMPLE_LDFLAGS} 
        ${SWSCALE_LDFLAGS}
        ${frameworks}
)
execute_process(COMMAND node -p "require('node-addon-api').include"
        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
        OUTPUT_VARIABLE NODE_ADDON_API_DIR
        )

string(REPLACE "\n" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
string(REPLACE "\"" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})

target_include_directories(
        ${PROJECT_NAME} PRIVATE 
        ${NODE_ADDON_API_DIR}
        ${AVCODEC_INCLUDE_DIRS} 
        ${AVFORMAT_INCLUDE_DIRS} 
        ${AVFILTER_INCLUDE_DIRS} 
        ${AVDEVICE_INCLUDE_DIRS} 
        ${AVUTIL_INCLUDE_DIRS} 
        ${SWRESAMPLE_INCLUDE_DIRS} 
        ${SWSCALE_INCLUDE_DIRS}
)
add_definitions(-DNAPI_VERSION=3)


我也试过"-framework CoreAudio" and ${CORE_AUDIO}
我得到

-- CoreAudio framework found: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/System/Library/Frameworks/CoreAudio.framework
-- Configuring done (0.9s)
-- Generating done (0.1s)
-- Build files have been written to: /Users/vetagirihrushikesh/Desktop/Maigha/CoreProducts/Development/FFMPEG_BUILD/BuildScriptForMacOSX/ElectronReactBoilerPlate/FFMPEGNAPIELECTRON/Nodejs-Napi-Addon-Using-Cmake/build
info CMD BUILD
info RUN cmake --build "/Users/vetagirihrushikesh/Desktop/Maigha/CoreProducts/Development/FFMPEG_BUILD/BuildScriptForMacOSX/ElectronReactBoilerPlate/FFMPEGNAPIELECTRON/Nodejs-Napi-Addon-Using-Cmake/build" --config Release
[2/2] Linking CXX shared library Release/addon.node
FAILED: Release/addon.node
: && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -D__STDC_CONSTANT_MACROS -g -O3 -DNDEBUG -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -o Release/addon.node -install_name @rpath/addon.node CMakeFiles/addon.dir/src/example.cpp.o  -L/Users/vetagirihrushikesh/ffmpeg_build/lib  -L/opt/homebrew/Cellar/libx11/1.8.7/lib  -L/opt/homebrew/Cellar/libxcb/1.16/lib  -L/opt/homebrew/Cellar/libxau/1.0.11/lib  -L/opt/homebrew/Cellar/libxdmcp/1.1.4/lib  -lavcodec  -lvpx  -lm  -lpthread  -lvpx  -lm  -lpthread  -lvpx  -lm  -lpthread  -lvpx  -lm  -lpthread  -liconv  -lm  -ldav1d  -framework  -lAudioToolbox  -lfdk-aac  -lmp3lame  -lm  -lopus  -lSvtAv1Enc  -lpthread  -lm  -lx264  -lpthread  -lm  -ldl  -lx265  -lc++  -ldl  -pthread  -lz  -framework  -lVideoToolbox  -framework  -lCoreFoundation  -framework  -lCoreMedia  -framework  -lCoreVideo  -framework  -lCoreServices  -lswresample  -lm  -lavutil  -pthread  -lm  -framework  -lVideoToolbox  -lX11  -lxcb  -lXau  -lXdmcp  -framework  -lCoreFoundation  -framework  -lCoreMedia  -framework  -lCoreVideo  -framework  -lCoreServices  -L/Users/vetagirihrushikesh/ffmpeg_build/lib  -L/opt/homebrew/Cellar/libx11/1.8.7/lib  -L/opt/homebrew/Cellar/libxcb/1.16/lib  -L/opt/homebrew/Cellar/libxau/1.0.11/lib  -L/opt/homebrew/Cellar/libxdmcp/1.1.4/lib  -lavformat  -lm  -lbz2  -lz  -Wl,-framework,CoreFoundation  -Wl,-framework,Security  -lavcodec  -lvpx  -lm  -lpthread  -lvpx  -lm  -lpthread  -lvpx  -lm  -lpthread  -lvpx  -lm  -lpthread  -liconv  -lm  -ldav1d  -framework  -lAudioToolbox  -lfdk-aac  -lmp3lame  -lm  -lopus  -lSvtAv1Enc  -lpthread  -lm  -lx264  -lpthread  -lm  -ldl  -lx265  -lc++  -ldl  -pthread  -lz  -framework  -lVideoToolbox  -framework  -lCoreFoundation  -framework  -lCoreMedia  -framework  -lCoreVideo  -framework  -lCoreServices  -lswresample  -lm  -lavutil  -pthread  -lm  -framework  -lVideoToolbox  -lX11  -lxcb  -lXau  -lXdmcp  -framework  -lCoreFoundation  -framework  -lCoreMedia  -framework  -lCoreVideo  -framework  -lCoreServices  -L/Users/vetagirihrushikesh/ffmpeg_build/lib  -L/opt/homebrew/Cellar/libass/0.17.1/lib  -L/opt/homebrew/Cellar/libunibreak/5.1/lib  -L/opt/homebrew/Cellar/harfbuzz/8.3.0/lib  -L/opt/homebrew/Cellar/glib/2.78.1/lib  -L/opt/homebrew/opt/gettext/lib  -L/opt/homebrew/Cellar/pcre2/10.42/lib  -L/opt/homebrew/Cellar/graphite2/1.3.14/lib  -L/opt/homebrew/Cellar/fribidi/1.0.13/lib  -L/opt/homebrew/opt/freetype/lib  -L/opt/homebrew/opt/libpng/lib  -L/opt/homebrew/opt/freetype/lib  -L/opt/homebrew/opt/libpng/lib  -L/Users/vetagirihrushikesh/ffmpeg_build/lib  -L/opt/homebrew/Cellar/libx11/1.8.7/lib  -L/opt/homebrew/Cellar/libxcb/1.16/lib  -L/opt/homebrew/Cellar/libxau/1.0.11/lib  -L/opt/homebrew/Cellar/libxdmcp/1.1.4/lib  -lavfilter  -framework  -lOpenGL  -pthread  -lm  -lass  -liconv  -framework  -lApplicationServices  -framework  -lCoreFoundation  -lunibreak  -lharfbuzz  -lm  -framework  -lApplicationServices  -lglib-2.0  -lintl  -liconv  -lm  -framework  -lFoundation  -framework  -lCoreFoundation  -framework  -lAppKit  -framework  -lCarbon  -lpcre2-8  -D_THREAD_SAFE  -pthread  -lgraphite2  -lfribidi  -lfreetype  -lbz2  -lpng16  -lz  -framework  -lMetal  -framework  -lVideoToolbox  -framework  -lCoreImage  -framework  -lAppKit  -lfreetype  -lbz2  -lpng16  -lz  -framework  -lCoreFoundation  -framework  -lCoreMedia  -framework  -lCoreVideo  -framework  -lCoreServices  -lswscale  -lm  -lpostproc  -lm  -lavformat  -lm  -lbz2  -lz  -Wl,-framework,CoreFoundation  -Wl,-framework,Security  -lavcodec  -lvpx  -lm  -lpthread  -lvpx  -lm  -lpthread  -lvpx  -lm  -lpthread  -lvpx  -lm  -lpthread  -liconv  -lm  -ldav1d  -framework  -lAudioToolbox  -lfdk-aac  -lmp3lame  -lm  -lopus  -lSvtAv1Enc  -lpthread  -lm  -lx264  -lpthread  -lm  -ldl  -lx265  -lc++  -ldl  -pthread  -lz  -framework  -lVideoToolbox  -framework  -lCoreFoundation  -framework  -lCoreMedia  -framework  -lCoreVideo  -framework  -lCoreServices  -lswresample  -lm  -lavutil  -pthread  -lm  -framework  -lVideoToolbox  -lX11  -lxcb  -lXau  -lXdmcp  -framework  -lCoreFoundation  -framework  -lCoreMedia  -framework  -lCoreVideo  -framework  -lCoreServices  -L/Users/vetagirihrushikesh/ffmpeg_build/lib  -L/opt/homebrew/Cellar/libxcb/1.16/lib  -L/opt/homebrew/Cellar/libxau/1.0.11/lib  -L/opt/homebrew/Cellar/libxdmcp/1.1.4/lib  -L/opt/homebrew/Cellar/libxcb/1.16/lib  -L/opt/homebrew/Cellar/libxau/1.0.11/lib  -L/opt/homebrew/Cellar/libxdmcp/1.1.4/lib  -L/opt/homebrew/Cellar/libxcb/1.16/lib  -L/opt/homebrew/Cellar/libxau/1.0.11/lib  -L/opt/homebrew/Cellar/libxdmcp/1.1.4/lib  -L/opt/homebrew/Cellar/libxcb/1.16/lib  -L/opt/homebrew/Cellar/libxau/1.0.11/lib  -L/opt/homebrew/Cellar/libxdmcp/1.1.4/lib  -L/opt/homebrew/lib  -L/Users/vetagirihrushikesh/ffmpeg_build/lib  -L/opt/homebrew/Cellar/libass/0.17.1/lib  -L/opt/homebrew/Cellar/libunibreak/5.1/lib  -L/opt/homebrew/Cellar/harfbuzz/8.3.0/lib  -L/opt/homebrew/Cellar/glib/2.78.1/lib  -L/opt/homebrew/opt/gettext/lib  -L/opt/homebrew/Cellar/pcre2/10.42/lib  -L/opt/homebrew/Cellar/graphite2/1.3.14/lib  -L/opt/homebrew/Cellar/fribidi/1.0.13/lib  -L/opt/homebrew/opt/freetype/lib  -L/opt/homebrew/opt/libpng/lib  -L/opt/homebrew/opt/freetype/lib  -L/opt/homebrew/opt/libpng/lib  -L/Users/vetagirihrushikesh/ffmpeg_build/lib  -L/opt/homebrew/Cellar/libx11/1.8.7/lib  -L/opt/homebrew/Cellar/libxcb/1.16/lib  -L/opt/homebrew/Cellar/libxau/1.0.11/lib  -L/opt/homebrew/Cellar/libxdmcp/1.1.4/lib  -lavdevice  -framework  -lFoundation  -framework  -lAudioToolbox  -framework  -lCoreAudio  -lm  -framework  -lAVFoundation  -framework  -lCoreVideo  -framework  -lCoreMedia  -framework  -lCoreGraphics  -lxcb  -lXau  -lXdmcp  -lxcb-shm  -lxcb  -lXau  -lXdmcp  -lxcb-shape  -lxcb  -lXau  -lXdmcp  -lxcb-xfixes  -lxcb-render  -lxcb-shape  -lxcb  -lXau  -lXdmcp  -framework  -lAudioToolbox  -pthread  -lSDL2  -lm  -liconv  -Wl,-framework,CoreAudio  -Wl,-framework,AudioToolbox  -Wl,-weak_framework,CoreHaptics  -Wl,-weak_framework,GameController  -Wl,-framework,ForceFeedback  -lobjc  -Wl,-framework,CoreVideo  -Wl,-framework,Cocoa  -Wl,-framework,Carbon  -Wl,-framework,IOKit  -Wl,-weak_framework,QuartzCore  -Wl,-weak_framework,Metal  -lavfilter  -framework  -lOpenGL  -pthread  -lm  -lass  -liconv  -framework  -lApplicationServices  -framework  -lCoreFoundation  -lunibreak  -lharfbuzz  -lm  -framework  -lApplicationServices  -lglib-2.0  -lintl  -liconv  -lm  -framework  -lFoundation  -framework  -lCoreFoundation  -framework  -lAppKit  -framework  -lCarbon  -lpcre2-8  -D_THREAD_SAFE  -pthread  -lgraphite2  -lfribidi  -lfreetype  -lbz2  -lpng16  -lz  -framework  -lMetal  -framework  -lVideoToolbox  -framework  -lCoreImage  -framework  -lAppKit  -lfreetype  -lbz2  -lpng16  -lz  -framework  -lCoreFoundation  -framework  -lCoreMedia  -framework  -lCoreVideo  -framework  -lCoreServices  -lswscale  -lm  -lpostproc  -lm  -lavformat  -lm  -lbz2  -lz  -Wl,-framework,CoreFoundation  -Wl,-framework,Security  -lavcodec  -lvpx  -lm  -lpthread  -lvpx  -lm  -lpthread  -lvpx  -lm  -lpthread  -lvpx  -lm  -lpthread  -liconv  -lm  -ldav1d  -framework  -lAudioToolbox  -lfdk-aac  -lmp3lame  -lm  -lopus  -lSvtAv1Enc  -lpthread  -lm  -lx264  -lpthread  -lm  -ldl  -lx265  -lc++  -ldl  -pthread  -lz  -framework  -lVideoToolbox  -framework  -lCoreFoundation  -framework  -lCoreMedia  -framework  -lCoreVideo  -framework  -lCoreServices  -lswresample  -lm  -lavutil  -pthread  -lm  -framework  -lVideoToolbox  -lX11  -lxcb  -lXau  -lXdmcp  -framework  -lCoreFoundation  -framework  -lCoreMedia  -framework  -lCoreVideo  -framework  -lCoreServices  -L/Users/vetagirihrushikesh/ffmpeg_build/lib  -L/opt/homebrew/Cellar/libx11/1.8.7/lib  -L/opt/homebrew/Cellar/libxcb/1.16/lib  -L/opt/homebrew/Cellar/libxau/1.0.11/lib  -L/opt/homebrew/Cellar/libxdmcp/1.1.4/lib  -lavutil  -pthread  -lm  -framework  -lVideoToolbox  -lX11  -lxcb  -lXau  -lXdmcp  -framework  -lCoreFoundation  -framework  -lCoreMedia  -framework  -lCoreVideo  -framework  -lCoreServices  -L/Users/vetagirihrushikesh/ffmpeg_build/lib  -L/opt/homebrew/Cellar/libx11/1.8.7/lib  -L/opt/homebrew/Cellar/libxcb/1.16/lib  -L/opt/homebrew/Cellar/libxau/1.0.11/lib  -L/opt/homebrew/Cellar/libxdmcp/1.1.4/lib  -lswresample  -lm  -lavutil  -pthread  -lm  -framework  -lVideoToolbox  -lX11  -lxcb  -lXau  -lXdmcp  -framework  -lCoreFoundation  -framework  -lCoreMedia  -framework  -lCoreVideo  -framework  -lCoreServices  -L/Users/vetagirihrushikesh/ffmpeg_build/lib  -L/opt/homebrew/Cellar/libx11/1.8.7/lib  -L/opt/homebrew/Cellar/libxcb/1.16/lib  -L/opt/homebrew/Cellar/libxau/1.0.11/lib  -L/opt/homebrew/Cellar/libxdmcp/1.1.4/lib  -lswscale  -lm  -lavutil  -pthread  -lm  -framework  -lVideoToolbox  -lX11  -lxcb  -lXau  -lXdmcp  -framework  -lCoreFoundation  -framework  -lCoreMedia  -framework  -lCoreVideo  -framework  -lCoreServices  -Xlinker -framework -Xlinker CoreAudio  -Xlinker -framework -Xlinker CoreMedia  -Xlinker -framework -Xlinker VideoToolBox  -Xlinker -framework -Xlinker AudioToolBox  -Xlinker -framework -Xlinker CoreFoundation  -Xlinker -framework -Xlinker Security  -Xlinker -framework -Xlinker CoreServices  -lavdevice  -lCoreAudio  -lAVFoundation  -lCoreGraphics  -lxcb-shm  -lxcb-shape  -lxcb-xfixes  -lxcb-render  -lSDL2  -lobjc  -Xlinker -framework -Xlinker CoreAudio  -Xlinker -framework -Xlinker CoreMedia  -Xlinker -framework -Xlinker VideoToolBox  -Xlinker -framework -Xlinker AudioToolBox  -Xlinker -framework -Xlinker CoreFoundation  -Xlinker -framework -Xlinker Security  -Xlinker -framework -Xlinker CoreServices && :
ld: warning: ignoring duplicate libraries: '-lSDL2', '-lSvtAv1Enc', '-lX11', '-lXau', '-lXdmcp', '-lass', '-lavcodec', '-lavdevice', '-lavfilter', '-lavformat', '-lavutil', '-lbz2', '-lc++', '-ldav1d', '-ldl', '-lfdk-aac', '-lfreetype', '-lfribidi', '-lglib-2.0', '-lgraphite2', '-lharfbuzz', '-liconv', '-lintl', '-lm', '-lmp3lame', '-lobjc', '-lopus', '-lpcre2-8', '-lpng16', '-lpostproc', '-lpthread', '-lswresample', '-lswscale', '-lunibreak', '-lvpx', '-lx264', '-lx265', '-lxcb', '-lxcb-render', '-lxcb-shape', '-lxcb-shm', '-lxcb-xfixes', '-lz'
ld: library 'CoreAudio' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

wz8daaqr

wz8daaqr1#

这个CMAKE帮了我。

cmake_minimum_required(VERSION 3.15)
project (multimagix)
set(PLATFORM "macosx")  # "macosx" "windows" "linux"
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(PLATFORM STREQUAL "linux")
        set(CMAKE_CXX_FLAGS "-fPIC -D__STDC_CONSTANT_MACROS -g -O3 -DNDEBUG")
endif()
set(mediasuite_home ${CMAKE_SOURCE_DIR})
get_filename_component(MEDIASUITE_ABSOLUTE_PATH ${mediasuite_home} ABSOLUTE)
get_filename_component(MULTIMAGIX_PATH ${mediasuite_home} ABSOLUTE)

include_directories(
    ${CMAKE_JS_INC}
        if(PLATFORM STREQUAL "macosx")
                ${MULTIMAGIX_PATH}/deps/FFMPEG/macosx/include
        elseif(PLATFORM STREQUAL "linux")
                ${MULTIMAGIX_PATH}/deps/FFMPEG/Ubuntu/include
        endif()
)

file(GLOB SOURCE_FILES "src/*.cpp" "src/Conversion/*.cpp" "src/Resize/*.cpp" "src/Trim/*.cpp" "src/*.h" "src/Conversion/*.h" "src/Resize/*.h" "src/Trim/*.h")

add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${CMAKE_JS_SRC})

set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node")

if(PLATFORM STREQUAL "macosx")
        find_library(CORE_AUDIO CoreAudio REQUIRED)
        find_library(CORE_MEDIA CoreMedia REQUIRED)
        find_library(VIDEO_TOOLBOX VideoToolBox REQUIRED)
        find_library(AUDIO_TOOLBOX AudioToolBox REQUIRED)
        find_library(CORE_FOUNDATION CoreFoundation REQUIRED)
        find_library(SECURITY Security REQUIRED)
        find_library(CORE_SERVICES CoreServices REQUIRED)
        target_link_libraries(
                ${PROJECT_NAME} PRIVATE
                ${CMAKE_JS_LIB}
                ${MULTIMAGIX_PATH}/deps/FFMPEG/macosx/lib/libavcodec.a
                ${MULTIMAGIX_PATH}/deps/FFMPEG/macosx/lib/libavdevice.a
                ${MULTIMAGIX_PATH}/deps/FFMPEG/macosx/lib/libavfilter.a
                ${MULTIMAGIX_PATH}/deps/FFMPEG/macosx/lib/libavformat.a
                ${MULTIMAGIX_PATH}/deps/FFMPEG/macosx/lib/libavutil.a
                ${MULTIMAGIX_PATH}/deps/FFMPEG/macosx/lib/libdav1d.a
                ${MULTIMAGIX_PATH}/deps/FFMPEG/macosx/lib/libfdk-aac.a
                ${MULTIMAGIX_PATH}/deps/FFMPEG/macosx/lib/libmp3lame.a
                ${MULTIMAGIX_PATH}/deps/FFMPEG/macosx/lib/libopus.a
                ${MULTIMAGIX_PATH}/deps/FFMPEG/macosx/lib/libpostproc.a
                ${MULTIMAGIX_PATH}/deps/FFMPEG/macosx/lib/libSvtAv1Enc.a
                ${MULTIMAGIX_PATH}/deps/FFMPEG/macosx/lib/libswresample.a
                ${MULTIMAGIX_PATH}/deps/FFMPEG/macosx/lib/libswscale.a
                ${MULTIMAGIX_PATH}/deps/FFMPEG/macosx/lib/libvmaf.a
                ${MULTIMAGIX_PATH}/deps/FFMPEG/macosx/lib/libvpx.a
                ${MULTIMAGIX_PATH}/deps/FFMPEG/macosx/lib/libx264.a
                ${MULTIMAGIX_PATH}/deps/FFMPEG/macosx/lib/libx265.a
                ${CORE_AUDIO}
                ${CORE_MEDIA}
                ${VIDEO_TOOLBOX}
                ${AUDIO_TOOLBOX}
                ${CORE_FOUNDATION}
                ${SECURITY}
                ${CORE_SERVICES}
        )
elseif(PLATFORM STREQUAL "linux")
        target_link_libraries(${PROJECT_NAME} PRIVATE
                ${CMAKE_JS_LIB}
                ${MULTIMAGIX_PATH}/deps/FFMPEG/Ubuntu/lib/libavcodec.so
                ${MULTIMAGIX_PATH}/deps/FFMPEG/Ubuntu/lib/libavdevice.so
                ${MULTIMAGIX_PATH}/deps/FFMPEG/Ubuntu/lib/libavfilter.so
                ${MULTIMAGIX_PATH}/deps/FFMPEG/Ubuntu/lib/libavformat.so
                ${MULTIMAGIX_PATH}/deps/FFMPEG/Ubuntu/lib/libavutil.so
                ${MULTIMAGIX_PATH}/deps/FFMPEG/Ubuntu/lib/libpostproc.so
                ${MULTIMAGIX_PATH}/deps/FFMPEG/Ubuntu/lib/libSvtAv1Enc.a
                ${MULTIMAGIX_PATH}/deps/FFMPEG/Ubuntu/lib/libswresample.so
                ${MULTIMAGIX_PATH}/deps/FFMPEG/Ubuntu/lib/libswscale.so
                ${MULTIMAGIX_PATH}/deps/FFMPEG/Ubuntu/lib/libvmaf.a
        )
endif()

execute_process(COMMAND node -p "require('node-addon-api').include"
        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
        OUTPUT_VARIABLE NODE_ADDON_API_DIR
        )

string(REPLACE "\n" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
string(REPLACE "\"" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})

target_include_directories(
        ${PROJECT_NAME} PRIVATE 
        ${NODE_ADDON_API_DIR}
)
add_definitions(-DNAPI_VERSION=3)

字符串

相关问题