Skip to content

Instantly share code, notes, and snippets.

@ahundt
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahundt/9513639 to your computer and use it in GitHub Desktop.
Save ahundt/9513639 to your computer and use it in GitHub Desktop.
script that executes the basis quick start steps automatically
set -e
# Demo script:
#clone BASIS (or basis template?)
export START=`pwd`
# build basis
echo "
############################################
# Clone BASIS
############################################
"
mkdir -p ${START}/demobasis/src
cd ${START}/demobasis/src
git clone https://github.com/schuhschuh/cmake-basis.git
cd cmake-basis
# begin temporary workaround until after 3.1 release:
git fetch
git checkout develop
# end temporary workaround until after 3.1 release
echo "
############################################
# Build and Install BASIS
############################################
"
mkdir build && cd build
cmake .. -GNinja -DCMAKE_INSTALL_PREFIX=${START}/demobasis -DBUILD_EXAMPLE=ON
ninja install
echo "
############################################
# Set variables to simplify later steps
############################################
"
export PATH="${START}/demobasis/bin:${PATH} "
export BASIS_EXAMPLE_DIR="${START}/demobasis/share/basis/example"
export HELLOBASIS_RSC_DIR="${BASIS_EXAMPLE_DIR}/hellobasis"
echo "
############################################
# Create a BASIS project
############################################
"
basisproject create --name HelloBasis --description "This is a BASIS project." --root ${START}/demobasis/src/hellobasis --full
echo "
############################################
# Add an Executable
############################################
"
cd ${START}/demobasis/src/hellobasis
cp ${HELLOBASIS_RSC_DIR}/helloc++.cxx src/
echo "
basis_add_executable(helloc++.cxx)
" >> src/CMakeLists.txt
echo "
############################################
# Add a private Library
############################################
"
cd ${START}/demobasis/src/hellobasis
cp ${HELLOBASIS_RSC_DIR}/foo.* src/
echo "
basis_add_library(foo.cxx)
" >> src/CMakeLists.txt
echo "
############################################
# Add a public Library
############################################
"
cd ${START}/demobasis/src/hellobasis
mkdir include/hellobasis
echo "
basis_add_library(bar.cxx)
" >> src/CMakeLists.txt
cp ${HELLOBASIS_RSC_DIR}/bar.cxx src/
cp ${HELLOBASIS_RSC_DIR}/bar.h include/hellobasis/
cd ${START}/demobasis/src/
echo "
############################################
# Compile
############################################
"
mkdir ${START}/demobasis/src/hellobasis/build
cd ${START}/demobasis/src/hellobasis/build
cmake -GNinja -DBUILD_DOCUMENTATION=ON -D CMAKE_INSTALL_PREFIX=${START}/demobasis ..
ninja
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment