Skip to content

Commit

Permalink
build: compile against N-API instead of Node.js/Electron
Browse files Browse the repository at this point in the history
  • Loading branch information
almoghamdani committed Apr 27, 2024
1 parent 29e31fa commit 784f64f
Show file tree
Hide file tree
Showing 4 changed files with 5,345 additions and 4,765 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,8 @@ jobs:
name: audify-${{ github.sha }}-release-${{ matrix.os }}-${{ matrix.arch }}
path: build/Release/

- name: Build + Deploy Audify Prebuilt Binaries (Node.js)
- name: Build + Deploy Audify Prebuilt Binaries
if: ${{ inputs.deploy }}
run: npm run build-binaries-node -- -- --arch ${{ matrix.arch }} -- --cc "${{ env.CC }}" --cxx "${{ env.CXX }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build + Deploy Audify Prebuilt Binaries (Electron)
if: ${{ inputs.deploy }}
run: npm run build-binaries-electron -- -- --arch ${{ matrix.arch }} -- --cc "${{ env.CC }}" --cxx "${{ env.CXX }}"
run: npm run build-binaries -- -- --arch ${{ matrix.arch }} -- --cc "${{ env.CC }}" --cxx "${{ env.CXX }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment ver

project(audify)

IF(DEFINED napi_build_version)
add_definitions(-DNAPI_VERSION=${napi_build_version})
ENDIF()

IF (WIN32)
# Change runtime library to MD
set(CMAKE_CXX_FLAGS_RELEASE "/MD")
Expand Down Expand Up @@ -82,4 +86,9 @@ string(REPLACE "\"" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
target_include_directories(${PROJECT_NAME} PRIVATE ${NODE_ADDON_API_DIR})

# Compile the library
target_link_libraries(${PROJECT_NAME} ${OPENSSL_LIBS} ${CMAKE_JS_LIB} opus rtaudio)
target_link_libraries(${PROJECT_NAME} ${OPENSSL_LIBS} ${CMAKE_JS_LIB} opus rtaudio)

IF (MSVC AND CMAKE_JS_NODELIB_DEF AND CMAKE_JS_NODELIB_TARGET)
# Generate node.lib
execute_process(COMMAND ${CMAKE_AR} /def:${CMAKE_JS_NODELIB_DEF} /out:${CMAKE_JS_NODELIB_TARGET} ${CMAKE_STATIC_LINKER_FLAGS})
ENDIF ()
Loading

0 comments on commit 784f64f

Please sign in to comment.