diff --git a/build.bat b/build.bat index b52d39b..9350461 100644 --- a/build.bat +++ b/build.bat @@ -1,10 +1,8 @@ @echo off setlocal -if not exist "build_cmake" mkdir "build_cmake" - -set "cleanfirst=--clean-first" -set "cleanfirst=" +set "builddir=build_cmake" +if not exist "%builddir%" mkdir "%builddir%" rem -D CMAKE_BUILD_TYPE=Debug ^ @@ -16,12 +14,12 @@ cmake ^ -D enable-gpu-code=OFF ^ -D enable-cuda=ON ^ -D enable-gpu-double=OFF ^ - -S . -B build_cmake %~1 + -S . -B %builddir% if not "%errorlevel%"=="0" exit /b 1 -cmake --build build_cmake --config Debug %cleanfirst% +cmake --build %builddir% --config Debug %* if not "%errorlevel%"=="0" exit /b 1 -cmake --build build_cmake --config Release %cleanfirst% +cmake --build %builddir% --config Release %* if not "%errorlevel%"=="0" exit /b 1 endlocal diff --git a/compile.sh b/compile.sh new file mode 100644 index 0000000..9f09d43 --- /dev/null +++ b/compile.sh @@ -0,0 +1,48 @@ +#!/bin/sh +# + +# Setup +builddir="build" +if [ ! -d ./${builddir} ]; then mkdir ${builddir}; fi + + +# CLI loop +gen_args="" +bld_args="" +while [ "$1" != "" ] +do + case "$1" in + -c | --clean) + bld_args="${bld_args}--clean-first " + ;; + *) + gen_args="${gen_args}$1 " + esac + shift +done +echo ${gen_args} + + +# Generation +cmake \ + ${gen_args} \ + -D CMAKE_Fortran_COMPILER=gfortran \ + -D BUILD_SHARED_LIBS=OFF \ + -D enable-openmp=ON \ + -D enable-sym-ev-routine=OFF \ + -D enable-single=OFF \ + -D enable-gpu-code=OFF \ + -D enable-cuda=ON \ + -D enable-gpu-double=OFF \ + -S . -B ${builddir} +if [ "$?" != "0" ]; then exit 1; fi + + +# Build +cmake --build ${builddir} --config Debug ${bld_args} +if [ "$?" != "0" ]; then exit 1; fi + +cmake --build ${builddir} --config Release ${bld_args} +if [ "$?" != "0" ]; then exit 1; fi + +