Commit 60437958 authored by GILLES Sebastien's avatar GILLES Sebastien

#1220 [WIP]

parent 7299d1ab
......@@ -25,11 +25,8 @@ if(MOREFEM_CHECK_NAN_AND_INF)
add_definitions(-DMOREFEM_CHECK_NAN_AND_INF)
endif()
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# ===================================================================================================================
# Set some values in the path file that night be overridden by cache variables.
# WARNING: all those calls must occur BEFORE the call to project, so that overriding remains possible.
# ===================================================================================================================
# From http://cmake.3232098.n2.nabble.com/Default-value-for-CMAKE-BUILD-TYPE-td7550756.html#a7550797
# Set a default build type if none was specified
......@@ -41,31 +38,16 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
"MinSizeRel" "RelWithDebInfo")
endif()
set(MOREFEM_INSTALL_DIR ${MOREFEM_INSTALL_DIR}/${CMAKE_BUILD_TYPE})
set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/${CMAKE_BUILD_TYPE})
set(MOREFEM_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR}/cmake)
# Set C and CXX compilers from the values read in the setting file. Might be overridden in command line.
# if (NOT DEFINED CMAKE_C_COMPILER)
# set(CMAKE_C_COMPILER ${MPI_CC})
# endif()
#
# if (NOT DEFINED CMAKE_CXX_COMPILER)
# set(CMAKE_CXX_COMPILER ${MPI_CXX})
# endif()
#
# ===================================================================================================================
# Set project.
# ===================================================================================================================
project( "MoReFEM_CMAKE")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) # I want c++17, not gnu++17.
include(CustomCommands)
# All --all_load in target_link_libraries of executables if STATIC library are chosen.
......
......@@ -71,11 +71,15 @@ install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/ DESTINATION ${MOREFEM_INSTALL_DIR_I
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/ DESTINATION ${MOREFEM_INSTALL_DIR_INCL}
FILES_MATCHING PATTERN "*.hxx")
# Only for Seldon...
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/ DESTINATION ${MOREFEM_INSTALL_DIR_INCL}
FILES_MATCHING PATTERN "*.cxx")
# TODO: also make the multiple lib case work!
list(APPEND header_files "")
extract_header_files(MoReFEM header_files ${CMAKE_CURRENT_LIST_DIR})
# list(APPEND header_files "")
# extract_header_files(MoReFEM header_files ${CMAKE_CURRENT_LIST_DIR})
#message("HEAD" ${header_files})
......@@ -84,7 +88,10 @@ extract_header_files(MoReFEM header_files ${CMAKE_CURRENT_LIST_DIR})
#
add_library(morefem_cmake INTERFACE)
target_include_directories(morefem_cmake INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>)
$<INSTALL_INTERFACE:include>)
target_link_libraries(morefem_cmake INTERFACE ${MOREFEM_MODEL} )
# #
#
#
......@@ -96,26 +103,24 @@ include(CMakePackageConfigHelpers)
#Alias
set(MoReFEM_CMAKE_INCLUDE_DIRS ${MOREFEM_INSTALL_DIR_INCL})
message("MoReFEM_CMAKE_INCLUDE_DIRS => " ${MoReFEM_CMAKE_INCLUDE_DIRS})
#set(MoReFEM_CMAKE_INCLUDE_DIRS ${MOREFEM_INSTALL_DIR_INCL})
install(TARGETS morefem_cmake
EXPORT ${PROJECT_NAME}-targets)
install(TARGETS morefem_cmake ${MOREFEM_MODEL}
EXPORT ${PROJECT_NAME}-targets
LIBRARY DESTINATION ${MOREFEM_INSTALL_DIR_LIB}
)
#
# # Makes the project importable from the build directory
export(EXPORT ${PROJECT_NAME}-targets
FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake")
install(FILES ${header_files}
DESTINATION ${MOREFEM_INSTALL_DIR_INCL})
# install(FILES ${header_files}
# DESTINATION ${MOREFEM_INSTALL_DIR_INCL})
# set(XTL_CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" CACHE
# STRING "install path for xtlConfig.cmake")
message("CHECK " ${CMAKE_CURRENT_BINARY_DIR})
configure_package_config_file(../cmake/${PROJECT_NAME}Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION ${MOREFEM_INSTALL_DIR_CMAKE})
......@@ -123,7 +128,9 @@ configure_package_config_file(../cmake/${PROJECT_NAME}Config.cmake.in
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
DESTINATION ${MOREFEM_INSTALL_DIR_CMAKE})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/../../cmake/CustomCommands.cmake
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/../../cmake/CustomCommands.cmake
${CMAKE_CURRENT_BINARY_DIR}/../../cmake/Compiler.cmake
DESTINATION ${MOREFEM_INSTALL_DIR_CMAKE})
#
......
......@@ -13,7 +13,7 @@ if(${CMAKE_C_COMPILER_ID} STREQUAL "AppleClang" OR ${CMAKE_C_COMPILER_ID} STREQU
add_cxx_compiler_flag("-Wno-undefined-func-template")
add_cxx_compiler_flag("-Wno-c++1z-extensions")
add_cxx_compiler_flag("-stdlib=libc++")
# add_cxx_compiler_flag("-stdlib=libc++")
if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
add_definitions(-D_LIBCPP_DEBUG2=0) # Additional checks such as index out of bounds in vectors in libc++; might
......
set(MOREFEM_INSTALL_DIR /Volumes/Data/sebastien/MoReFEM/CMake/shared CACHE PATH "Installation directory for executables and libraries. This will be completed with a subdirectory giving away the compilation mode (Debug, Release, etc...)")
set(CMAKE_INSTALL_PREFIX /Volumes/Data/sebastien/MoReFEM/CMake/shared CACHE PATH "Installation directory for executables and libraries. This will be completed with a subdirectory giving away the compilation mode (Debug, Release, etc...)")
set(CMAKE_C_COMPILER /Users/Shared/LibraryVersions/llvm-clang/Openmpi/bin/mpicc CACHE FILEPATH "C compiler. Prefer to use an openmpi wrapper.")
set(CMAKE_C_COMPILER /Users/Shared/LibraryVersions/clang/Openmpi/bin/mpicc CACHE FILEPATH "C compiler. Prefer to use an openmpi wrapper.")
set(CMAKE_CXX_COMPILER /Users/Shared/LibraryVersions/clang/Openmpi/bin/mpic++ CACHE FILEPATH "C++ compiler. Prefer to use an openmpi wrapper.")
set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard; at least 17 is expected.")
set(CMAKE_CXX_STANDARD_REQUIRED ON CACHE STRING "Leave this one active.")
set(CMAKE_CXX_EXTENSIONS OFF CACHE STRING "If ON you might be using gnu++17; with OFF you'll use c++17.")
set(LIBRARY_TYPE SHARED CACHE BOOL "Choose either STATIC or SHARED.")
set(BUILD_MOREFEM_UNIQUE_LIBRARY True CACHE BOOL "Whether a unique library is built for MoReFEM core libraries or on the contrary if it is splitted in modules.")
......
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