Skip to content
Snippets Groups Projects
Commit 1898ede0 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

comments -> cmake config files

parent b9482dec
No related branches found
No related tags found
No related merge requests found
###########################################################################
# CMakeLists.txt file for building BornAgain framework
# top-level CMakeLists.txt for building BornAgain
############################################################################
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
......@@ -58,4 +58,3 @@ add_subdirectory(cmake) # trick to print the message
# packaging
include(BornAgainCPack)
############################################################################
# CMakeLists.txt file for running functional tests
# FunctionalTests/CMakeLists.txt (called from top-level CMakeLists.txt)
############################################################################
enable_testing()
......@@ -9,15 +9,22 @@ include(CTestCustom)
add_custom_target(check ${CMAKE_CTEST_COMMAND})
# export CTEST_OUTPUT_ON_FAILURE=ON will give some output on failure
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Tests/ReferenceData/BornAgain ${CMAKE_BINARY_DIR}/Tests/ReferenceData/BornAgain)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Tests/FunctionalTests/TestPyCore ${CMAKE_BINARY_DIR}/Tests/FunctionalTests/TestPyCore)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Tests/FunctionalTests/TestPyFit ${CMAKE_BINARY_DIR}/Tests/FunctionalTests/TestPyFit)
execute_process( COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/Tests/ReferenceData/BornAgain
${CMAKE_BINARY_DIR}/Tests/ReferenceData/BornAgain )
execute_process( COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/Tests/FunctionalTests/TestPyCore
${CMAKE_BINARY_DIR}/Tests/FunctionalTests/TestPyCore )
execute_process( COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/Tests/FunctionalTests/TestPyFit
${CMAKE_BINARY_DIR}/Tests/FunctionalTests/TestPyFit )
#file(COPY ${CMAKE_SOURCE_DIR}/Tests/FunctionalTests/TestPyFit DESTINATION ${CMAKE_BINARY_DIR}/Tests/FunctionalTests/TestPyFit)
#COPY_IF_DIFFERENT( ${CMAKE_SOURCE_DIR}/Tests/FunctionalTests/TestPyFit ${CMAKE_BINARY_DIR}/Tests/FunctionalTests/TestPyFit ${SRC_FILES} IncludeTargets "Includes")
add_subdirectory(TestCore)
add_subdirectory(TestFit)
if(BORNAGAIN_PYTHON)
add_subdirectory(TestPyCore)
add_subdirectory(TestPyFit)
......@@ -26,4 +33,3 @@ endif()
if(BORNAGAIN_GUI)
add_subdirectory(TestGUI)
endif()
############################################################################
# CMakeLists.txt file for building TestCore functional tests
# FunctionalTests/TestCore/CMakeLists.txt
############################################################################
include_directories(
......@@ -63,17 +63,17 @@ set(list_of_tests
)
# Adding executables.
get_list_of_executables_from_list_of_tests("${list_of_tests}" ${list_of_executables})
# Adding executables (using macros defined in BornAgainMacros.cmake):
GET_LIST_OF_EXECUTABLES_FROM_LIST_OF_TESTS("${list_of_tests}" ${list_of_executables})
foreach(test_exe_name ${list_of_executables})
BORNAGAIN_EXECUTABLE(${test_exe_name} LOCATIONS ${test_exe_name} EXCLUDE_FROM_ALL LIBRARIES ${BornAgainCore_LIBRARY})
BORNAGAIN_EXECUTABLE(
${test_exe_name} LOCATIONS ${test_exe_name}
EXCLUDE_FROM_ALL LIBRARIES ${BornAgainCore_LIBRARY}
)
endforeach()
# Adding tests
# Adding tests (using macros defined in BornAgainMacros.cmake):
foreach(_test ${list_of_tests})
get_test_name_and_argument(${_test} ${test_exe_name} ${test_argument})
GET_TEST_NAME_AND_ARGUMENT(${_test} ${test_exe_name} ${test_argument})
BORNAGAIN_ADD_TEST(${_test} ${test_exe_name} TEST_ARGUMENTS ${test_argument})
endforeach()
# --- Collection of scripts for BornAgain CMake infrastructure
############################################################################
# Collection of macros/functions for BornAgain CMake infrastructure
############################################################################
# Returns the list of unique executables from the list of functional tests
# Usage:
# set(list_of_tests "exe1/arg1" "exe1/arg2" "exe1/arg3" "exe2" "exe4/arg1")
# get_list_of_executables_from_list_of_tests("${list_of_tests}" ${list_of_executables})
#
# set(list_of_tests "exe1/arg1" "exe1/arg2" "exe1/arg3" "exe2" "exe4/arg1")
# get_list_of_executables_from_list_of_tests("${list_of_tests}" ${list_of_executables})
# Result:
# list_of_executables will be "exe1;exe2;exe3;exe4"
# list_of_executables will be "exe1;exe2;exe3;exe4"
macro(get_list_of_executables_from_list_of_tests list_of_tests)
foreach(_test ${list_of_tests})
string(REPLACE "/" ";" test_info ${_test})
......@@ -21,10 +22,11 @@ endmacro()
# Parse string containing test info into test name and test argument
# Usage:
# set(test_string "CoreSuite/CylindersAndPrisms")
# get_test_name_and_argument(${test_string} ${test_exe_name} ${test_argument})
#
# Result: test_exe_name will be "CoreSuite", test_argument will be CylindersAndPrisms
# set(test_string "CoreSuite/CylindersAndPrisms")
# get_test_name_and_argument(${test_string} ${test_exe_name} ${test_argument})
# Result:
# test_exe_name will be "CoreSuite",
# test_argument will be CylindersAndPrisms
macro(get_test_name_and_argument _test_string)
unset(_test_exe_name)
......@@ -51,7 +53,7 @@ function(BORNAGAIN_EXECUTABLE executable)
file(GLOB source_files ${ARG_LOCATIONS}/*.cpp)
# making executable
if(${ARG_EXCLUDE_FROM_ALL})
if(${ARG_EXCLUDE_FROM_ALL})
add_executable(${executable} EXCLUDE_FROM_ALL ${source_files} )
else()
add_executable(${executable} ${ARG_UNPARSED_ARGUMENTS} )
......@@ -59,7 +61,7 @@ function(BORNAGAIN_EXECUTABLE executable)
# linking libraries from the list
foreach(_libname ${ARG_LIBRARIES})
include_directories(${${_libname}_INCLUDE_DIRS})
target_link_libraries(${executable} ${_libname})
target_link_libraries(${executable} ${_libname})
endforeach()
endfunction()
......@@ -211,10 +213,3 @@ print(s.get_config_var('LDVERSION') or s.get_config_var('VERSION'));
# set(ALT_PYTHON_VERSION_STRING ${ALT_PYTHON_VERSION_STRING} PARENT_SCOPE)
# set(ALT_PYTHON_INCLUDE_DIRS ${ALT_PYTHON_INCLUDE_DIRS} PARENT_SCOPE)
endfunction()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment