From 35527b7fe6bd85a9e49f8a41399d184893145d21 Mon Sep 17 00:00:00 2001 From: maier Date: Sat, 26 Oct 2013 09:48:13 +0000 Subject: [PATCH] CMake: Simplify cross compilation stuff and documentation git-svn-id: https://svn.dealii.org/trunk@31433 0785d39b-7218-0410-832d-ea1e28bc413d --- .../macros/macro_expand_instantiations.cmake | 7 +++++- deal.II/cmake/scripts/CMakeLists.txt | 8 ------- deal.II/cmake/setup_deal_ii.cmake | 21 ++++------------- deal.II/doc/developers/porting.html | 23 ++++++++++--------- deal.II/doc/developers/testsuite.html | 22 ++++++++++-------- 5 files changed, 35 insertions(+), 46 deletions(-) diff --git a/deal.II/cmake/macros/macro_expand_instantiations.cmake b/deal.II/cmake/macros/macro_expand_instantiations.cmake index 684860d475..9574b0fab8 100644 --- a/deal.II/cmake/macros/macro_expand_instantiations.cmake +++ b/deal.II/cmake/macros/macro_expand_instantiations.cmake @@ -38,9 +38,14 @@ MACRO(EXPAND_INSTANTIATIONS _target _inst_in_files) FOREACH (_inst_in_file ${_inst_in_files}) STRING(REGEX REPLACE "\\.in$" "" _inst_file "${_inst_in_file}" ) + SET(_dependency) + IF(TARGET expand_instantiations) + SET(_dependency expand_instantiations) + ENDIF() + ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_inst_file} - DEPENDS expand_instantiations + DEPENDS ${_dependency} ${CMAKE_BINARY_DIR}/${DEAL_II_COMMON_RELDIR}/template-arguments ${CMAKE_CURRENT_SOURCE_DIR}/${_inst_in_file} COMMAND expand_instantiations diff --git a/deal.II/cmake/scripts/CMakeLists.txt b/deal.II/cmake/scripts/CMakeLists.txt index 6e000ece9b..6341917a7a 100644 --- a/deal.II/cmake/scripts/CMakeLists.txt +++ b/deal.II/cmake/scripts/CMakeLists.txt @@ -26,10 +26,6 @@ IF(NOT CMAKE_CROSSCOMPILING) COMPONENT compat_files ) ENDIF() - - EXPORT(TARGETS expand_instantiations - FILE ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Executables.cmake - ) ENDIF() IF(DEAL_II_COMPONENT_COMPAT_FILES) @@ -96,8 +92,4 @@ IF(DEAL_II_COMPONENT_COMPAT_FILES) DESTINATION ${DEAL_II_COMMON_RELDIR}/scripts COMPONENT compat_files ) - EXPORT(TARGETS make_dependencies report_features - FILE ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Executables.cmake - APPEND - ) ENDIF() diff --git a/deal.II/cmake/setup_deal_ii.cmake b/deal.II/cmake/setup_deal_ii.cmake index 0e5a93301b..777c066931 100644 --- a/deal.II/cmake/setup_deal_ii.cmake +++ b/deal.II/cmake/setup_deal_ii.cmake @@ -141,30 +141,17 @@ ENDIF() # # ######################################################################## -# -# Library search order: -# IF(DEAL_II_PREFER_STATIC_LIBS) + # # Invert the search order for libraries when DEAL_II_PREFER_STATIC_LIBS # is set. This will prefer static archives instead of shared libraries: + # LIST(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES) ENDIF() -# -# Cross compilation stuff: -# IF(CMAKE_CROSSCOMPILING) + # # Disable platform introspection when cross compiling + # SET(DEAL_II_ALLOW_PLATFORM_INTROSPECTION OFF CACHE BOOL "" FORCE) - - # Import native expand_instantiations for use in cross compilation: - SET(DEAL_II_NATIVE "DEAL_II_NATIVE-NOTFOUND" CACHE FILEPATH - "A pointer to a native deal.Ii build directory" - ) - IF(DEAL_II_NATIVE MATCHES "-NOTFOUND") - MESSAGE(FATAL_ERROR - "Please set the CMake variable DEAL_II_NATIVE to a valid path that points to a native deal.II build directory" - ) - ENDIF() - INCLUDE(${DEAL_II_NATIVE}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Executables.cmake) ENDIF() diff --git a/deal.II/doc/developers/porting.html b/deal.II/doc/developers/porting.html index 89efdc8665..2408227120 100644 --- a/deal.II/doc/developers/porting.html +++ b/deal.II/doc/developers/porting.html @@ -137,23 +137,24 @@ You have to set up a native deal.II build directory first and run make expand_instantiations in it. The executable is needed for the build system (and obviously the cross compiled version - cannot be used). Assuming you have a working cross compilation - toolchain, set up a toolchain file next. An example toolchain - file can be found here. With that - invoke cmake e.g. with: + cannot be used). Locate the expand_instantions + executable and export its location in the PATH + environment variable. +

+ +

+ Assuming you have a working cross compilation toolchain, set up a + toolchain file next. With that + invoke cmake with something like:

     cmake -DCMAKE_TOOLCHAIN_FILE=<...>/Toolchain.sample
-          -DDEAL_II_NATIVE=<...>/native/build/dir
-
           -DDEAL_II_FORCE_BUNDLED_BOOST=ON
           -DDEAL_II_ALLOW_AUTODETECTION=OFF
           ../deal.II
       
- where DEAL_II_NATIVE points to the toolchain file and - DEAL_II_NATIVE to the native build directory (which - expand_instantiations will be picked from). The remaining - configuration can be adjusted at will, see the documentation. + where CMAKE_TOOLCHAIN_FILE points to the toolchain file. + The remaining configuration can be adjusted at will, see the documentation.


diff --git a/deal.II/doc/developers/testsuite.html b/deal.II/doc/developers/testsuite.html index 9eb8dd343b..9e0de43e32 100644 --- a/deal.II/doc/developers/testsuite.html +++ b/deal.II/doc/developers/testsuite.html @@ -187,19 +187,23 @@

-

- Note: Specifying these options via environment variables is - volatile, i.e. if make setup_tests is invoked a second - time without the variables set in environment, the option will be - reset to the default value. If you want to set these options - permanently, set them via cmake as CMake variable in the build - directory: + Alternatively, you can also set them as CMake variables when + configuring the build directory:

 
     $ cmake -DTEST_PICKUP_REGEX="<regular expression>" .
       
- A variable set via cmake always overrides one - set via environment. + The variables will be passed down to the subprojects. A variable set + via cmake always overrides one set via environment. +

+ +

+ Note: The subprojects cache these options (regardless of set + via environment variables or as cmake variable). So, if you want to + disable an option again, you have to explicitly set it to an empty + string. Furthermore, if you have set the option as a CMake variable + in the build directory configuration you have to overwrite it in the + build directory cache.

-- 2.39.5