diff --git a/CMakeLists.txt b/CMakeLists.txt index 5fe13095..a81d4116 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,9 +5,9 @@ endif(POLICY CMP0091) cmake_policy(SET CMP0048 NEW) -cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.1...3.20 FATAL_ERROR) -project(InterSpec VERSION 1.9.1) +project(InterSpec VERSION 1.0.10) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/InterSpec/InterSpec_config.h.in b/InterSpec/InterSpec_config.h.in index 31abfd74..066bd440 100644 --- a/InterSpec/InterSpec_config.h.in +++ b/InterSpec/InterSpec_config.h.in @@ -131,4 +131,9 @@ void log_developer_error( const char *location, const char *error ); #define DATE_TIME_FORMAT_STR "dd/MM/yy hh:mm:ss" +// Prevent some compile warnings from using like _1 instead of +// boost::placeholders::_1 (I think this must be in the Wt +// headers, since our code uses the namespace prefixes) +#define BOOST_BIND_GLOBAL_PLACEHOLDERS + #endif // InterSpec_config_h diff --git a/external_libs/Cuba-3.0/CMakeLists.txt b/external_libs/Cuba-3.0/CMakeLists.txt index 91131e9c..565fc11a 100644 --- a/external_libs/Cuba-3.0/CMakeLists.txt +++ b/external_libs/Cuba-3.0/CMakeLists.txt @@ -1,6 +1,6 @@ project(Cuba-3.0) #right now this file only compiles "cuhre" version of the integration routines -cmake_minimum_required( VERSION 3.1 ) +cmake_minimum_required( VERSION 3.1...3.20 ) diff --git a/external_libs/Minuit2/CMakeLists.txt b/external_libs/Minuit2/CMakeLists.txt index 1db8e38d..755f4468 100644 --- a/external_libs/Minuit2/CMakeLists.txt +++ b/external_libs/Minuit2/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_policy(SET CMP0048 NEW) project( minuit2 VERSION 2 ) -cmake_minimum_required( VERSION 3.1 ) +cmake_minimum_required( VERSION 3.1...3.20 ) set ( MINUIT_SRCS diff --git a/external_libs/muparserx-4.0.7/CMakeLists.txt b/external_libs/muparserx-4.0.7/CMakeLists.txt index db3af5d5..8a5f9feb 100644 --- a/external_libs/muparserx-4.0.7/CMakeLists.txt +++ b/external_libs/muparserx-4.0.7/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_policy(SET CMP0048 NEW) ######################################################################## # Project setup ######################################################################## -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.1...3.20) project(muparserx VERSION 4.0.7 LANGUAGES CXX) ######################################################################## diff --git a/src/CompactFileManager.cpp b/src/CompactFileManager.cpp index 797b80ec..4ab8655f 100644 --- a/src/CompactFileManager.cpp +++ b/src/CompactFileManager.cpp @@ -20,6 +20,9 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ + +#include "InterSpec_config.h" + #include #include #include diff --git a/src/D3SpectrumDisplayDiv.cpp b/src/D3SpectrumDisplayDiv.cpp index 169ccd91..1edcd45a 100644 --- a/src/D3SpectrumDisplayDiv.cpp +++ b/src/D3SpectrumDisplayDiv.cpp @@ -1,3 +1,26 @@ +/* InterSpec: an application to analyze spectral gamma radiation data. + + Copyright 2018 National Technology & Engineering Solutions of Sandia, LLC + (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. + Government retains certain rights in this software. + For questions contact William Johnson via email at wcjohns@sandia.gov, or + alternative emails of interspec@sandia.gov. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #include "InterSpec_config.h" #include diff --git a/src/D3TimeChart.cpp b/src/D3TimeChart.cpp index f9d0b508..3813baa3 100644 --- a/src/D3TimeChart.cpp +++ b/src/D3TimeChart.cpp @@ -1,3 +1,26 @@ +/* InterSpec: an application to analyze spectral gamma radiation data. + + Copyright 2018 National Technology & Engineering Solutions of Sandia, LLC + (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. + Government retains certain rights in this software. + For questions contact William Johnson via email at wcjohns@sandia.gov, or + alternative emails of interspec@sandia.gov. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #include "InterSpec_config.h" #include diff --git a/src/FluxTool.cpp b/src/FluxTool.cpp index 7e58233e..a7584f1f 100644 --- a/src/FluxTool.cpp +++ b/src/FluxTool.cpp @@ -1,3 +1,26 @@ +/* InterSpec: an application to analyze spectral gamma radiation data. + + Copyright 2018 National Technology & Engineering Solutions of Sandia, LLC + (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. + Government retains certain rights in this software. + For questions contact William Johnson via email at wcjohns@sandia.gov, or + alternative emails of interspec@sandia.gov. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #define _USE_MATH_DEFINES #include "InterSpec_config.h" diff --git a/target/electron/CMakeLists.txt b/target/electron/CMakeLists.txt index 46177d6f..98e78838 100644 --- a/target/electron/CMakeLists.txt +++ b/target/electron/CMakeLists.txt @@ -1,5 +1,5 @@ # Require CMake 3.15 to use MSVC_RUNTIME_LIBRARY -cmake_minimum_required(VERSION 3.15 FATAL_ERROR) +cmake_minimum_required(VERSION 3.1...3.20 FATAL_ERROR) project( InterSpecAddOn ) diff --git a/target/electron/README.md b/target/electron/README.md index ee36b0c6..0c46c93b 100755 --- a/target/electron/README.md +++ b/target/electron/README.md @@ -12,7 +12,7 @@ export MACOSX_DEPLOYMENT_TARGET=10.12 cd /path/to/InterSpec/target/electron # Install dependency for compiling a node.js add-on -npm install --save-dev node-addon-api +npm install --save-dev node-addon-api --arch=x64 # If boost and Wt are in standard locations, you can just run cmake-js @@ -49,7 +49,7 @@ ninja -C build_dir install # To run InterSpec without packaging everything, you # need to install the Electron package -npm install electron +npm install electron --arch=x64 # Then to actually run things npm start diff --git a/target/electron/package.json b/target/electron/package.json index 4bc70a8f..f5655be2 100755 --- a/target/electron/package.json +++ b/target/electron/package.json @@ -1,6 +1,6 @@ { "name": "InterSpecAddOn", - "version": "1.0.8", + "version": "1.0.10", "description": "Application for interactive gamma spectroscopy", "homepage": "https://github.com/sandialabs/InterSpec", "main": "main.js", @@ -10,7 +10,7 @@ }, "scripts": { "install": "cmake-js compile", - "start": "electron ./build_xcode/app/", + "start": "electron ./build_win/app/", "package-mac": "electron-packager ./build_macos/app --overwrite --platform=darwin --arch=x64 --icon=macOS/InterSpec.icns --prune=true --out=release-builds --binaries=InterSpec.exe --extendInfo=macOS/Info.plist --entitlements=macOS/entitlements.mac.plist --ignore=copy_resources.* --ignore=LICENSE.md --ignore=README.md", "package-win": "electron-packager ./build_win/app InterSpec --overwrite --asar=false --platform=win32 --arch=x64 --icon=windows/icon.ico --prune=true --out=release-builds --version-string.CompanyName=\"Sandia National Laboratories\" --version-string.FileDescription=\"nuclear spectroscopy analysis program\" --version-string.ProductName=\"InterSpec\" --ignore=LICENSE.md --ignore=README.md", "package-linux": "electron-packager ./build_linux/app InterSpec --overwrite --asar=false --platform=linux --arch=x64 --icon=linux/InterSpec_desktop_icon_256x256.png --prune=true --out=release-builds --ignore=copy_resources.* --ignore=LICENSE.md --ignore=README.md" @@ -24,7 +24,7 @@ "cmake-js": "^6.1.0" }, "devDependencies": { - "electron": "^17.1.2", + "electron": "^17.3.1", "electron-packager": "^15.4.0", "node-addon-api": "^3.2.1" } diff --git a/target/patches/README.md b/target/patches/README.md index 178ef447..0c64f5ac 100644 --- a/target/patches/README.md +++ b/target/patches/README.md @@ -1,6 +1,3 @@ - - - # Building dependencies on macOS Catalina First, lets set the directory we will install all the pre-requisites to: ```bash @@ -186,6 +183,112 @@ cmake --build . --config Release --target install If you plan to package InterSpec as an Electron application (e.g., normal desktop app), see the instructions in [patches](/target/electron/) for building the InterSpec code and packaging the application. + +# Building dependencies on Linux +The commands to build both the prerequists and InterSpec on Ubuntu 18.04 are below. + +These commands build boost, Wt, and zlib and install them to a non-system directory prefix so they wont interfere with any other builds, or use the system package managers packages that may not be the exact version of Wt needed. + + +```bash +sudo apt-get update +sudo apt-get upgrade +sudo apt-get install build-essential cmake cmake-curses-gui git + +# First, lets set the directory we will install all the pre-requisites to: +export MY_WT_PREFIX=/home/wcjohns/install/wt3.7.1_prefix +export PATCH_DIR=/mnt/hgfs/wcjohns/rad_ana/InterSpec_master/target/patches + +# Move to a temporary location to build boost/wt +cd /tmp +mkdir build-wt +cd build-wt + +# Download and build boost 1.78 +curl -L https://sourceforge.net/projects/boost/files/boost/1.78.0/boost_1_78_0.zip/download --output boost_1_78_0.zip +unzip boost_1_78_0.zip +cd boost_1_78_0 + +# build the b2 executable +./bootstrap.sh --prefix=${MY_WT_PREFIX} + +# build and install boost +./b2 cxxflags="-std=c++14 -fPIC" cflags="-fPIC" linkflags="-std=c++14" link=static variant=release threading=multi --build-dir=build --prefix=${MY_WT_PREFIX} -a install +cd .. + + +## Download and build Wt 3.7.1 +curl -L https://github.com/emweb/wt/archive/3.7.1.tar.gz --output wt-3.7.1.tar.gz +tar -xzvf wt-3.7.1.tar.gz + +cd wt-3.7.1 +patch -u src/Wt/Render/CssParser.C -i ${PATCH_DIR}/wt/3.7.1/CssParser.C.patch +mkdir build +cd build + +cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${MY_WT_PREFIX} -DBOOST_PREFIX=${MY_WT_PREFIX} -DSHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=${MY_WT_PREFIX} -DENABLE_SSL=OFF -DCONNECTOR_FCGI=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF -DENABLE_MYSQL=OFF -DENABLE_POSTGRES=OFF -DENABLE_PANGO=OFF -DINSTALL_FINDWT_CMAKE_FILE=OFF -DHTTP_WITH_ZLIB=OFF -DWT_CPP_11_MODE="-std=c++14" -DCONFIGURATION=data/config/wt_config_electron.xml -DWTHTTP_CONFIGURATION=data/config/wthttpd -DCONFIGDIR=${MY_WT_PREFIX}/etc/wt -DCMAKE_CXX_FLAGS="-fPIC" -DCMAKE_C_FLAGS="-fPIC" .. +make -j10 install +cd ../.. + +## Download and build zlib (for supporting zipped spectrum files) +curl -L https://www.zlib.net/zlib-1.2.12.tar.gz --output zlib-1.2.12.tar.gz +tar -xzvf zlib-1.2.12.tar.gz +cd zlib-1.2.12 + +mkdir build +cd build +cmake -DCMAKE_INSTALL_PREFIX=${MY_WT_PREFIX} -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-fPIC" -DCMAKE_C_FLAGS="-fPIC" .. +cmake --build . --config Release --target install +cd ../.. +``` + +You can now either build a local web server +```bash +cd ~/development +git clone --recursive https://github.com/sandialabs/interspec/ +cd interspec +mkdir build; cd build + +cmake -DCMAKE_PREFIX_PATH=${MY_WT_PREFIX} .. +make -j8 + +# If you compiled it in debug mode, you may need symlink the D3.js based resources to where the web-requests expect to find them, e.g. +ln -s ../external_libs/SpecUtils/d3_resources ./external_libs/ +# (this is so you can edit d3_resources/SpectrumChartD3.js and see changes without doing a file copy) + + +# And if all went well you can run the executable using the command: +./bin/InterSpec.exe --docroot . --http-address 127.0.0.1 --http-port 8080 -c ./data/config/wt_config_localweb.xml + +# And then point your browser to http://localhost:8080 to access the application + + +# Or if you want the desktop version of the application, see InterSpec/target/electron/README.md for build instructions +cd /path/to/InterSpec/target/electron + +sudo apt-get install nodejs npm +npm install -g cmake-js +npm install --save-dev node-addon-api +npm install electron +npm install electron-packager + +cmake-js --CDCMAKE_PREFIX_PATH=${MY_WT_PREFIX} --CDCMAKE_BUILD_TYPE="Release" --out="build_linux" --target install + +# To run InterSpec: +electron build_linux/app + +# Or to create a self-contained package of the app +npm run package-linux + +#InterSpec is now in release-builds/InterSpec-linux-x64 + +# (note: you may need to upgrade to a newer version of npm and/or nodejs to +# use latest versions of electron) +``` + + + + # Process for patching files. ## To make a patch @@ -202,3 +305,4 @@ diff -Naur someFile.txt.orig someFile.txt > someFile.txt.patch ```bash patch -u someFile.txt -i someFile.txt.patch ``` +