diff --git a/CMakeLists.txt b/CMakeLists.txt index 03e9f8adcd17658eb734fac18f6223ddd9b1b62e..0efc69da8f5e4c805b8e8f4bcd951bf9edbae457 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,8 +20,8 @@ MESSAGE(STATUS "Using CMake ${CMAKE_VERSION}") # Compile for profiling with GProf # - binaries need to be run to create gmon.out file and # 'gprof' command is run subsequently! -ADD_COMPILE_OPTIONS(-pg) -ADD_LINK_OPTIONS(-pg) +#ADD_COMPILE_OPTIONS(-pg) +#ADD_LINK_OPTIONS(-pg) #------------------------------------------# # Detect maximum available number of cores # diff --git a/build.bat b/build.bat index 464dd89820982cd13f1507d8b6c6193a1a90ff44..c3ec4af061af2c005257c9f47d4ce9bdf196dac6 100644 --- a/build.bat +++ b/build.bat @@ -7,4 +7,4 @@ del CMakeCache.txt set CLEAN_AFTER=no set DEPENDENCIES_LINK_TYPE=static -call build_scripts\windows\win_VS_build_x64_release.bat +call build_scripts\windows\win_VS_build_x64_debug.bat diff --git a/build_scripts/windows/win_VS_build_x64_release.bat b/build_scripts/windows/win_VS_build_x64_release.bat index 46d141f7b36a69aa5649483e10fb5c9187df4ec3..29b384f8e61fa5bef7a31617bea4adda9b224fe0 100644 --- a/build_scripts/windows/win_VS_build_x64_release.bat +++ b/build_scripts/windows/win_VS_build_x64_release.bat @@ -1,26 +1,115 @@ @echo off -title Building the 'lib4neuro' project for Release +title Building the 'lib4neuro' project for Debug -set BUILD_SOMETHING_LIB=yes -set BUILD_LIB=yes -set BUILD_TESTS=yes -set BUILD_EXAMPLES=yes +cls + +set "REBUILD_BOOST=" +set "BUILD_EXAMPLES=" +set "BUILD_TESTS=" +set "BUILD_LIB=" +set "BUILD_SOMETHING=" +set "BUILD_SOMETHING_LIB=" rem call VsDevCmd.bat - title Building the 'lib4neuro' project for Release [preparing makefiles] +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/no) +set BUILD_LIB=yes + +rem **********************DO NOT CHANGE BEYOND THIS LINE**************************************** + +set BUILD_SOMETHING=no +set BUILD_SOMETHING_LIB=no + +IF "%BUILD_LIB%"=="yes" ( + echo Lib4neuro build type: Debug + echo Lib4neuro build architecture: x64 + echo Lib4neuro will be built in 'build\lib\' + set BUILD_SOMETHING=yes + set BUILD_SOMETHING_LIB=yes + call win_clean_lib.bat +) + +IF "%BUILD_TESTS%"=="yes" ( + echo Lib4neuro unit tests will be built in 'build\unit-tests' + set BUILD_SOMETHING=yes + set BUILD_SOMETHING_LIB=yes + call win_clean_tests.bat +) + +IF "%BUILD_EXAMPLES%"=="yes" ( + echo Lib4neuro examples will be built in 'build\examples' + set BUILD_SOMETHING=yes + set BUILD_SOMETHING_LIB=yes + call win_clean_examples.bat +) + +IF "%REBUILD_BOOST%"=="yes" ( + echo The required BOOST library will be recompiled in the directory 'external_dependencies\boost' + set BUILD_SOMETHING=yes +) + +IF "%BUILD_SOMETHING%"=="yes" ( + rem pause +) + + +rem Boost rebuild +IF "%REBUILD_BOOST%"=="yes" ( + title Rebuilding 'BOOST' for Debug + cd ..\.. + + rmdir /s /q external_dependencies\boost\stage 2>NUL + rmdir /s /q external_dependencies\boost\bin.v2 2>NUL + + cd external_dependencies\boost + + .\b2 --layout=system variant=debug link=%DEPENDENCIES_LINK_TYPE% address-model=64 --with-system --with-serialization --with-random --with-test || goto error_occured_boost + + cd ..\..\build_scripts\windows +) + +IF "%BUILD_SOMETHING_LIB%"=="yes" ( + title Building the 'lib4neuro' project for Debug [preparing makefiles] rem C++ compiler (Requires Visual Studio 2017) set CXX_COMPILER=cl set C_COMPILER=cl set MAKEFILE_GENERATOR="Visual Studio 15 2017 Win64" - - cmake -G %MAKEFILE_GENERATOR% -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_BUILD_TYPE=Release -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 -DDEPENDENCIES_LINK_TYPE=%LINK_TYPE% -DLIB4NEURO_INCLUDE_DIR=%LIB4NEURO_INCLUDE_DIR% -S . -B build - title Building the 'lib4neuro' project for Release [building] - - call set_env_n_cores.bat - -if "%BUILD_SOMETHING_LIB%" == "yes" ( - cmake --build build -j %N_CORES% --config Release && echo "Build complete." + + cd ..\.. + cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_BUILD_TYPE=Debug -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 -DDEPENDENCIES_LINK_TYPE=%DEPENDENCIES_LINK_TYPE% . || goto error_occured_lib + + title Building the 'lib4neuro' project for Debug [building] + cmake --build . --config Debug && echo "Build complete." || goto error_occured_lib + + cd build_scripts\windows ) +goto final_goto + +:error_occured_lib +cd build_scripts\windows +goto final_goto + +:error_occured_boost +cd ..\..\build_scripts\windows +goto final_goto + + + + + +:final_goto +IF "%BUILD_LIB%"=="yes" call win_clean_after_lib.bat +IF "%BUILD_EXAMPLES%"=="yes" call win_clean_after_examples.bat +IF "%BUILD_TESTS%"=="yes" call win_clean_after_tests.bat +IF "%BUILD_SOMETHING_LIB%"=="yes" call win_clean_garbage.bat diff --git a/src/Reader/Reader.h b/src/Reader/Reader.h index ed6e7a008c220d84e5e1e71828e16a8a77b34f3a..1cdcc0192312c5c7bc053fb38e15dfe77525dbcd 100644 --- a/src/Reader/Reader.h +++ b/src/Reader/Reader.h @@ -9,6 +9,7 @@ #include <string> #include <vector> #include <memory> +#include <algorithm> #include "../settings.h" #include "../DataSet/DataSet.h" diff --git a/src/Reader/XYZReader.h b/src/Reader/XYZReader.h index 4dc37e644b50f775b882fffadde8d61276e9532b..d3d7384a3f7669265ffa45e697af30c1cf0c5716 100644 --- a/src/Reader/XYZReader.h +++ b/src/Reader/XYZReader.h @@ -8,6 +8,7 @@ #include <string> #include <vector> #include <memory> +#include <algorithm> #include "../settings.h" #include "../DataSet/DataSet.h" diff --git a/src/SymmetryFunction/SymmetryFunction.cpp b/src/SymmetryFunction/SymmetryFunction.cpp index 425fbe9e00a5da38eff1eae287bb383769ef2c5f..0d7d74d80f65c5678048062ed8d3fcfc4f9a1b21 100644 --- a/src/SymmetryFunction/SymmetryFunction.cpp +++ b/src/SymmetryFunction/SymmetryFunction.cpp @@ -1,6 +1,7 @@ // // Created by martin on 02.08.19. // +#define _USE_MATH_DEFINES #include <cmath>