Skip to content

Commit

Permalink
Fixup a few small details.
Browse files Browse the repository at this point in the history
Get rid of warnings from boost::placeholders by globally defining BOOST_BIND_GLOBAL_PLACEHOLDERS.
Add in a missing #include "InterSpec_config.h"
Add in some license statements to files missing.
Set range of CMake from 3.1 to 3.20, so that the most recent definitions will be used.
Update electron to 17.3.1
Update dependency build instructions for Linux.
  • Loading branch information
wcjohns committed Apr 1, 2022
1 parent 4874b9a commit 9b7ff9d
Show file tree
Hide file tree
Showing 13 changed files with 195 additions and 14 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions InterSpec/InterSpec_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion external_libs/Cuba-3.0/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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 )



Expand Down
2 changes: 1 addition & 1 deletion external_libs/Minuit2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion external_libs/muparserx-4.0.7/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

########################################################################
Expand Down
3 changes: 3 additions & 0 deletions src/CompactFileManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <sstream>
#include <string>
#include <vector>
Expand Down
23 changes: 23 additions & 0 deletions src/D3SpectrumDisplayDiv.cpp
Original file line number Diff line number Diff line change
@@ -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 <memory>
Expand Down
23 changes: 23 additions & 0 deletions src/D3TimeChart.cpp
Original file line number Diff line number Diff line change
@@ -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 <tuple>
Expand Down
23 changes: 23 additions & 0 deletions src/FluxTool.cpp
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion target/electron/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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 )

Expand Down
4 changes: 2 additions & 2 deletions target/electron/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions target/electron/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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"
Expand All @@ -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"
}
Expand Down
110 changes: 107 additions & 3 deletions target/patches/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@



# Building dependencies on macOS Catalina
First, lets set the directory we will install all the pre-requisites to:
```bash
Expand Down Expand Up @@ -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
Expand All @@ -202,3 +305,4 @@ diff -Naur someFile.txt.orig someFile.txt > someFile.txt.patch
```bash
patch -u someFile.txt -i someFile.txt.patch
```

0 comments on commit 9b7ff9d

Please sign in to comment.