-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from sandialabs/dev-weh
Reworking build script logic and documentation
- Loading branch information
Showing
3 changed files
with
51 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
#!/bin/bash -e | ||
# | ||
# This scripts builds Coek in the `build` directory to support local | ||
# This scripts builds Coek in the `_build` directory to support local | ||
# development and debugging. | ||
# | ||
# This uses Spack to install third-party dependencies in the `spack` directory. | ||
# This uses Spack to install third-party dependencies in the `_spack` directory. | ||
# | ||
with_python="OFF" | ||
spack_reinstall=0 | ||
|
@@ -12,7 +12,7 @@ clang=0 | |
for arg ; do | ||
case "$arg" in | ||
--help) | ||
echo "build_dev.sh [--python] [--clang] [--spack-reinstall] [--spack-dev] [--help]" | ||
echo "build.sh [--python] [--clang] [--spack-reinstall] [--spack-dev] [--help]" | ||
exit | ||
;; | ||
--python) | ||
|
@@ -34,22 +34,33 @@ for arg ; do | |
esac | ||
done | ||
|
||
export SPACK_HOME=`pwd`/spack | ||
# | ||
# Setup directories | ||
# | ||
export SPACK_HOME=`pwd`/_spack | ||
echo "SPACK_HOME=${SPACK_HOME}" | ||
if [[ "${spack_reinstall}" -eq 1 ]]; then | ||
rm -Rf ${SPACK_HOME} | ||
fi | ||
\rm -Rf _build | ||
# | ||
# Configure gurobi | ||
# | ||
if [[ -z "${GUROBI_HOME}" ]]; then | ||
with_gurobi="OFF" | ||
else | ||
with_gurobi="ON" | ||
fi | ||
|
||
# | ||
# Configure clang | ||
# | ||
if [[ $clang -eq 1 ]]; then | ||
export CXX=clang++ | ||
export CC=clang | ||
fi | ||
|
||
if [[ "${spack_reinstall}" -eq 1 ]]; then | ||
rm -Rf ${SPACK_HOME} | ||
fi | ||
# | ||
# Install spack | ||
# | ||
if test -d ${SPACK_HOME}; then | ||
echo "" | ||
echo "WARNING: Spack directory exists." | ||
|
@@ -59,9 +70,9 @@ else | |
echo "Installing Coek dependencies using Spack" | ||
echo "" | ||
if [[ "$spack_dev" -eq 0 ]]; then | ||
git clone https://github.com/or-fusion/spack.git | ||
git clone https://github.com/or-fusion/spack.git _spack | ||
else | ||
git clone [email protected]:or-fusion/spack.git | ||
git clone [email protected]:or-fusion/spack.git _spack | ||
fi | ||
. ${SPACK_HOME}/share/spack/setup-env.sh | ||
spack env create coekenv | ||
|
@@ -70,11 +81,12 @@ else | |
spack install | ||
spack env deactivate | ||
fi | ||
|
||
# | ||
# Install coek | ||
# | ||
echo "Building Coek" | ||
echo "" | ||
\rm -Rf build | ||
mkdir build | ||
cd build | ||
mkdir _build | ||
cd _build | ||
cmake -DCMAKE_PREFIX_PATH=${SPACK_HOME}/var/spack/environments/coekenv/.spack-env/view -Dwith_python=${with_python} -Dwith_gurobi=$with_gurobi -Dwith_highs=ON -Dwith_cppad=ON -Dwith_fmtlib=ON -Dwith_rapidjson=ON -Dwith_catch2=ON -Dwith_tests=ON -Dwith_asl=ON -Dwith_openmp=OFF .. | ||
make -j20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,30 +3,30 @@ Installing Coek | |
|
||
There are several options for installing Coek: | ||
|
||
* Installing with the top-level ``build_dev.sh`` script. | ||
* Installing with the top-level ``build.sh`` script. | ||
* Install the latest release or development branch using Spack | ||
* Install from source using CMake | ||
|
||
Installing with ``build_dev.sh`` | ||
Installing with ``build.sh`` | ||
-------------------------------- | ||
|
||
Developers will find the top-level ``build_dev.sh`` script useful for setting up a | ||
Developers will find the top-level ``build.sh`` script useful for setting up a | ||
build environment after cloning the Coek repository. Thus, Coek can be installed as follows: | ||
|
||
.. code-block:: bash | ||
git clone [email protected]:sandialabs/coek.git | ||
./build_dev.sh | ||
./build.sh | ||
This script combines many elements of the detailed installation procedures documented below: | ||
|
||
* Dependent packages are installed using Spack into the ``spack`` directory | ||
* Dependent packages are installed using Spack into the ``_spack`` directory | ||
|
||
* Coek is configured to build with Gurobi if the ``GUROBI_HOME`` environment variable is specified | ||
|
||
* Coek is configured to build with Highs and Ipopt. Ipopt is dynamically linked at runtime. | ||
|
||
* Coek is built within the ``build`` directory | ||
* Coek is built within the ``_build`` directory | ||
|
||
Installing with Spack | ||
--------------------- | ||
|
@@ -44,13 +44,13 @@ Coek can be installed using the OR-Fusion clone of Spack: | |
|
||
.. code-block:: bash | ||
git clone [email protected]:or-fusion/spack.git | ||
git clone [email protected]:or-fusion/spack.git _spack | ||
Spack includes scripts that configure the user's shell environment to use Spack commands. For example, you can configure a BASH environment after cloning Spack: | ||
|
||
.. code-block:: bash | ||
. spack/share/spack/setup-env.sh | ||
. _spack/share/spack/setup-env.sh | ||
Creating a Spack Environment | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
@@ -73,7 +73,7 @@ be further customized by the user either directly or via Spack commands. | |
|
||
.. code-block:: bash | ||
spack/var/spack/environments/coekenv/spack.yaml | ||
_spack/var/spack/environments/coekenv/spack.yaml | ||
When done using a Spack environment, you can deactivate the environment with: | ||
|
||
|
@@ -177,8 +177,9 @@ with the standard CMake build steps: | |
.. code-block:: bash | ||
git clone [email protected]:sandialabs/coek.git | ||
mkdir build | ||
cd build | ||
cd coek | ||
mkdir _build | ||
cd _build | ||
cmake .. | ||
make | ||
|
@@ -224,9 +225,9 @@ Coek's CMake configuration includes a deprecated ``install_tpls`` target to buil | |
|
||
.. code-block:: bash | ||
git clone [email protected]:or-fusion/spack.git | ||
cd spack | ||
. spack/share/spack/setup-env.sh | ||
git clone [email protected]:or-fusion/spack.git _spack | ||
cd _spack | ||
. share/spack/setup-env.sh | ||
spack env create coekenv | ||
spack env activate coekenv | ||
spack add cppad fmt rapidjson catch2 | ||
|
@@ -236,12 +237,12 @@ Coek's CMake configuration includes a deprecated ``install_tpls`` target to buil | |
git clone [email protected]:sandialabs/coek.git | ||
cd coek | ||
mkdir build | ||
cd build | ||
cmake -DCMAKE_PREFIX_PATH=`pwd`/../spack/var/spack/environments/coekenv/.spack-env/view -Dwith_python=ON -Dwith_gurobi=ON -Dwith_cppad=ON -Dwith_fmtlib=ON -Dwith_rapidjson=ON -Dwith_tests=ON .. | ||
mkdir _build | ||
cd _build | ||
cmake -DCMAKE_PREFIX_PATH=`pwd`/../_spack/var/spack/environments/coekenv/.spack-env/view -Dwith_python=ON -Dwith_gurobi=ON -Dwith_cppad=ON -Dwith_fmtlib=ON -Dwith_rapidjson=ON -Dwith_tests=ON .. | ||
make -j20 | ||
Coek includes a ``build_dev.sh`` script that executes a variant of this script. | ||
Coek includes a ``build.sh`` script that executes a variant of this script. | ||
|
||
.. note:: | ||
|
||
|