Mercurial > hg > orthanc-stl
changeset 37:2cc9950018ab
replaced folder ./Three by ./JavaScriptLibraries
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 05 Apr 2024 07:52:43 +0200 (13 months ago) |
parents | 13698d34e059 |
children | 970994058acd |
files | .hgignore CMakeLists.txt Resources/CreateJavaScriptLibraries.sh Resources/CreateJavaScriptLibraries/Dockerfile Resources/CreateJavaScriptLibraries/build-three.sh Resources/CreateThreeDist.sh Resources/CreateThreeDist/Dockerfile Resources/CreateThreeDist/build.sh |
diffstat | 8 files changed, 144 insertions(+), 138 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Fri Apr 05 07:42:06 2024 +0200 +++ b/.hgignore Fri Apr 05 07:52:43 2024 +0200 @@ -4,8 +4,8 @@ syntax: glob *~ ThirdPartyDownloads/ -Three/three.js-*.tar.gz -Three/dist +JavaScriptLibraries/three.js-*.tar.gz +JavaScriptLibraries/dist i/ s/ *.orig
--- a/CMakeLists.txt Fri Apr 05 07:42:06 2024 +0200 +++ b/CMakeLists.txt Fri Apr 05 07:52:43 2024 +0200 @@ -182,10 +182,10 @@ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/Resources/EmbedStaticAssets.py - ${CMAKE_SOURCE_DIR}/Three/dist + ${CMAKE_SOURCE_DIR}/JavaScriptLibraries/dist ${AUTOGENERATED_DIR}/StaticAssets.cpp DEPENDS - ${CMAKE_SOURCE_DIR}/Three/dist + ${CMAKE_SOURCE_DIR}/JavaScriptLibraries/dist ${CMAKE_SOURCE_DIR}/Resources/EmbedStaticAssets.py )
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/CreateJavaScriptLibraries.sh Fri Apr 05 07:52:43 2024 +0200 @@ -0,0 +1,74 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: 2023-2024 Sebastien Jodogne, UCLouvain, Belgium +# SPDX-License-Identifier: GPL-3.0-or-later + +# STL plugin for Orthanc +# Copyright (C) 2023-2024 Sebastien Jodogne, UCLouvain, Belgium +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + + + +# This command-line script uses the "npm" tool to populate the +# "JavaScriptLibraries/dist" folder. It uses Docker to this end, in +# order to be usable on our CIS. + +set -ex + + +## +## Prepare a Docker container with npm +## + +if [ -t 1 ]; then + # TTY is available => use interactive mode + DOCKER_FLAGS='-i' +fi + +ROOT_DIR=`dirname $(readlink -f $0)`/.. +IMAGE=orthanc-stl-node + +if [ -e "${ROOT_DIR}/JavaScriptLibraries/dist/" ]; then + echo "Target folder is already existing, aborting" + exit -1 +fi + +mkdir -p ${ROOT_DIR}/JavaScriptLibraries/dist/ + +( cd ${ROOT_DIR}/Resources/CreateJavaScriptLibraries && \ + docker build --no-cache -t ${IMAGE} . ) + + +## +## Building Three.js +## + +THREE=three.js-r154-sources + +echo "Creating the distribution of Three.js from $THREE" + +if [ ! -f "${ROOT_DIR}/JavaScriptLibraries/${THREE}.tar.gz" ]; then + mkdir -p "${ROOT_DIR}/JavaScriptLibraries" + ( cd ${ROOT_DIR}/JavaScriptLibraries && \ + wget https://orthanc.uclouvain.be/downloads/third-party-downloads/${THREE}.tar.gz ) +fi + +docker run -t ${DOCKER_FLAGS} --rm \ + --user $(id -u):$(id -g) \ + -v ${ROOT_DIR}/Resources/CreateJavaScriptLibraries/build-three.sh:/source/build-three.sh:ro \ + -v ${ROOT_DIR}/JavaScriptLibraries/${THREE}.tar.gz:/source/${THREE}.tar.gz:ro \ + -v ${ROOT_DIR}/JavaScriptLibraries/dist/:/target:rw \ + ${IMAGE} \ + bash /source/build-three.sh ${THREE}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/CreateJavaScriptLibraries/Dockerfile Fri Apr 05 07:52:43 2024 +0200 @@ -0,0 +1,26 @@ +# SPDX-FileCopyrightText: 2023-2024 Sebastien Jodogne, UCLouvain, Belgium +# SPDX-License-Identifier: GPL-3.0-or-later + +# STL plugin for Orthanc +# Copyright (C) 2023-2024 Sebastien Jodogne, UCLouvain, Belgium +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +FROM node:20.3.0-bullseye-slim + +MAINTAINER Sebastien Jodogne <s.jodogne@gmail.com> +LABEL Description="Orthanc, free DICOM server" Vendor="The Orthanc project" + +RUN apt-get -y clean && apt-get -y update && \ + apt-get clean && rm -rf /var/lib/apt/lists/*
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/CreateJavaScriptLibraries/build-three.sh Fri Apr 05 07:52:43 2024 +0200 @@ -0,0 +1,40 @@ +#!/bin/bash + +# SPDX-FileCopyrightText: 2023-2024 Sebastien Jodogne, UCLouvain, Belgium +# SPDX-License-Identifier: GPL-3.0-or-later + +# STL plugin for Orthanc +# Copyright (C) 2023-2024 Sebastien Jodogne, UCLouvain, Belgium +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +set -ex + +if [ "$1" = "" ]; then + echo "Please provide the source package of Three.js" + exit -1 +fi + +cd /tmp/ +tar xvf /source/$1.tar.gz + +cd /tmp/$1 +npm install --cache /tmp/npm-cache +npm run build --cache /tmp/npm-cache + +cp -r /tmp/$1/build/three.module.min.js /target/ + +cp /tmp/$1/editor/js/libs/es-module-shims.js /target/ +cp /tmp/$1/examples/jsm/controls/OrbitControls.js /target/ +cp /tmp/$1/examples/jsm/loaders/STLLoader.js /target/
--- a/Resources/CreateThreeDist.sh Fri Apr 05 07:42:06 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -#!/bin/bash - -# SPDX-FileCopyrightText: 2023-2024 Sebastien Jodogne, UCLouvain, Belgium -# SPDX-License-Identifier: GPL-3.0-or-later - -# STL plugin for Orthanc -# Copyright (C) 2023-2024 Sebastien Jodogne, UCLouvain, Belgium -# -# This program is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - - - -# This command-line script uses the "npm" tool to populate the "dist" -# folder of Three.js. It uses Docker to this end, in order to be -# usable on our CIS. - -set -ex - -if [ "$1" = "" ]; then - PACKAGE=three.js-r154-sources -else - PACKAGE=$1 -fi - -if [ -t 1 ]; then - # TTY is available => use interactive mode - DOCKER_FLAGS='-i' -fi - -ROOT_DIR=`dirname $(readlink -f $0)`/.. -IMAGE=orthanc-stl-node - -echo "Creating the distribution of Three.js from $PACKAGE" - -if [ -e "${ROOT_DIR}/Three/dist/" ]; then - echo "Target folder is already existing, aborting" - exit -1 -fi - -if [ ! -f "${ROOT_DIR}/Three/${PACKAGE}.tar.gz" ]; then - mkdir -p "${ROOT_DIR}/Three" - ( cd ${ROOT_DIR}/Three && \ - wget https://orthanc.uclouvain.be/downloads/third-party-downloads/${PACKAGE}.tar.gz ) -fi - -mkdir -p ${ROOT_DIR}/Three/dist/ - -( cd ${ROOT_DIR}/Resources/CreateThreeDist && \ - docker build --no-cache -t ${IMAGE} . ) - -docker run -t ${DOCKER_FLAGS} --rm \ - --user $(id -u):$(id -g) \ - -v ${ROOT_DIR}/Resources/CreateThreeDist/build.sh:/source/build.sh:ro \ - -v ${ROOT_DIR}/Three/${PACKAGE}.tar.gz:/source/${PACKAGE}.tar.gz:ro \ - -v ${ROOT_DIR}/Three/dist/:/target:rw \ - ${IMAGE} \ - bash /source/build.sh ${PACKAGE}
--- a/Resources/CreateThreeDist/Dockerfile Fri Apr 05 07:42:06 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -# SPDX-FileCopyrightText: 2023-2024 Sebastien Jodogne, UCLouvain, Belgium -# SPDX-License-Identifier: GPL-3.0-or-later - -# STL plugin for Orthanc -# Copyright (C) 2023-2024 Sebastien Jodogne, UCLouvain, Belgium -# -# This program is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -FROM node:20.3.0-bullseye-slim - -MAINTAINER Sebastien Jodogne <s.jodogne@gmail.com> -LABEL Description="Orthanc, free DICOM server" Vendor="The Orthanc project" - -RUN apt-get -y clean && apt-get -y update && \ - apt-get clean && rm -rf /var/lib/apt/lists/*
--- a/Resources/CreateThreeDist/build.sh Fri Apr 05 07:42:06 2024 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -#!/bin/bash - -# SPDX-FileCopyrightText: 2023-2024 Sebastien Jodogne, UCLouvain, Belgium -# SPDX-License-Identifier: GPL-3.0-or-later - -# STL plugin for Orthanc -# Copyright (C) 2023-2024 Sebastien Jodogne, UCLouvain, Belgium -# -# This program is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -set -ex - -if [ "$1" = "" ]; then - echo "Please provide the source package of Three.js" - exit -1 -fi - -cd /tmp/ -tar xvf /source/$1.tar.gz - -cd /tmp/$1 -npm install --cache /tmp/npm-cache -npm run build --cache /tmp/npm-cache - -cp -r /tmp/$1/build/three.module.min.js /target/ - -cp /tmp/$1/editor/js/libs/es-module-shims.js /target/ -cp /tmp/$1/examples/jsm/controls/OrbitControls.js /target/ -cp /tmp/$1/examples/jsm/loaders/STLLoader.js /target/