diff --git a/Core/Algorithms/inc/FTDistributions.h b/Core/Algorithms/inc/FTDistributions.h index 05165c6462dfccdc8d3402d37653e6458f184a71..6e2d5265e919f1b3c941d47653faa4b07fd0b82e 100644 --- a/Core/Algorithms/inc/FTDistributions.h +++ b/Core/Algorithms/inc/FTDistributions.h @@ -20,6 +20,8 @@ #include "IParameterized.h" #include <cmath> +#include "Numeric.h" + class IFTDistribution1D { public: diff --git a/Core/Core.pro b/Core/Core.pro index 3229acd0d3df1f398151803833b6c412227682db..6b89a29ea71ed3dd088498144d758e565e47094e 100644 --- a/Core/Core.pro +++ b/Core/Core.pro @@ -3,9 +3,9 @@ # ----------------------------------------------------------------------------- TARGET = BornAgainCore TEMPLATE = lib -CONFIG += plugin # to remove versions from file name +CONFIG += lib # to remove versions from file name QT -= core gui -QMAKE_EXTENSION_SHLIB = so # making standard *.so extension +#QMAKE_EXTENSION_SHLIB = so # making standard *.so extension #CONFIG += BORNAGAIN_PYTHON # ----------------------------------------------------------------------------- @@ -349,5 +349,5 @@ CONFIG(debug, debug|release) { target.path = $$PWD/../lib INSTALLS += target QMAKE_DISTCLEAN += $$target.path/$(TARGET) -QMAKE_POST_LINK = (make install) +QMAKE_POST_LINK = $$MAKE_COMMAND -f $(MAKEFILE) install diff --git a/Core/Geometry/inc/BasicVector3D.h b/Core/Geometry/inc/BasicVector3D.h index 36b9dd335cb958981f72f0c5f13fe4b0ed3c9f26..ba8f70bdd073a5086d5b2877498d1e434a91eea0 100644 --- a/Core/Geometry/inc/BasicVector3D.h +++ b/Core/Geometry/inc/BasicVector3D.h @@ -21,7 +21,7 @@ #ifndef GEOMETRY_BASICVECTOR3D_H #define GEOMETRY_BASICVECTOR3D_H -#include <cmath> +#include "Numeric.h" #include <complex> namespace Geometry { diff --git a/Core/Tools/inc/Numeric.h b/Core/Tools/inc/Numeric.h index f631778cd1ef55f76f22180a76f83662269e77bb..25cc3893c2fda3d6c74278ddee6f68732948a2b1 100644 --- a/Core/Tools/inc/Numeric.h +++ b/Core/Tools/inc/Numeric.h @@ -21,6 +21,10 @@ //! Floating-point epsilon, tolerances, almost-equal. +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + namespace Numeric { static const double required_precision = 1.e-4; diff --git a/Core/Tools/src/Utils.cpp b/Core/Tools/src/Utils.cpp index ef5c18931fe6670f908e89f7d04d952a5646901f..4ae7c02d18bfd526de1176069d77f235764b7e13 100644 --- a/Core/Tools/src/Utils.cpp +++ b/Core/Tools/src/Utils.cpp @@ -185,7 +185,7 @@ void Utils::EnableFloatingPointExceptions() #ifdef DEBUG_FPE std::cout << "Utils::EnableFloatingPointExceptions() -> Enabling floating point exception debugging" << std::endl; - feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); +// NOT CROSS-PLATFORM!!! feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); // feenableexcept(-1); #else std::cout << "Utils::EnableFloatingPointExceptions() -> Can't enable floating point exceptions. Available in debug mode only." diff --git a/Tests/UnitTests/TestCore/TestCore.pro b/Tests/UnitTests/TestCore/TestCore.pro index 8822bea142ff9ebdce70eadd24ad06b6be1f188e..8ba850b5af6a299803b87b0a5c413780dc6b0a29 100644 --- a/Tests/UnitTests/TestCore/TestCore.pro +++ b/Tests/UnitTests/TestCore/TestCore.pro @@ -7,7 +7,7 @@ CONFIG += console build_all QT -= core gui # including common project properties -include($$PWD/../../../shared.pri) +include(../../../shared.pri) SOURCES += main.cpp @@ -41,7 +41,6 @@ INCLUDEPATH += $${PWD}/../../../ThirdParty/gtest/gtest-1.6.0/include ############################################################################### MY_DEPENDENCY_LIB = gtest BornAgainCore MY_DEPENDENCY_DEST =$$PWD/../../.. -SONAME = so # INCLUDEPATH += $${MY_DEPENDENCY_DEST}/inc for(dep, MY_DEPENDENCY_LIB) { LIBS += $${MY_DEPENDENCY_DEST}/lib/lib$${dep}.$${SONAME} @@ -52,4 +51,4 @@ for(dep, MY_DEPENDENCY_LIB) { ############################################################################### # runs automatically tests right after linking ############################################################################### -QMAKE_POST_LINK = $$PWD/$(TARGET) 2> /dev/null +QMAKE_POST_LINK = $$PWD/$(DESTDIR_TARGET) diff --git a/ThirdParty/gtest/gtest.pro b/ThirdParty/gtest/gtest.pro index e990955bff5c7ad665cc9934402e00e776bf953c..60345c6b8f466ee76aef0fa16a71c72e0f8333f1 100644 --- a/ThirdParty/gtest/gtest.pro +++ b/ThirdParty/gtest/gtest.pro @@ -3,12 +3,12 @@ ############################################################################### TARGET = gtest TEMPLATE = lib -CONFIG += lib plugin +CONFIG += lib #plugin QT -= gui core -QMAKE_EXTENSION_SHLIB = so +#QMAKE_EXTENSION_SHLIB = so -include($$PWD/../../shared.pri) +include(../../shared.pri) mygtest = gtest-1.6.0 @@ -16,17 +16,17 @@ INCLUDEPATH += $$mygtest/include INCLUDEPATH += $$mygtest SOURCES += \ - ./$$mygtest/src/gtest-all.cc + $$PWD/$$mygtest/src/gtest-all.cc HEADERS += \ - ./$$mygtest/src/gtest-internal-inl.h + $$PWD/$$mygtest/src/gtest-internal-inl.h OBJECTS_DIR = obj ############################################################################### # Installing library into dedicated directory at the end of compilation ############################################################################### -MYPREFIX = $$PWD/../.. # place to install library +MYPREFIX = ../.. # place to install library target.path = $$MYPREFIX/lib INSTALLS += target ##includes.files = $$mygtest/include/gtest/*.h @@ -40,5 +40,4 @@ INSTALLS += target #QMAKE_DISTCLEAN += -r $$includes.path/gtest QMAKE_DISTCLEAN += $$target.path/$(TARGET) -QMAKE_POST_LINK = (make install) - +QMAKE_POST_LINK = $$MAKE_COMMAND -f $(MAKEFILE) install diff --git a/shared.pri b/shared.pri index e8624c29bb2cfebbaeafcf45b6cbae1144ff1f5b..7fae9ac249cf75202ac94cd7f9931c334c4950d1 100644 --- a/shared.pri +++ b/shared.pri @@ -1,3 +1,12 @@ +win32 { + MAKE_COMMAND = mingw32-make + SONAME = a +} +macx|unix { + MAKE_COMMAND = make + SONAME = so +} + # ----------------------------------------------------------------------------- # checking common prerequisites # ----------------------------------------------------------------------------- @@ -5,7 +14,7 @@ lessThan(QT_VERSION, 4.5) { error("BornAgain requires Qt 4.5 or greater") } -!macx:!unix { +!macx:!unix:!win32 { error("Unknown operation system") } @@ -25,7 +34,12 @@ isEqual(env_debug_variable, "yes") { # --- checking gsl header --- GSL_HEADERFILE = gsl/gsl_sf_bessel.h -GSL_HEADER_LOCATIONS = /opt/local/include /usr/local/include /usr/include +macx|unix { + GSL_HEADER_LOCATIONS = /opt/local/include /usr/local/include /usr/include +} +win32 { + GSL_HEADER_LOCATIONS = "C:/Program Files (x86)/GnuWin32/include" +} for(dir, GSL_HEADER_LOCATIONS): isEmpty(GSL_INCLUDE): exists($${dir}/$${GSL_HEADERFILE}): GSL_INCLUDE = $${dir} isEmpty(GSL_INCLUDE): message("Can't find" $${GSL_HEADERFILE} "in" $${GSL_HEADER_LOCATIONS}) GSL_LIB = $$replace(GSL_INCLUDE,"include","lib") @@ -42,7 +56,12 @@ INCLUDEPATH *= $${EIGEN_INCLUDE} # --- checking fftw3 --- FFTW3_HEADERFILE = fftw3.h -FFTW3_HEADER_LOCATIONS = /opt/local/include /usr/local/include /usr/include +macx|unix { + FFTW3_HEADER_LOCATIONS = /opt/local/include /usr/local/include /usr/include +} +win32 { + FFTW3_HEADER_LOCATIONS = "C:/Program Files (x86)/Libraries/fftw-3.3.3-dll32/include" +} for(dir, FFTW3_HEADER_LOCATIONS): isEmpty(FFTW3_INCLUDE): exists($${dir}/$${FFTW3_HEADERFILE}): FFTW3_INCLUDE = $${dir} isEmpty(FFTW3_INCLUDE): message("Can't find" $${FFTW3_HEADERFILE} "in" $${FFTW3_HEADER_LOCATIONS}) FFTW3_LIB = $$replace(FFTW3_INCLUDE,"include","lib") @@ -52,24 +71,37 @@ LIBS += -lfftw3 # --- checking boost --- BOOST_HEADERFILE = boost/version.hpp -BOOST_HEADER_LOCATIONS = /opt/local/include /usr/local/include /usr/include +macx|unix { + BOOST_HEADER_LOCATIONS = /opt/local/include /usr/local/include /usr/include +} +win32 { + BOOST_HEADER_LOCATIONS = "C:/Boost/include" +} for(dir, BOOST_HEADER_LOCATIONS): isEmpty(BOOST_INCLUDE): exists($${dir}/$${BOOST_HEADERFILE}): BOOST_INCLUDE = $${dir} isEmpty(BOOST_INCLUDE): message("Can't find" $${BOOST_HEADERFILE} "in" $${BOOST_HEADER_LOCATIONS}) BOOST_LIBFILES = libboost* -BOOST_LIB_LOCATIONS = /opt/local/lib /usr/local/lib /usr/lib64 /usr/lib -for(dir, BOOST_LIB_LOCATIONS): isEmpty(BOOST_LIB) { - NumberOfSuchFiles=$$system(ls $${dir}/$${BOOST_LIBFILES} 2> /dev/null | wc -l) - !isEqual(NumberOfSuchFiles, 0): BOOST_LIB = $${dir} +# following check only works on *nix systems +macx|unix { + BOOST_LIB_LOCATIONS = /opt/local/lib /usr/local/lib /usr/lib64 /usr/lib + for(dir, BOOST_LIB_LOCATIONS): isEmpty(BOOST_LIB) { + NumberOfSuchFiles=$$system(ls $${dir}/$${BOOST_LIBFILES} 2> /dev/null | wc -l) + !isEqual(NumberOfSuchFiles, 0): BOOST_LIB = $${dir} + } +} +win32 { + BOOST_LIB = "C:/Boost/lib" } isEmpty(BOOST_LIB): message("Can't find" $${BOOST_LIBFILES} "in" $${BOOST_LIB_LOCATIONS}) INCLUDEPATH *= $${BOOST_INCLUDE} LIBS *= -L$${BOOST_LIB} LIBS += -lboost_program_options -lboost_iostreams -lboost_system -lboost_signals -lboost_filesystem -lboost_regex -lboost_thread -# checking special case when system doesn't have libboost_thread library but have libbost_thread-mt -NumberOfSuchFiles=$$system(ls $${BOOST_LIB}/libboost_thread-mt* 2> /dev/null | wc -l) -!isEqual(NumberOfSuchFiles, 0) { - # library libboost_thread-mt exists - LIBS = $$replace(LIBS, "-lboost_thread", "-lboost_thread-mt") +# checking special case when system doesn't have libboost_thread library but have libboost_thread-mt +!win32 { + NumberOfSuchFiles=$$system(ls $${BOOST_LIB}/libboost_thread-mt* 2> /dev/null | wc -l) + !isEqual(NumberOfSuchFiles, 0) { + # library libboost_thread-mt exists + LIBS = $$replace(LIBS, "-lboost_thread", "-lboost_thread-mt") + } } isEmpty(GSL_INCLUDE): error("missed dependency:" $${GSL_HEADERFILE}) diff --git a/windlls/libboost_filesystem-mgw47-1_53.dll b/windlls/libboost_filesystem-mgw47-1_53.dll new file mode 100644 index 0000000000000000000000000000000000000000..5f4cfc156884773cc3da527f14855aa2c8b3216c Binary files /dev/null and b/windlls/libboost_filesystem-mgw47-1_53.dll differ diff --git a/windlls/libboost_iostreams-mgw47-1_53.dll b/windlls/libboost_iostreams-mgw47-1_53.dll new file mode 100644 index 0000000000000000000000000000000000000000..db6b7ed0e0571e7b5cf0ac889a77368842be202a Binary files /dev/null and b/windlls/libboost_iostreams-mgw47-1_53.dll differ diff --git a/windlls/libboost_program_options-mgw47-1_53.dll b/windlls/libboost_program_options-mgw47-1_53.dll new file mode 100644 index 0000000000000000000000000000000000000000..a658cba9337535ddfbe523133f68174973a9c3e6 Binary files /dev/null and b/windlls/libboost_program_options-mgw47-1_53.dll differ diff --git a/windlls/libboost_regex-mgw47-1_53.dll b/windlls/libboost_regex-mgw47-1_53.dll new file mode 100644 index 0000000000000000000000000000000000000000..fa29d7f6462f4fd701f86530bf9dce299bb8c894 Binary files /dev/null and b/windlls/libboost_regex-mgw47-1_53.dll differ diff --git a/windlls/libboost_system-mgw47-1_53.dll b/windlls/libboost_system-mgw47-1_53.dll new file mode 100644 index 0000000000000000000000000000000000000000..8ec8320c6844bb7e8dceeeba3cb49e4a22a0be33 Binary files /dev/null and b/windlls/libboost_system-mgw47-1_53.dll differ diff --git a/windlls/libboost_system-mgw47-mt-1_53.dll b/windlls/libboost_system-mgw47-mt-1_53.dll new file mode 100644 index 0000000000000000000000000000000000000000..0f8ac07986a3893cb33f5c5db91be0aad7bf3950 Binary files /dev/null and b/windlls/libboost_system-mgw47-mt-1_53.dll differ diff --git a/windlls/libboost_thread-mgw47-mt-1_53.dll b/windlls/libboost_thread-mgw47-mt-1_53.dll new file mode 100644 index 0000000000000000000000000000000000000000..84833a88a118cec0b4b7a0eeac0f2847b372d02d Binary files /dev/null and b/windlls/libboost_thread-mgw47-mt-1_53.dll differ diff --git a/windlls/libboost_zlib-mgw47-1_53.dll b/windlls/libboost_zlib-mgw47-1_53.dll new file mode 100644 index 0000000000000000000000000000000000000000..26b64b8c861e2f7a25ff0daaace981e1a81f66e5 Binary files /dev/null and b/windlls/libboost_zlib-mgw47-1_53.dll differ diff --git a/windlls/libfftw3-3.dll b/windlls/libfftw3-3.dll new file mode 100644 index 0000000000000000000000000000000000000000..a8f033a1133598efb7536b0580306717a98cc13f Binary files /dev/null and b/windlls/libfftw3-3.dll differ diff --git a/windlls/libgsl.dll b/windlls/libgsl.dll new file mode 100644 index 0000000000000000000000000000000000000000..a1684cedd742401573efa78954aa3b56a994bff3 Binary files /dev/null and b/windlls/libgsl.dll differ diff --git a/windlls/libgslcblas.dll b/windlls/libgslcblas.dll new file mode 100644 index 0000000000000000000000000000000000000000..71a43a523862aa1bd69ac3eac8420fafbf875fb2 Binary files /dev/null and b/windlls/libgslcblas.dll differ