Skip to content

Commit

Permalink
additionnal comment in the build script
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaslg committed Mar 5, 2024
1 parent 620c946 commit 85c7f95
Showing 1 changed file with 36 additions and 7 deletions.
43 changes: 36 additions & 7 deletions build_spack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,21 @@ git clone --depth=1 -b v0.20.1 https://github.com/spack/spack.git
# can be mandatory if you have already used spack on your computer
# delete the .spack directory in the home of the user
#==========================================
# our recipes
# get our recipes
git clone https://github.com/LIHPC-Computational-Geometry/spack_recipes.git
#==========================================
# modifying spack configuration
#==========================================
# hard-coded modifications to spack configuration

# Optionnal: modifying the install_tree variable to make it shorter and more human readable;
# the HASH part in install directory names is removed which can lead to collisions.
# The spack/etc/spack/defaults/config.yaml file can be modified by hand
# - in spack version 0.19.2
#sed -i 's#"${ARCHITECTURE}/${COMPILERNAME}-${COMPILERVER}/${PACKAGE}-${VERSION}-${HASH}"#"${PACKAGE}"#g' spack/etc/spack/defaults/config.yaml
# - in spack version 0.20.1
#sed -i 's#"{architecture}/{compiler.name}-{compiler.version}/{name}-{version}-{hash}"#"{name}"#g' spack/etc/spack/defaults/config.yaml

# this is used to declare opengl as non buildable and use the system library
cp ./spack_recipes/config/packages.yaml ./spack/etc/spack/

Expand All @@ -19,12 +29,20 @@ cp ./spack_recipes/config/packages.yaml ./spack/etc/spack/
#spack repo add ./spack_recipes/meshing_supersede
cp spack_recipes/config/repos.yaml spack/etc/spack/defaults/repos.yaml

# Optionnal: the default tmpdir used to build is defined in spack/etc/spack/defaults/config.yaml
# under the entry build_stage: $tempdir/$user/spack-stage
# Should one prefer to use a tmpfs or has limited disk space in the temporary dir (Qt's build directory can require up to 6Go on my setup)
# this entry can be modified

#==========================================
# configure spack; it modifies the .spack directory in the user home
source ./spack/share/spack/setup-env.sh
# configure spack using spack commands; it modifies the .spack directory in the user home
source spack/share/spack/setup-env.sh
spack clean -a

# registering cmake
spack external find cmake

# registering compilers
spack compiler find
# spack uses the highest version of the compiler found by default; if it is incomplete,
# for example the C compiler is installed but not the CXX one the installations will fail.
Expand All @@ -35,19 +53,30 @@ spack compiler find
#spack compiler remove gcc@12

#==========================================
# for regular install

# +mpi should actually be ok, but currently the default openmpi install fails
spack spec magix3d ^vtk-maillage~opengl2+qt~mpi ^hdf5~mpi ^cgns~mpi ^mesquite~mpi
#spack install magix3d ^vtk-maillage~opengl2+qt~mpi ^hdf5~mpi ^cgns~mpi ^mesquite~mpi
#spack spec magix3d+smooth3d+triton2+doc ^vtk-maillage~opengl2+qt~mpi ^hdf5~mpi ^cgns~mpi ^mesquite~mpi
#spack install magix3d+smooth3d+triton2+doc ^vtk-maillage~opengl2+qt~mpi ^hdf5~mpi ^cgns~mpi ^mesquite~mpi

# to work on the main branch
# install for dev purposes
git clone [email protected]:LIHPC-Computational-Geometry/magix3d.git
spack dev-build -d ./magix3d [email protected] ^vtk-maillage~opengl2+qt~mpi ^hdf5~mpi ^cgns~mpi ^mesquite~mpi
# you will probably want build_type=Debug or RelWithDebInfo.
# Choose the variants you need, you can check them using `spack info gmds`.
# The dev_path option does not seem to handle relative paths.
spack install magix3d+smooth3d+triton2+doc dev_path=$PWD/magix3d build_type=Debug ^vtk-maillage~opengl2+qt~mpi ^hdf5~mpi ^cgns~mpi ^mesquite~mpi

# to configure an IDE
# spack created files and directories named gmds/spack-* in the gmds source tree, where the necessary
# options are set up
# get the CMAKE_PREFIX_PATH with ';' as separators
cat magix3d/spack-build-env.txt | grep CMAKE_PREFIX_PATH | awk -F "=" {'print $2'} | awk -F ";" {'print $1'} | sed 's/:/;/g'
#spack load --only dependencies --sh magix3d | grep CMAKE_PREFIX_PATH | awk -F "=" {'print $2'} | sed 's/:/;/g'

# Note: I have issues building the doc this way, I guess other variables from spack-build-env.txt
# are required. In this case -DWITH_DOC:BOOL=OFF can be specified
cat gmds/spack-configure-args.txt

#==========================================
# testing the install
#export PYTHONPATH=spack/opt/spack/gmds/lib:$PYTHONPATH
Expand Down

0 comments on commit 85c7f95

Please sign in to comment.