Fix development build using system js resources

Copy native resources to build directory on all platforms
This commit is contained in:
Andrew Rabert committed 2025-10-27 20:06:24 -04:00
1 parent 8f0b1e4e0e
commit 0294ada0b9
2 files changed
+8 -20

No files matched your search

+7 -19
View File
@@ -14,38 +14,26 @@ function(copy_resources target)
if(XCODE)
return()
endif()
get_property(RESOURCE_LIST GLOBAL PROPERTY _${target}_RESOURCE_LIST)
if(RESOURCE_LIST)
set_policy(CMP0026 OLD)
# we read the LOCATION from the target instead of using a generator
# here since add_custom_command doesn't support generator expresessions
# in the output field, and this is still cleaner than hardcoding the path
# of the output binary.
#
get_property(TARGET_LOC TARGET ${target} PROPERTY LOCATION)
get_filename_component(TARGET_DIR ${TARGET_LOC} DIRECTORY)
# Use generator expression instead of deprecated LOCATION property
if(APPLE)
set(TARGET_LOC ${TARGET_DIR}/..)
set(TARGET_LOC $<TARGET_FILE_DIR:${target}>/..)
else()
set(TARGET_LOC ${TARGET_DIR})
set(TARGET_LOC $<TARGET_FILE_DIR:${target}>)
endif()
foreach(RF ${RESOURCE_LIST})
string(REPLACE "|" ";" PARTS "${RF}")
list(GET PARTS 0 SOURCE_FILE)
list(GET PARTS 1 _TARGET_FILE)
set(TARGET_FILE ${TARGET_LOC}/${_TARGET_FILE})
add_custom_command(OUTPUT ${TARGET_FILE}
COMMAND ${CMAKE_COMMAND} -E copy "${SOURCE_FILE}" "${TARGET_FILE}"
add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${SOURCE_FILE}" "${TARGET_LOC}/${_TARGET_FILE}"
DEPENDS ${SOURCE_FILE}
COMMENT "CopyResource (${target}): ${TARGET_FILE}")
list(APPEND RESOURCES ${TARGET_FILE})
COMMENT "CopyResource (${target}): ${_TARGET_FILE}")
endforeach()
add_custom_target(${target}_CopyResources DEPENDS ${RESOURCES})
add_dependencies(${target} ${target}_CopyResources)
endif(RESOURCE_LIST)
endfunction()
+1 -1
View File
@@ -106,8 +106,8 @@ endif()
set(RESOURCE_ROOT .)
if(APPLE)
set(RESOURCE_ROOT Resources)
add_resources(TARGET ${MAIN_TARGET} SOURCES ${CMAKE_SOURCE_DIR}/native/ DEST ${RESOURCE_ROOT}/web-client/extension)
endif()
add_resources(TARGET ${MAIN_TARGET} SOURCES ${CMAKE_SOURCE_DIR}/native/ DEST ${RESOURCE_ROOT}/web-client/extension)
if(NOT APPLE)
set(rsrc_locations