Commit c9e25576 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#1527 In configure_cmake.py script, use the intended third party library...

#1527 In configure_cmake.py script, use the intended third party library (previously it was always the one chosen for release mode that was used).
parent d83122c0
set(CMAKE_INSTALL_PREFIX /opt CACHE PATH "Installation directory for executables and libraries. A MoReFEM folder will be created there when install is invoked.")
set(MOREFEM_THIRD_PARTY_LIBRARIES_DIR /opt CACHE STRING "Path to third party directory")
set(MOREFEM_THIRD_PARTY_LIBRARIES_DEBUG_DIR /opt CACHE STRING "Path to third party directory compiled in debug mode - used only if CMAKE_BUILD_TYPE is 'Debug'")
set(MOREFEM_THIRD_PARTY_LIBRARIES_RELEASE_DIR /opt CACHE STRING "Path to third party directory compiled in release mode - used only if CMAKE_BUILD_TYPE is 'Release'")
set(CMAKE_C_COMPILER ${MOREFEM_THIRD_PARTY_LIBRARIES_DIR}/Openmpi/bin/mpicc CACHE FILEPATH "C compiler. Prefer to use an openmpi wrapper.")
set(CMAKE_CXX_COMPILER ${MOREFEM_THIRD_PARTY_LIBRARIES_DIR}/Openmpi/bin/mpic++ CACHE FILEPATH "C++ compiler. Prefer to use an openmpi wrapper.")
......
......@@ -2,11 +2,9 @@ set(CMAKE_INSTALL_PREFIX /placeholder_value CACHE PATH "Installation directory f
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose either 'Debug' or 'Release'")
if (CMAKE_BUILD_TYPE MATCHES Debug)
set(MOREFEM_THIRD_PARTY_LIBRARIES_DIR /Volumes/Data/opt/clang_debug CACHE STRING "Path to third party directory")
else()
set(MOREFEM_THIRD_PARTY_LIBRARIES_DIR /Volumes/Data/opt/clang_release CACHE STRING "Path to third party directory")
endif()
set(MOREFEM_THIRD_PARTY_LIBRARIES_DEBUG_DIR /Volumes/Data/opt/clang_debug CACHE STRING "Path to third party directory compiled in debug mode - used only if CMAKE_BUILD_TYPE is 'Debug'")
set(MOREFEM_THIRD_PARTY_LIBRARIES_RELEASE_DIR /Volumes/Data/opt/clang_release CACHE STRING "Path to third party directory compiled in release mode - used only if CMAKE_BUILD_TYPE is 'Release'")
set(CMAKE_C_COMPILER ${MOREFEM_THIRD_PARTY_LIBRARIES_DIR}/Openmpi/bin/mpicc CACHE FILEPATH "C compiler. Prefer to use an openmpi wrapper.")
set(CMAKE_CXX_COMPILER ${MOREFEM_THIRD_PARTY_LIBRARIES_DIR}/Openmpi/bin/mpic++ CACHE FILEPATH "C++ compiler. Prefer to use an openmpi wrapper.")
......
......@@ -140,7 +140,8 @@ If you need to change a value which is not provided in this script input, you ma
In output, self.__pre_cache_dict is filled.
"""
possible_keys = ('CMAKE_INSTALL_PREFIX',
'MOREFEM_THIRD_PARTY_LIBRARIES_DIR',
'MOREFEM_THIRD_PARTY_LIBRARIES_DEBUG_DIR',
'MOREFEM_THIRD_PARTY_LIBRARIES_RELEASE_DIR',
'CMAKE_C_COMPILER', 'CMAKE_CXX_COMPILER',
'CMAKE_CXX_STANDARD', 'CMAKE_CXX_STANDARD_REQUIRED',
'CMAKE_CXX_EXTENSIONS', 'LIBRARY_TYPE',
......@@ -199,6 +200,8 @@ If you need to change a value which is not provided in this script input, you ma
\param[in] cmake_type Type of the item in CMake; e.g. STRING, PATH or BOOL
\param[in] cmake_comment Comment of the entry in CMake, e.g. "C++ standard; at least 17 is expected."
\param[in] command_line_entry_value: The value read in the command line if any, None otherwise (in which case the one from the pre-cache file is kept).
\return The value finally set.
"""
if command_line_entry_value is not None:
value = command_line_entry_value
......@@ -214,6 +217,8 @@ If you need to change a value which is not provided in this script input, you ma
self.__output_file.write("{}\n\n".format(entry))
return value
def _generate_cache_file(self):
"""Generate the actual cache file, with the values on command line in place of the pre-cache one if some were superseded.
......@@ -231,7 +236,23 @@ If you need to change a value which is not provided in this script input, you ma
"PATH",
"Installation directory for executables and libraries. A MoReFEM folder will be created there when install is invoked. This value should be overridden in command line!",
args.install_directory)
mode = self._cache_entry("CMAKE_BUILD_TYPE", \
"STRING",
"Either 'Debug' or 'Release'",
args.mode)
assert(mode in ('Debug', 'Release'))
# Special case: in the input file, there were two fields MOREFEM_THIRD_PARTY_LIBRARIES_DEBUG_DIR and
# MOREFEM_THIRD_PARTY_LIBRARIES_RELEASE_DIR. We will put by default in MOREFEM_THIRD_PARTY_LIBRARIES_DIR
# the one matching the chosen build type.
if mode == 'Debug':
self.__pre_cache_dict['MOREFEM_THIRD_PARTY_LIBRARIES_DIR'] = self.__pre_cache_dict['MOREFEM_THIRD_PARTY_LIBRARIES_DEBUG_DIR']
else:
self.__pre_cache_dict['MOREFEM_THIRD_PARTY_LIBRARIES_DIR'] = self.__pre_cache_dict['MOREFEM_THIRD_PARTY_LIBRARIES_RELEASE_DIR']
self._cache_entry("MOREFEM_THIRD_PARTY_LIBRARIES_DIR", \
"STRING",
"Path to third party directory",
......@@ -251,11 +272,6 @@ If you need to change a value which is not provided in this script input, you ma
# "If true address sanitizer is enabled.",
# args.use_sanitizer)
self._cache_entry("CMAKE_BUILD_TYPE", \
"STRING",
"Either 'Debug' or 'Release'",
args.mode)
self._cache_entry("CMAKE_CXX_STANDARD",
"STRING",
"C++ standard; at least 17 is required.")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment