diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2018-04-20 16:40:17 +0300 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2018-05-22 11:17:01 +0200 |
commit | d1a266b3e68d052d1478382795598bf2ff28da6a (patch) | |
tree | d303f378e1c959397b23739fbb9b06697da024e5 /cmake/mbgl.cmake | |
parent | 973aa963f917df2c20a05dfea1b3af7314677e06 (diff) | |
download | qtlocation-mapboxgl-d1a266b3e68d052d1478382795598bf2ff28da6a.tar.gz |
[node] allow building all ABIs at once
Diffstat (limited to 'cmake/mbgl.cmake')
-rw-r--r-- | cmake/mbgl.cmake | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/cmake/mbgl.cmake b/cmake/mbgl.cmake index f087c32511..88e24e3536 100644 --- a/cmake/mbgl.cmake +++ b/cmake/mbgl.cmake @@ -17,12 +17,32 @@ if(WITH_NODEJS) message(FATAL_ERROR "Could not find npm") endif() + execute_process( + COMMAND "${NodeJS_EXECUTABLE}" -e "process.stdout.write(process.versions.node)" + RESULT_VARIABLE _STATUS_CODE + OUTPUT_VARIABLE NodeJS_VERSION + ERROR_VARIABLE _STATUS_MESSAGE + ) + if(NOT _STATUS_CODE EQUAL 0) + message(FATAL_ERROR "Could not detect Node.js version: ${_STATUS_MESSAGE}") + endif() + + execute_process( + COMMAND "${NodeJS_EXECUTABLE}" -e "process.stdout.write(process.versions.modules)" + RESULT_VARIABLE _STATUS_CODE + OUTPUT_VARIABLE NodeJS_ABI + ERROR_VARIABLE _STATUS_MESSAGE + ) + if(NOT _STATUS_CODE EQUAL 0) + message(FATAL_ERROR "Could not detect Node.js ABI version: ${_STATUS_MESSAGE}") + endif() + function(_npm_install DIRECTORY NAME ADDITIONAL_DEPS) SET(NPM_INSTALL_FAILED FALSE) if("${DIRECTORY}/package.json" IS_NEWER_THAN "${DIRECTORY}/node_modules/.${NAME}.stamp") message(STATUS "Running 'npm install' for ${NAME}...") execute_process( - COMMAND ${NodeJS_EXECUTABLE} ${npm_EXECUTABLE} install --ignore-scripts + COMMAND "${NodeJS_EXECUTABLE}" "${npm_EXECUTABLE}" install --ignore-scripts WORKING_DIRECTORY "${DIRECTORY}" RESULT_VARIABLE NPM_INSTALL_FAILED) if(NOT NPM_INSTALL_FAILED) @@ -32,7 +52,7 @@ if(WITH_NODEJS) add_custom_command( OUTPUT "${DIRECTORY}/node_modules/.${NAME}.stamp" - COMMAND ${NodeJS_EXECUTABLE} ${npm_EXECUTABLE} install --ignore-scripts + COMMAND "${NodeJS_EXECUTABLE}" "${npm_EXECUTABLE}" install --ignore-scripts COMMAND ${CMAKE_COMMAND} -E touch "${DIRECTORY}/node_modules/.${NAME}.stamp" WORKING_DIRECTORY "${DIRECTORY}" DEPENDS ${ADDITIONAL_DEPS} "${DIRECTORY}/package.json" @@ -72,7 +92,12 @@ endif() # Generate source groups so the files are properly sorted in IDEs like Xcode. function(create_source_groups target) - get_target_property(sources ${target} SOURCES) + get_target_property(type ${target} TYPE) + if(type AND type STREQUAL "INTERFACE_LIBRARY") + get_target_property(sources ${target} INTERFACE_SOURCES) + else() + get_target_property(sources ${target} SOURCES) + endif() foreach(file ${sources}) get_filename_component(file "${file}" ABSOLUTE) string(REGEX REPLACE "^${CMAKE_SOURCE_DIR}/" "" group "${file}") |