-Major:
-
-* Get rid of the last bits of unguarded platform introspection
-
Some last bits and thoughts:
* A TECPLOT feature has to be written
-* Provide a configuration template for cross compiling with CMake,
-
* Support debug;optimized;general for all FEATURES
* document that we no longer need the two-lib installation of p4est
-
-* same for the Mac part...
#
# - Matthias Maier, rewritten 2012
#
-GET_CXX_SOURCE_RETURN_VALUE(
- "
- #include <vector>
- int main () {
- std::vector<int> v(1);
- v.reserve (1);
- v.resize (1);
- return v.capacity();
- }
- "
- DEAL_II_MIN_VECTOR_CAPACITY
- DEAL_II_MIN_VECTOR_CAPACITY_RETURN_VALUE)
+IF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION)
+ GET_CXX_SOURCE_RETURN_VALUE(
+ "
+ #include <vector>
+ int main () {
+ std::vector<int> v(1);
+ v.reserve (1);
+ v.resize (1);
+ return v.capacity();
+ }
+ "
+ DEAL_II_MIN_VECTOR_CAPACITY
+ DEAL_II_MIN_VECTOR_CAPACITY_RETURN_VALUE)
+ENDIF()
IF(NOT DEAL_II_MIN_VECTOR_CAPACITY)
SET(DEAL_II_MIN_VECTOR_CAPACITY 1)
#
# - Matthias Maier, rewritten 2012
#
-GET_CXX_SOURCE_RETURN_VALUE(
- "
- #include <vector>
- int main () {
- std::vector<bool> v(1);
- v.reserve (1);
- v.resize (1);
- return v.capacity();
- }
- "
- DEAL_II_MIN_BOOL_VECTOR_CAPACITY
- DEAL_II_MIN_BOOL_VECTOR_CAPACITY_RETURN_VALUE)
+IF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION)
+ GET_CXX_SOURCE_RETURN_VALUE(
+ "
+ #include <vector>
+ int main () {
+ std::vector<bool> v(1);
+ v.reserve (1);
+ v.resize (1);
+ return v.capacity();
+ }
+ "
+ DEAL_II_MIN_BOOL_VECTOR_CAPACITY
+ DEAL_II_MIN_BOOL_VECTOR_CAPACITY_RETURN_VALUE)
+ENDIF()
IF(NOT DEAL_II_MIN_BOOL_VECTOR_CAPACITY)
- SET(DEAL_II_MIN_VECTOR_CAPACITY 1)
+ SET(DEAL_II_MIN_BOOL_VECTOR_CAPACITY 1)
ELSE()
SET(DEAL_II_MIN_BOOL_VECTOR_CAPACITY
${DEAL_II_MIN_BOOL_VECTOR_CAPACITY_RETURN_VALUE})
# below but it will throw an exception when run. So test
# that as well.
#
- # TODO: Get somehow rid of the platform introspection...
- #
# TODO: This test will only succeed on platforms where "-pthread" is
# recognized. But this isn't easily fixable:
# configure_threads.cmake which will determine and setup threads
# has to be called later...
#
- PUSH_TEST_FLAG("-pthread")
- CHECK_CXX_SOURCE_RUNS(
- "
- #include <thread>
- void f(int){}
- int main(){ std::thread t(f,1); t.join(); return 0; }
- "
- DEAL_II_HAVE_CXX11_THREAD)
- POP_TEST_FLAG()
+ IF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION)
+ PUSH_TEST_FLAG("-pthread")
+ CHECK_CXX_SOURCE_RUNS(
+ "
+ #include <thread>
+ void f(int){}
+ int main(){ std::thread t(f,1); t.join(); return 0; }
+ "
+ DEAL_II_HAVE_CXX11_THREAD)
+ POP_TEST_FLAG()
+ ELSE()
+ # Just export it ;-)
+ SET_IF_EMPTY(DEAL_II_HAVE_CXX11_THREAD TRUE)
+ ENDIF()
CHECK_CXX_SOURCE_COMPILES(
"
#
MACRO(EXPAND_INSTANTIATIONS _target _inst_in_files)
+
+ IF(CMAKE_CROSSCOMPILING)
+ SET(_ei_exec native-expand_instantiations)
+ ELSE()
+ SET(_ei_exec expand_instantiations)
+ ENDIF()
+
FOREACH (_inst_in_file ${_inst_in_files})
STRING(REGEX REPLACE "\\.in$" "" _inst_file "${_inst_in_file}" )
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_inst_file}
- DEPENDS expand_instantiations
+ DEPENDS ${_ei_exec}
${CMAKE_BINARY_DIR}/cmake/config/template-arguments
${CMAKE_CURRENT_SOURCE_DIR}/${_inst_in_file}
- COMMAND expand_instantiations
+ COMMAND ${_ei_exec}
ARGS ${CMAKE_BINARY_DIR}/cmake/config/template-arguments
< ${CMAKE_CURRENT_SOURCE_DIR}/${_inst_in_file}
> ${CMAKE_CURRENT_BINARY_DIR}/${_inst_file}
#####
ADD_EXECUTABLE(expand_instantiations expand_instantiations.cc)
+IF(NOT CMAKE_CROSSCOMPILING)
+ #
+ # Export expand_instantiations for use in cross compilation:
+ #
+ EXPORT(TARGETS expand_instantiations
+ FILE ${CMAKE_CURRENT_BINARY_DIR}/importExecutables.cmake
+ NAMESPACE native- # Prefix a namespace
+ )
+ENDIF()
IF(DEAL_II_COMPONENT_COMPAT_FILES)
#
${CMAKE_CURRENT_BINARY_DIR}/report_features.cc
)
TARGET_LINK_LIBRARIES(report_features ${DEAL_II_EXTERNAL_LIBRARIES})
- ADD_CUSTOM_TARGET(run_report_features COMMAND report_features)
+ IF(NOT CMAKE_CROSSCOMPILING)
+ ADD_CUSTOM_TARGET(run_report_features COMMAND report_features)
+ ENDIF()
INSTALL(TARGETS make_dependencies report_features expand_instantiations
- RUNTIME
+ EXPORT ${DEAL_II_PROJECT_CONFIG_NAME}Targets
DESTINATION ${DEAL_II_COMMON_RELDIR}/scripts
COMPONENT compat_files
)
ENDIF()
-
# #
###########################################################################
-SET(DEAL_II_ALLOW_PLATFORM_INTROSPECTION ON CACHE BOOL
+OPTION(DEAL_II_ALLOW_PLATFORM_INTROSPECTION
"Allow platform introspection for CPU command set, SSE and AVX"
+ ON
)
MARK_AS_ADVANCED(DEAL_II_ALLOW_PLATFORM_INTROSPECTION)
ENDIF()
+###########################################################################
+# #
+# Cleanup and Includes that have to happen after the call to PROJECT(): #
+# #
+###########################################################################
+
#
# Cleanup some files used for storing the names of all object targets that
# will be bundled to the deal.II library.
)
ENDFOREACH()
+
+#
+# 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"
+ )
+ INCLUDE(${DEAL_II_NATIVE}/cmake/scripts//importExecutables.cmake)
+ENDIF()
"###
#
# ${DEAL_II_PACKAGE_NAME} configuration:
-#
# CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}
# BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}
# CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}
# CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR} (Version ${DEAL_II_PACKAGE_VERSION})
# CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}
-# CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} on platform ${CMAKE_SYSTEM_NAME}
+# CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} on platform ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR}
# ${CMAKE_CXX_COMPILER}
-#
"
)
+IF(CMAKE_CROSSCOMPILING)
+ _both(
+ "# CROSSCOMPILING!\n"
+ "# DEAL_II_NATIVE: ${DEAL_II_NATIVE}\n"
+ )
+ENDIF()
+
+_both("#\n")
_detailed(
"# Compiler flags used for this build:
--- /dev/null
+SET(CMAKE_SYSTEM_NAME Linux)
+SET(CMAKE_SYSTEM_PROCESSOR "x86")
+
+SET(CMAKE_C_COMPILER "/usr/bin/gcc")
+SET(CMAKE_CXX_COMPILER "/usr/bin/g++")
+
+SET(CMAKE_FIND_ROOT_PATH "/")
+SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
</ul>
</p>
- <!--
<h2>Cross compiling</h2>
<p>
It is possible to use <a href="http://www.cmake.org/"
target="_top">CMake</a> to cross compile
- <acronym>deal.II</acronym> for a foreign platform. It is best
- to start cross compiling with minimal external dependencies
- (<code>-DDEAL_II_ALLOW_AUTODETECTION=OFF</code>, see the
- <a href="cmake.html">deal.II CMake documentation</a>).
- Further information on that topic can be found in the <a
+ <acronym>deal.II</acronym> for a foreign platform.
+ Further information on that topic can be found at the <a
href="http://www.cmake.org/Wiki/CMake_Cross_Compiling">CMake
wiki</a>.
- -->
+ </p>
- <hr>
+ <p>
+ You have to set up a native deal.II build directory first and run
+ <code>make expand_instantiations</code> 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 <i>toolchain file</i> next. An example toolchain
+ file can be found <a href="Toolchain.sample">here</a>. With that
+ invoke <code>cmake</code> e.g. with:
+ <pre>
+ 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
+ </pre>
+ where <code>DEAL_II_NATIVE</code> points to the toolchain file and
+ <code>DEAL_II_NATIVE</code> to the native build directory (which
+ <code>expand_instantiations</code> will be picked from). The remaining
+ configuration can be adjusted at will, see <a
+ href="cmake.html">the documentation</a>.
+ </p>
+ <hr>
<address>
<a href="../mail.html" target="body">The deal.II Group</a>
</address>