Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,6 @@ jobs:
with:
packages: tools platform-tools ndk;${{ env.NDK_VERSION }}
- run: rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi i686-linux-android aarch64-apple-ios-sim
# macOS runners ship a newer CMake than the project supports; pin it to match the version used elsewhere in CI
- name: Install compatible CMake version
if: runner.os == 'macOS'
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: ${{ env.CMAKE_VERSION }}
- run: npm ci
- run: npm run bootstrap
- run: npm test
Expand Down Expand Up @@ -125,12 +119,6 @@ jobs:
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}-${{ runner.os }}
# macOS runners ship a newer CMake than the project supports; pin it to match the version used elsewhere in CI
- name: Install compatible CMake version
if: runner.os == 'macOS'
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: ${{ env.CMAKE_VERSION }}
- run: npm ci
- run: npm run build
- name: Prepare weak-node-api
Expand Down Expand Up @@ -168,11 +156,6 @@ jobs:
with:
packages: tools platform-tools ndk;${{ env.NDK_VERSION }}
- run: rustup target add x86_64-linux-android aarch64-linux-android armv7-linux-androideabi i686-linux-android aarch64-apple-ios-sim
# macOS runners ship a newer CMake than the project supports; pin it to match the version used elsewhere in CI
- name: Install compatible CMake version
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: ${{ env.CMAKE_VERSION }}
- run: npm ci
- run: npm run bootstrap
env:
Expand Down Expand Up @@ -209,10 +192,6 @@ jobs:
with:
java-version: "17"
distribution: "temurin"
- name: Install compatible CMake version
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: ${{ env.CMAKE_VERSION }}
- run: rustup target add x86_64-apple-darwin
- run: npm ci
- run: npm run bootstrap
Expand Down Expand Up @@ -345,11 +324,6 @@ jobs:
distribution: "temurin"
- run: rustup target add x86_64-apple-darwin x86_64-apple-ios aarch64-apple-ios aarch64-apple-ios-sim
- run: rustup toolchain install nightly --component rust-src
# macOS runners ship a newer CMake than the project supports; pin it to match the version used elsewhere in CI
- name: Install compatible CMake version
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: ${{ env.CMAKE_VERSION }}
- run: npm ci
- run: npm run build
- name: Build weak-node-api for all Apple architectures
Expand Down
33 changes: 24 additions & 9 deletions packages/weak-node-api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,32 @@ add_library(${PROJECT_NAME} SHARED)
set(INCLUDE_DIR "include")
set(GENERATED_SOURCE_DIR "generated")

set(PUBLIC_HEADER_FILES
${GENERATED_SOURCE_DIR}/weak_node_api.hpp
${GENERATED_SOURCE_DIR}/NodeApiHost.hpp
${INCLUDE_DIR}/js_native_api_types.h
${INCLUDE_DIR}/js_native_api.h
${INCLUDE_DIR}/node_api_types.h
${INCLUDE_DIR}/node_api.h
)

target_sources(${PROJECT_NAME}
PUBLIC
${GENERATED_SOURCE_DIR}/weak_node_api.cpp
PUBLIC FILE_SET HEADERS
BASE_DIRS ${GENERATED_SOURCE_DIR} ${INCLUDE_DIR} FILES
${GENERATED_SOURCE_DIR}/weak_node_api.hpp
${GENERATED_SOURCE_DIR}/NodeApiHost.hpp
${INCLUDE_DIR}/js_native_api_types.h
${INCLUDE_DIR}/js_native_api.h
${INCLUDE_DIR}/node_api_types.h
${INCLUDE_DIR}/node_api.h
)

get_target_property(PUBLIC_HEADER_FILES ${PROJECT_NAME} HEADER_SET)
# Expose the public headers to consumers within the build tree (e.g. the tests)
# regardless of how they are packaged below.
target_include_directories(${PROJECT_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/${GENERATED_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/${INCLUDE_DIR}>
)

# Stripping the prefix from the library name
# to make sure the name of the XCFramework will match the name of the library
if(APPLE)
# Frameworks ship their public headers via the PUBLIC_HEADER property.
set_target_properties(${PROJECT_NAME} PROPERTIES
FRAMEWORK TRUE
MACOSX_FRAMEWORK_IDENTIFIER com.callstack.${PROJECT_NAME}
Expand All @@ -37,6 +45,13 @@ if(APPLE)
XCODE_ATTRIBUTE_SKIP_INSTALL NO
PUBLIC_HEADER "${PUBLIC_HEADER_FILES}"
)
else()
# Elsewhere, ship the public headers via a HEADERS file set for install packaging.
target_sources(${PROJECT_NAME}
PUBLIC FILE_SET HEADERS
BASE_DIRS ${GENERATED_SOURCE_DIR} ${INCLUDE_DIR} FILES
${PUBLIC_HEADER_FILES}
)
endif()

# C++20 is needed to use designated initializers
Expand Down
Loading