Add support for node loader bootstrap and trampoline msvc compiler.
@@ -29,6 +29,7 @@ else()
set(NODE_LOADER_TRAMPOLINE_BUILD_TYPE "--release")
endif()
+if(MSVC)
# TODO: Add multiple msvc versions
if(MSVC_VERSION EQUAL 1900)
set(NODE_LOADER_TRAMPOLINE_MSVS_VERSION 2015)
@@ -38,12 +39,20 @@ endif()
add_custom_target(${target} ALL
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
COMMAND npm config set msvs_version ${NODE_LOADER_TRAMPOLINE_MSVS_VERSION}
+ COMMAND npm install --msvs_version=${NODE_LOADER_TRAMPOLINE_MSVS_VERSION}
+ COMMAND node-gyp ${NODE_LOADER_TRAMPOLINE_BUILD_TYPE} rebuild --verbose
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/build/${CMAKE_BUILD_TYPE}/trampoline.node ${LOADER_LIBRARY_PATH}
+ )
+else()
+ add_custom_target(${target} ALL
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
COMMAND npm install
- COMMAND node-gyp ${NODE_LOADER_TRAMPOLINE_BUILD_TYPE} --ensure rebuild --verbose
+ COMMAND node-gyp ${NODE_LOADER_TRAMPOLINE_BUILD_TYPE} rebuild --verbose
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/build/${CMAKE_BUILD_TYPE}/trampoline.node ${LOADER_LIBRARY_PATH}
)
+endif()
#
# Project options
