diff --git a/build.bat b/build.bat new file mode 100644 index 0000000000000000000000000000000000000000..a3698176554a3126c6987449aac8e47dc532c009 --- /dev/null +++ b/build.bat @@ -0,0 +1,32 @@ +@echo off + +rem call VsDevCmd.bat + +title Build lib4neuro project + +rem Build type (Release/Debug) +set BUILD_TYPE=Debug +rem Should we rebuild BOOST? (yes/no) +set REBUILD_BOOST=yes + +rem Should we build the examples? (yes/no) +set BUILD_EXAMPLES=yes + +rem Should we build the unit-tests? (yes/no) +set BUILD_TESTS=yes + +rem Should we build the lib4neuro library? (yes) +set BUILD_LIB=yes + +rem C++ compiler +set CXX_COMPILER=cl +set C_COMPILER=cl + +rem Makefile generator +rem For the complete list type "cmake --help" +rem Example: "MSYS Makefiles", "MinGW Makefiles", "NMake Makefiles" +set MAKEFILE_GENERATOR="Visual Studio 15 2017 Win64" + +call clean.bat +cmake -G %MAKEFILE_GENERATOR% -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DCMAKE_CXX_COMPILER=%CXX_COMPILER% -DCMAKE_C_COMPILER=%C_COMPILER% -DBOOST_ROOT=%BOOST_ROOT% -DBOOST_LIBRARYDIR=%BOOST_LIBRARYDIR% -DBOOST_INCLUDEDIR=%BOOST_INCLUDEDIR% -DBUILD_TESTS=%BUILD_TESTS% -DBUILD_EXAMPLES=%BUILD_EXAMPLES% -DBUILD_LIB=%BUILD_LIB% -DLIB4NEURO_DIR=build\lib . +cmake --build . --config %BUILD_TYPE% && (echo (Build complete.); echo (For examples have a look at the folder build/examples.)) || (echo "Build finished with errors!") diff --git a/build.sh b/build.sh new file mode 100755 index 0000000000000000000000000000000000000000..10e2c8f25c7881dd03ad6f21bb3ef52935fb7578 --- /dev/null +++ b/build.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +#------------#------------------------------------------------------------ +# Parameters # +#------------# + +# +# Modular build parameters +# +BUILD_TESTS=yes +BUILD_EXAMPLES=yes +BUILD_LIB=yes + +# Build type (Release/Debug) +BUILD_TYPE=Debug + +# C++ compiler +CXX_COMPILER=g++ +C_COMPILER=gcc + +if [ -z "$BUILD_TYPE" ] || [ -z "$CXX_COMPILER" ]; then + (>&2 echo "Set, please, both BUILD_TYPE and CXX_COMPILER variables in the 'build.sh' script.") + exit 2 +fi + +$(pwd)/clean.sh + +# +# For ExprTk download +# +git submodule init +git submodule update --remote + +cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_CXX_COMPILER=${CXX_COMPILER} -DCMAKE_C_COMPILER=${C_COMPILER} -DBUILD_TESTS=${BUILD_TESTS} -DBUILD_EXAMPLES=${BUILD_EXAMPLES} -DBUILD_LIB=${BUILD_LIB} -DLIB4NEURO_DIR=$(pwd)/build/lib . +cmake --build . --config ${BUILD_TYPE} -- -j${N_CORES} && (tput setaf 2; echo "Build complete."; echo "For examples have a look at the folder build/bin/examples."; tput sgr 0; ) || (tput setaf 1; echo "Build finished with errors!"; tput sgr 0; exit 1;) diff --git a/clean.bat b/clean.bat new file mode 100644 index 0000000000000000000000000000000000000000..3a38f7ba7480439bfdf5219ce748f890c2aa612d --- /dev/null +++ b/clean.bat @@ -0,0 +1,20 @@ +@echo off + +rmdir /s /q build 2>NUL +del Makefile 2>NUL +del /s /q "docs/*" 2>NUL +del "src/*TestRunner*" 2>NUL +del "src/*.o src/*.mod" 2>NUL +del src/funit.tmp 2>NUL +del "src/*_fun.f90" 2>NUL +del CMakeCache.txt 2>NUL +del cmake_install.cmake 2>NUL +del src/cmake_install.cmake 2>NUL +del /s /q CMakeFiles 2>NUL +del "*.vcxproj" 2>NUL +del "*.vcxproj.filters" 2>NUL +del "*.sln" 2>NUL +rmdir /s /q CMakeFiles 2>NUL +rmdir /s /q src/CMakeFiles 2>NUL +rmdir /s /q src/examples/CMakeFiles 2>NUL +rmdir /s /q src/tests/CMakeFiles 2>NUL diff --git a/clean.sh b/clean.sh new file mode 100755 index 0000000000000000000000000000000000000000..3f6c2d69384a9368fd53f590b515d28a074206e5 --- /dev/null +++ b/clean.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +rm -rf build +rm -rf Makefile +rm -rf docs/* +rm -f src/*TestRunner* +rm -f src/*.o src/*.mod +rm -f src/funit.tmp src/*_fun.f90 +rm -f CMakeCache.txt +rm -f cmake_install.cmake src/cmake_install.cmake +rm -rf CMakeFiles src/CMakeFiles src/examples/CMakeFiles src/tests/CMakeFiles