diff --git a/CMakeLists.txt b/CMakeLists.txt index ee49ecb7bd82cd55c55f29380e8b2e81965e9eed..11a3b9ad823a97309e88a464c2cdc38ba0abd8fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,6 @@ if(ZERO_TOLERANCE) endif() include(BornAgainConfiguration) include(GeneratePythonDocs) -include(GoogletestWrapper) include(PyExamplesLineLength) include(CheckCode) diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt index 8bdd4d2af4363c30cea859ecb9e4229ec2e0331e..caa7bcda1d8d98b63bad721d13d0e8fd410f800b 100644 --- a/Core/CMakeLists.txt +++ b/Core/CMakeLists.txt @@ -9,32 +9,19 @@ if(POLICY CMP0042) endif() # --- source and include files --------- -set(CORE_SOURCE_DIRS - ${CMAKE_CURRENT_SOURCE_DIR}/Aggregate - ${CMAKE_CURRENT_SOURCE_DIR}/Basics - ${CMAKE_CURRENT_SOURCE_DIR}/Binning - ${CMAKE_CURRENT_SOURCE_DIR}/Export - ${CMAKE_CURRENT_SOURCE_DIR}/Fitting - ${CMAKE_CURRENT_SOURCE_DIR}/FormFactor - ${CMAKE_CURRENT_SOURCE_DIR}/InputOutput - ${CMAKE_CURRENT_SOURCE_DIR}/Instrument - ${CMAKE_CURRENT_SOURCE_DIR}/HardParticle - ${CMAKE_CURRENT_SOURCE_DIR}/Lattice - ${CMAKE_CURRENT_SOURCE_DIR}/Material - ${CMAKE_CURRENT_SOURCE_DIR}/Mask - ${CMAKE_CURRENT_SOURCE_DIR}/Multilayer - ${CMAKE_CURRENT_SOURCE_DIR}/Parametrization - ${CMAKE_CURRENT_SOURCE_DIR}/Particle - ${CMAKE_CURRENT_SOURCE_DIR}/Rotation - ${CMAKE_CURRENT_SOURCE_DIR}/Sample - ${CMAKE_CURRENT_SOURCE_DIR}/Simulation - ${CMAKE_CURRENT_SOURCE_DIR}/SoftParticle - ${CMAKE_CURRENT_SOURCE_DIR}/StandardSamples - ${CMAKE_CURRENT_SOURCE_DIR}/Tools - ${CMAKE_CURRENT_SOURCE_DIR}/Vector - ) + +include(GlobDirectories) +GLOB_DIRECTORIES(CORE_SUBDIRS) + +set(CORE_SOURCE_DIRS "") +foreach(subdir ${CORE_SUBDIRS}) + list(APPEND CORE_SOURCE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/${subdir}") +endforeach() + # export for use in functional tests: set(CORE_SOURCE_DIRS ${CORE_SOURCE_DIRS} ${EIGEN3_INCLUDE_DIR} PARENT_SCOPE) +# export for use in unit tests: +set(CORE_SUBDIRS ${CORE_SUBDIRS} PARENT_SCOPE) set(include_dirs ${BUILD_INC_DIR} diff --git a/Core/Instrument/OutputData.h b/Core/Instrument/OutputData.h index 490d46305c65d30b15045ada165371f919f9e3f7..c1889bb29caee544718458764319cb62c518ed56 100644 --- a/Core/Instrument/OutputData.h +++ b/Core/Instrument/OutputData.h @@ -20,6 +20,9 @@ #include "LLData.h" #include "OutputDataIterator.h" #include "SafePointerVector.h" +#include "ThreadInfo.h" +#include <sstream> +#include <cassert> #ifdef BORNAGAIN_PYTHON #ifndef PyObject_HEAD @@ -28,14 +31,6 @@ typedef _object PyObject; #endif #endif -#include "FixedBinAxis.h" -#include "LLData.h" -#include "OutputDataIterator.h" -#include "SafePointerVector.h" -#include "ThreadInfo.h" -#include <sstream> -#include <cassert> - using std::size_t; //! @class OutputData diff --git a/Tests/UnitTests/Core/1/LayerTest.h b/Tests/UnitTests/Core/1/LayerTest.h index f5e639ce490dbc115b2e660efa473e4b5f5f2fb5..0ff47e507e0be5509a7c86e15842ab209bf0366d 100644 --- a/Tests/UnitTests/Core/1/LayerTest.h +++ b/Tests/UnitTests/Core/1/LayerTest.h @@ -12,7 +12,6 @@ class LayerTest : public ::testing::Test protected: LayerTest(){} virtual ~LayerTest(){} - }; diff --git a/Tests/UnitTests/Core/2/MatrixRTCoefficientsTest.h b/Tests/UnitTests/Core/2/MatrixRTCoefficientsTest.h index 760e0bfc7f636a6e1c98f2a5251e5fee4ebd9dec..0d4456f9439247a8f054e458a1bd760a3c71742a 100644 --- a/Tests/UnitTests/Core/2/MatrixRTCoefficientsTest.h +++ b/Tests/UnitTests/Core/2/MatrixRTCoefficientsTest.h @@ -3,7 +3,6 @@ #include "MatrixRTCoefficients.h" - class MatrixRTCoefficientsTest : public ::testing :: Test { protected: @@ -15,7 +14,6 @@ protected: MatrixRTCoefficientsTest::MatrixRTCoefficientsTest() { - } TEST_F(MatrixRTCoefficientsTest, T1plus) diff --git a/Tests/UnitTests/Core/CMakeLists.txt b/Tests/UnitTests/Core/CMakeLists.txt index a9bcbe7ce70bf07f2de3b3025a21d4c875b5c7be..f94389c2ab1cdf7c2f740a5924389ff09cf7add1 100644 --- a/Tests/UnitTests/Core/CMakeLists.txt +++ b/Tests/UnitTests/Core/CMakeLists.txt @@ -2,14 +2,22 @@ # CMakeLists.txt file for building and running unit tests ############################################################################ +include(GoogletestWrapper) + +# qtcreator prefers relative paths for project includes +foreach(subdir ${CORE_SUBDIRS}) + include_directories(../../../Core/${subdir}) +endforeach() include_directories( - ${BornAgainCore_INCLUDE_DIRS} + ../../../Fit/Utils + ../../../Fit/Parameters + ../utilities/ ${Boost_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIR} ${GSL_INCLUDE_DIR} - ../utilities/ - ) - + ${gtest_SOURCE_DIR} + ${gtest_SOURCE_DIR}/include + ) if(BORNAGAIN_OPENMPI) include_directories(${MPI_INCLUDE_PATH}) endif() diff --git a/cmake/bornagain/modules/GoogletestWrapper.cmake b/cmake/bornagain/modules/GoogletestWrapper.cmake index bb2f4e7dc2425109a3050ba4c66ed119b2d61d03..1c79b22e1f705ceab1fcfd35b7d75daa12e65176 100644 --- a/cmake/bornagain/modules/GoogletestWrapper.cmake +++ b/cmake/bornagain/modules/GoogletestWrapper.cmake @@ -19,7 +19,6 @@ # STAGE=1: test run upon "ctest"="make check" function(WRAP_GTEST TEST_NAME GLOBPATTERN LINK_LIBS STAGE) - include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR}) file(GLOB INCLUDE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${GLOBPATTERN}) list(SORT INCLUDE_FILES) diff --git a/cmake/generic/modules/GlobDirectories.cmake b/cmake/generic/modules/GlobDirectories.cmake new file mode 100644 index 0000000000000000000000000000000000000000..cdf3381cc30ce47da84ecf1c335b3744c973bce3 --- /dev/null +++ b/cmake/generic/modules/GlobDirectories.cmake @@ -0,0 +1,10 @@ +MACRO(GLOB_DIRECTORIES result) + FILE(GLOB children RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *) + SET(dirlist "") + FOREACH(child ${children}) + IF(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${child}) + LIST(APPEND dirlist ${child}) + ENDIF() + ENDFOREACH() + SET(${result} ${dirlist}) +ENDMACRO()