mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
optional auto-complete build (requires NPM installed)
This commit is contained in:
parent
67effd1ad1
commit
79dbde6a6f
4 changed files with 47 additions and 13 deletions
14
cmake/macros/FindNPM.cmake
Normal file
14
cmake/macros/FindNPM.cmake
Normal file
|
@ -0,0 +1,14 @@
|
|||
#
|
||||
# FindNPM.cmake
|
||||
# cmake/macros
|
||||
#
|
||||
# Created by Thijs Wenker on 01/23/18.
|
||||
# Copyright 2018 High Fidelity, Inc.
|
||||
#
|
||||
# Distributed under the Apache License, Version 2.0.
|
||||
# See the accompanying file LICENSE or http:#www.apache.org/licenses/LICENSE-2.0.html
|
||||
#
|
||||
|
||||
macro(find_npm)
|
||||
find_program(NPM_EXECUTABLE "npm")
|
||||
endmacro()
|
|
@ -41,6 +41,8 @@ endif()
|
|||
file(GLOB_RECURSE INTERFACE_SRCS "src/*.cpp" "src/*.h")
|
||||
GroupSources("src")
|
||||
|
||||
find_npm()
|
||||
|
||||
# Add SpeechRecognizer if on Windows or OS X, otherwise remove
|
||||
if (WIN32)
|
||||
# Use .cpp and .h files as is.
|
||||
|
@ -297,22 +299,38 @@ if (APPLE)
|
|||
|
||||
set(SCRIPTS_INSTALL_DIR "${INTERFACE_INSTALL_APP_PATH}/Contents/Resources")
|
||||
|
||||
if (NPM_EXECUTABLE)
|
||||
set(EXTRA_COPY_COMMANDS
|
||||
COMMAND "${CMAKE_COMMAND}" -E make_directory
|
||||
"$<TARGET_FILE_DIR:${TARGET_NAME}>/../Resources/auto-complete"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy
|
||||
"${CMAKE_SOURCE_DIR}/tools/jsdoc/out/hifiJSDoc.json"
|
||||
"$<TARGET_FILE_DIR:${TARGET_NAME}>/../Resources/auto-complete"
|
||||
)
|
||||
endif()
|
||||
|
||||
# copy script files beside the executable
|
||||
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_directory
|
||||
"${CMAKE_SOURCE_DIR}/scripts"
|
||||
"$<TARGET_FILE_DIR:${TARGET_NAME}>/../Resources/scripts"
|
||||
COMMAND "${CMAKE_COMMAND}" -E make_directory
|
||||
"$<TARGET_FILE_DIR:${TARGET_NAME}>/../Resources/auto-complete"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy
|
||||
"${CMAKE_SOURCE_DIR}/tools/jsdoc/out/hifiJSDoc.json"
|
||||
"$<TARGET_FILE_DIR:${TARGET_NAME}>/../Resources/auto-complete"
|
||||
|
||||
${EXTRA_COPY_COMMANDS}
|
||||
)
|
||||
|
||||
# call the fixup_interface macro to add required bundling commands for installation
|
||||
fixup_interface()
|
||||
|
||||
else (APPLE)
|
||||
if (NPM_EXECUTABLE)
|
||||
set(EXTRA_COPY_COMMANDS
|
||||
COMMAND "${CMAKE_COMMAND}" -E make_directory
|
||||
"$<TARGET_FILE_DIR:${TARGET_NAME}>/resources/auto-complete"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy
|
||||
"${CMAKE_SOURCE_DIR}/tools/jsdoc/out/hifiJSDoc.json"
|
||||
"$<TARGET_FILE_DIR:${TARGET_NAME}>/resources/auto-complete"
|
||||
)
|
||||
endif()
|
||||
# copy the resources files beside the executable
|
||||
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_directory
|
||||
|
@ -321,11 +339,8 @@ else (APPLE)
|
|||
COMMAND "${CMAKE_COMMAND}" -E copy_directory
|
||||
"${CMAKE_SOURCE_DIR}/scripts"
|
||||
"$<TARGET_FILE_DIR:${TARGET_NAME}>/scripts"
|
||||
COMMAND "${CMAKE_COMMAND}" -E make_directory
|
||||
"$<TARGET_FILE_DIR:${TARGET_NAME}>/resources/auto-complete"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy
|
||||
"${CMAKE_SOURCE_DIR}/tools/jsdoc/out/hifiJSDoc.json"
|
||||
"$<TARGET_FILE_DIR:${TARGET_NAME}>/resources/auto-complete"
|
||||
|
||||
${EXTRA_COPY_COMMANDS}
|
||||
)
|
||||
|
||||
# link target to external libraries
|
||||
|
|
|
@ -2,8 +2,11 @@
|
|||
add_subdirectory(scribe)
|
||||
set_target_properties(scribe PROPERTIES FOLDER "Tools")
|
||||
|
||||
add_subdirectory(jsdoc)
|
||||
set_target_properties(jsdoc PROPERTIES FOLDER "Tools")
|
||||
find_npm()
|
||||
if (NPM_EXECUTABLE)
|
||||
add_subdirectory(jsdoc)
|
||||
set_target_properties(jsdoc PROPERTIES FOLDER "Tools")
|
||||
endif()
|
||||
|
||||
if (BUILD_TOOLS)
|
||||
add_subdirectory(udt-test)
|
||||
|
|
|
@ -2,6 +2,8 @@ set(TARGET_NAME jsdoc)
|
|||
|
||||
add_custom_target(${TARGET_NAME})
|
||||
|
||||
find_npm()
|
||||
|
||||
SET(JSDOC_WORKING_DIR ${CMAKE_SOURCE_DIR}/tools/jsdoc)
|
||||
file(TO_NATIVE_PATH ${JSDOC_WORKING_DIR}/node_modules/.bin/jsdoc JSDOC_PATH)
|
||||
file(TO_NATIVE_PATH ${JSDOC_WORKING_DIR}/config.json JSDOC_CONFIG_PATH)
|
||||
|
@ -9,7 +11,7 @@ file(TO_NATIVE_PATH ${JSDOC_WORKING_DIR}/out OUTPUT_DIR)
|
|||
file(TO_NATIVE_PATH ${JSDOC_WORKING_DIR} NATIVE_JSDOC_WORKING_DIR)
|
||||
|
||||
add_custom_command(TARGET ${TARGET_NAME}
|
||||
COMMAND (npm --no-progress install) && (${JSDOC_PATH} ${NATIVE_JSDOC_WORKING_DIR} -c ${JSDOC_CONFIG_PATH} -d ${OUTPUT_DIR})
|
||||
COMMAND (${NPM_EXECUTABLE} --no-progress install) && (${JSDOC_PATH} ${NATIVE_JSDOC_WORKING_DIR} -c ${JSDOC_CONFIG_PATH} -d ${OUTPUT_DIR})
|
||||
WORKING_DIRECTORY ${JSDOC_WORKING_DIR}
|
||||
COMMENT "generate the JSDoc JSON for the JSConsole auto-completer"
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue