Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 40 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -271,19 +271,44 @@ install(

# appWeb
if(USE_JS)
find_program(NPM_EXECUTABLE npm REQUIRED)

set(REACT_APP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/web_app)
set(REACT_DIST_DIR ${REACT_APP_DIR}/dist)

add_custom_target(
web_app_hpp_plot_build
ALL
COMMAND ${NPM_EXECUTABLE} install
COMMAND ${NPM_EXECUTABLE} run build
WORKING_DIRECTORY ${REACT_APP_DIR}
COMMENT "Building React app"
)

install(DIRECTORY "${REACT_DIST_DIR}/" DESTINATION "share/hpp-plot/webapp")
find_program(NPM_EXECUTABLE npm)

if(NPM_EXECUTABLE)
set(REACT_APP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/web_app)
set(REACT_DIST_DIR ${REACT_APP_DIR}/dist)

# TODO: build that is build dir and not src
add_custom_target(
web_app_hpp_plot_build
ALL
COMMAND ${NPM_EXECUTABLE} install
COMMAND ${NPM_EXECUTABLE} run build
WORKING_DIRECTORY ${REACT_APP_DIR}
COMMENT "Building React app"
)
install(
DIRECTORY "${REACT_DIST_DIR}/"
DESTINATION "share/hpp-plot/webapp"
)
else()
# tar -c --xz -C src/web_app/dist -f webapp.tar.xz .
message(
WARNING
"npm was not found, using prebuild webapp, might not be up-to-date"
)
include(FetchContent)
FetchContent_Declare(
webapp
URL
"https://github.com/humanoid-path-planner/hpp-plot/releases/download/v9.0.0/webapp.tar.xz"
URL_HASH
"SHA256=deb49dbb5d3f1b9f725f424f99de878cb6ffdb3f289c57dc5a14838afaef33c0"
DOWNLOAD_EXTRACT_TIMESTAMP ON
)
FetchContent_MakeAvailable(webapp)
install(
DIRECTORY "${webapp_SOURCE_DIR}/"
DESTINATION "share/hpp-plot/webapp"
)
endif()
endif()
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
npmDeps = pkgs-final.fetchNpmDeps {
name = "${drv-final.pname}-${drv-final.version}-npm-deps";
src = drv-final.src + "/src/web_app/";
hash = "sha256-B8s+hhTn7CG3q8bx490SM8fKFAEGOmHX7u8JN/7qI94=";
hash = "sha256-GAYdugZFMygk0MXyXxf2wSsWRvn/aW4YeFH2v62IZjI=";
};
preBuild = ''
cd ../src/web_app
Expand Down
5 changes: 3 additions & 2 deletions src/web_app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions src/web_app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "cytoscape-hpp-plot",
"private": true,
"version": "0.1.0",
"version": "9.0.0",
"description": "Plotting tools for HPP with cytoscape",
"license": "BSD-2-Clause",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down