Skip to content

Commit

Permalink
build: Use find_program to find NPM so it can be overridden
Browse files Browse the repository at this point in the history
This is useful for Gentoo, which needs to be able to do entirely offline
builds, because it can override this with `true` while shipping
pre-compiled assets. Gentoo has tried to ship cached NPM modules
instead, but it turns out these are very sensitive to the NPM version.
  • Loading branch information
chewi authored and ReenigneArcher committed May 11, 2024
1 parent 851e0ea commit 2c71e13
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmake/targets/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ else()
endif()

#WebUI build
find_program(NPM npm REQUIRED)
add_custom_target(web-ui ALL
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
COMMENT "Installing NPM Dependencies and Building the Web UI"
COMMAND "$<$<BOOL:${WIN32}>:cmd;/C>" npm install
COMMAND "${CMAKE_COMMAND}" -E env "SUNSHINE_BUILD_HOMEBREW=${NPM_BUILD_HOMEBREW}" "SUNSHINE_SOURCE_ASSETS_DIR=${NPM_SOURCE_ASSETS_DIR}" "SUNSHINE_ASSETS_DIR=${NPM_ASSETS_DIR}" "$<$<BOOL:${WIN32}>:cmd;/C>" npm run build # cmake-lint: disable=C0301
COMMAND "$<$<BOOL:${WIN32}>:cmd;/C>" "${NPM}" install
COMMAND "${CMAKE_COMMAND}" -E env "SUNSHINE_BUILD_HOMEBREW=${NPM_BUILD_HOMEBREW}" "SUNSHINE_SOURCE_ASSETS_DIR=${NPM_SOURCE_ASSETS_DIR}" "SUNSHINE_ASSETS_DIR=${NPM_ASSETS_DIR}" "$<$<BOOL:${WIN32}>:cmd;/C>" "${NPM}" run build # cmake-lint: disable=C0301
COMMAND_EXPAND_LISTS
VERBATIM)

Expand Down

0 comments on commit 2c71e13

Please sign in to comment.