Page MenuHomec4science

CMakeLists.txt
No OneTemporary

File Metadata

Created
Sat, May 11, 21:17

CMakeLists.txt

#===============================================================================
# @file CMakeLists.txt
#
# @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
# @author Nicolas Richart <nicolas.richart@epfl.ch>
#
# @date Mon Jul 28 12:20:03 2014
#
# @brief This is the main CMake configuration file for LM
#
# @section LICENSE
#
# Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
# Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
#
# LibMultiScale is free software: you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# LibMultiScale is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with LibMultiScale. If not, see <http://www.gnu.org/licenses/>.
#
#===============================================================================
#===============================================================================
# Project definition
#===============================================================================
cmake_minimum_required(VERSION 3.0.2)
project(LibMultiScale)
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
endif(CCACHE_PROGRAM)
enable_language(CXX)
set(CMAKE_CXX_STANDARD 17 CACHE INTERNAL "" FORCE)
#===============================================================================
# Misc. config for cmake
#===============================================================================
set(LIBMULTISCALE_CMAKE_DIR "${PROJECT_SOURCE_DIR}/cmake")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/Modules")
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries.")
#### temporary #################################################
# include_directories("third-party/eigen")
################################################################
include(LibMultiScaleMacros)
include(CMakeFlagsHandling)
include(CMakeVersionGenerator)
include(CMakeDebugMessages)
include(CMakePackagesSystem)
#===============================================================================
# Options
#===============================================================================
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "asks to export compile commands for irony" FORCE)
option(LIBMULTISCALE_OPTIMIZE "Set this if you want libmultiscale to be fully optimized" OFF)
if(LIBMULTISCALE_OPTIMIZE)
add_definitions(-DLM_OPTIMIZED)
endif(LIBMULTISCALE_OPTIMIZE)
add_flags(cxx -fno-omit-frame-pointer -pedantic -Wall -Wextra -Wsuggest-override)
add_flags(cxx -ftemplate-backtrace-limit=0)
if (CMAKE_CXX_COMPILER_ID MATCHES "Intel")
add_flags(cxx -vec-report=0)
endif()
#===============================================================================
# Release file target
#===============================================================================
set(GET_RELEASE_INFO ${PROJECT_SOURCE_DIR}/get_release_info.sh)
set(RELEASE_FILE ${PROJECT_BINARY_DIR}/release.cc)
find_program(uuencode_exec "uuencode")
mark_as_advanced(uuencode_exec)
if(uuencode_exec)
add_custom_command(
OUTPUT ${RELEASE_FILE}
COMMAND bash ${GET_RELEASE_INFO} ${uuencode_exec} ${PROJECT_BINARY_DIR} > ${RELEASE_FILE}
DEPENDS ${LIBMULTISCALE_DEPEND_FILES} ${GET_RELEASE_INFO}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)
else()
message("install uuencode on the building machine to have access to release information.")
file(WRITE "${RELEASE_FILE}"
"
#include <string>
std::string lm_release_info = \" install uuencode on the building machine to have access to release information.\";
")
endif()
add_custom_target(RELEASE_INFO DEPENDS ${RELEASE_FILE})
#===============================================================================
# Version Number
#===============================================================================
# LIBMULTISCALE version number. An even minor number corresponds to releases.
set(LIBMULTISCALE_MAJOR_VERSION 2)
set(LIBMULTISCALE_MINOR_VERSION 1)
set(LIBMULTISCALE_BUILD_VERSION dev0)
define_project_version()
#===============================================================================
# LibMultiScale library
#===============================================================================
#cmake_activate_debug_message(TestSystem)
cmake_deactivate_debug_message()
package_list_packages(${PROJECT_SOURCE_DIR}/packages
EXTRA_PACKAGES_FOLDER ${PROJECT_SOURCE_DIR}/extra_packages)
add_subdirectory(src)
set(LIBMULTISCALE_DEPEND_FILES "")
#===============================================================================
# LibMultiScale Python bindings
#===============================================================================
package_is_activated(pybind11 PYBIND_ACTIVATED)
if(PYBIND_ACTIVATED)
add_subdirectory(python)
endif()
#===============================================================================
# LibMultiScale AMEL + LMPOST
#===============================================================================
add_subdirectory(clients)
#===============================================================================
# Documentation
#===============================================================================
option(LIBMULTISCALE_DOCUMENTATION "Build documentation." OFF)
if(LIBMULTISCALE_DOCUMENTATION)
add_subdirectory(doc)
endif(LIBMULTISCALE_DOCUMENTATION)
#===============================================================================
# Tests
#===============================================================================
package_declare(TESTS
DESCRIPTION "Activate the tests"
DEFAULT OFF
)
package_get_option_name(TESTS _option_name)
if(${_option_name})
enable_testing()
include(CTest)
add_subdirectory(test)
mark_as_advanced(BUILD_TESTING)
endif()
#===============================================================================
# CPack
#===============================================================================
include(LibMultiScaleCPack)

Event Timeline