-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
CMake RNOur `cmake` wrapping CLIOur `cmake` wrapping CLIbugSomething isn't workingSomething isn't working
Description
I made the assumption earlier that cmake projects wouldn't emit more than a single dynamic library:
assert.equal(result.length, 1, "Expected exactly one library file"); |
This won't be the case if we want to run the Node.js tests where the gyp-to-cmake
will produce CMakeLists.txt files declaring multiple output files with different names:
cmake_minimum_required(VERSION 3.15)
project(tests-node-api-test_buffer)
add_library(test_buffer SHARED test_buffer.c ${CMAKE_JS_SRC})
set_target_properties(test_buffer PROPERTIES PREFIX "" SUFFIX ".node")
target_include_directories(test_buffer PRIVATE ${CMAKE_JS_INC})
target_link_libraries(test_buffer PRIVATE ${CMAKE_JS_LIB})
target_compile_features(test_buffer PRIVATE cxx_std_17)
target_compile_definitions(test_buffer PRIVATE NAPI_VERSION=10)
add_library(test_finalizer SHARED test_finalizer.c ${CMAKE_JS_SRC})
set_target_properties(test_finalizer PROPERTIES PREFIX "" SUFFIX ".node")
target_include_directories(test_finalizer PRIVATE ${CMAKE_JS_INC})
target_link_libraries(test_finalizer PRIVATE ${CMAKE_JS_LIB})
target_compile_features(test_finalizer PRIVATE cxx_std_17)
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()
❯ node --run build-tests
Running "cmake-rn" in tests/js-native-api/2_function_arguments to build for React Native
Running "cmake-rn" in tests/node-api/test_buffer to build for React Native
ℹ Using default targets (aarch64-linux-android, arm64-apple-ios-sim)
- Configuring projects (android: aarch64-linux-android / apple: arm64-apple-ios-sim)
✔ Configured projects (android: aarch64-linux-android / apple: arm64-apple-ios-sim)
- Building projects
✔ Built projects
node:internal/process/promises:394
triggerUncaughtException(err, true /* fromPromise */);
^
AssertionError [ERR_ASSERTION]: Expected exactly one library file
2 !== 1
at file:///Users/kraen.hansen/Repositories/react-native-node-api/packages/cmake-rn/dist/platforms/android.js:104:20
at async Promise.all (index 0)
at async Object.postBuild (file:///Users/kraen.hansen/Repositories/react-native-node-api/packages/cmake-rn/dist/platforms/android.js:94:57)
at async Command.<anonymous> (file:///Users/kraen.hansen/Repositories/react-native-node-api/packages/cmake-rn/dist/cli.js:125:13) {
generatedMessage: false,
code: 'ERR_ASSERTION',
actual: 2,
expected: 1,
operator: 'strictEqual'
}
Metadata
Metadata
Assignees
Labels
CMake RNOur `cmake` wrapping CLIOur `cmake` wrapping CLIbugSomething isn't workingSomething isn't working