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 committed May 11, 2024
1 parent e7479a8 commit aa64f49
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 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}" npm run build) # cmake-lint: disable=C0301
COMMAND "${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}" "${NPM}" run build) # cmake-lint: disable=C0301

# platform specific target definitions
if(WIN32)
Expand Down

0 comments on commit aa64f49

Please sign in to comment.