2017-02-23 09:15:38 +00:00
|
|
|
# /*-------------------------------------------------------------------------*\# ======== |
|
2013-12-11 16:09:41 +00:00
|
|
|
# \\ / F ield | foam-extend: Open Source CFD
|
2017-02-23 09:15:38 +00:00
|
|
|
# \\ / O peration | Version: 3.2
|
2015-05-17 13:32:07 +00:00
|
|
|
# \\ / A nd | Web: http://www.foam-extend.org
|
|
|
|
# \\/ M anipulation | For copyright notice see file Copyright
|
2010-10-15 21:24:50 +00:00
|
|
|
# -----------------------------------------------------------------------------
|
2010-10-07 03:00:07 +00:00
|
|
|
# License
|
2013-12-11 16:09:41 +00:00
|
|
|
# This file is part of foam-extend.
|
2010-10-07 03:00:07 +00:00
|
|
|
#
|
2013-12-11 16:09:41 +00:00
|
|
|
# foam-extend is free software: you can redistribute it and/or modify it
|
2010-10-07 03:00:07 +00:00
|
|
|
# under the terms of the GNU General Public License as published by the
|
2013-12-11 16:09:41 +00:00
|
|
|
# Free Software Foundation, either version 3 of the License, or (at your
|
2010-10-07 03:00:07 +00:00
|
|
|
# option) any later version.
|
|
|
|
#
|
2013-12-11 16:09:41 +00:00
|
|
|
# foam-extend 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
|
|
|
|
# General Public License for more details.
|
2010-10-07 03:00:07 +00:00
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2013-12-11 16:09:41 +00:00
|
|
|
# along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
|
2010-10-07 03:00:07 +00:00
|
|
|
#
|
|
|
|
# Description
|
2010-10-15 21:24:50 +00:00
|
|
|
# CMakeLists.txt file for implementing a test harness for the compilation
|
2017-02-23 09:15:38 +00:00
|
|
|
# and test of foam-extend-3.2 using Kitware CTest/CMake/CDash
|
2010-10-07 03:00:07 +00:00
|
|
|
#
|
2010-10-15 21:24:50 +00:00
|
|
|
# The results will be submitted to the CDash server identified by the file
|
|
|
|
# CTestConfig.cmake
|
2010-10-07 03:00:07 +00:00
|
|
|
#
|
|
|
|
# Author
|
2010-10-15 21:24:50 +00:00
|
|
|
# Martin Beaudoin, Hydro-Quebec, 2010. All rights reserved
|
2010-10-07 03:00:07 +00:00
|
|
|
#
|
|
|
|
#
|
2010-10-15 21:24:50 +00:00
|
|
|
# \*-------------------------------------------------------------------------*/
|
2010-10-07 03:00:07 +00:00
|
|
|
|
|
|
|
cmake_minimum_required (VERSION 2.8)
|
|
|
|
|
2017-02-23 09:15:38 +00:00
|
|
|
project(foam-extend C CXX)
|
2010-10-07 03:00:07 +00:00
|
|
|
|
2017-02-23 09:15:38 +00:00
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
2015-09-16 00:47:54 +00:00
|
|
|
|
|
|
|
#
|
2017-02-23 09:15:38 +00:00
|
|
|
# Determine project version & Set-up automatic update during build
|
2015-09-16 00:47:54 +00:00
|
|
|
#
|
|
|
|
|
2017-02-23 09:15:38 +00:00
|
|
|
include(getGitVersion)
|
|
|
|
|
|
|
|
add_custom_target(getGitVersion ALL
|
|
|
|
COMMAND ${CMAKE_COMMAND} -P cmake/getGitVersion.cmake
|
|
|
|
COMMENT "Getting GIT version"
|
|
|
|
)
|
|
|
|
|
|
|
|
set(PROJECT_VERSION ${FOAM_VERSION})
|
|
|
|
|
2015-09-16 00:47:54 +00:00
|
|
|
|
|
|
|
#
|
2017-02-23 09:15:38 +00:00
|
|
|
# Include helper functions
|
2015-09-16 00:47:54 +00:00
|
|
|
#
|
|
|
|
|
2017-02-23 09:15:38 +00:00
|
|
|
include(FOAMMacros)
|
2015-09-16 00:47:54 +00:00
|
|
|
|
2017-02-23 09:15:38 +00:00
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
2015-09-16 00:47:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
#
|
2017-02-23 09:15:38 +00:00
|
|
|
# External dependencies
|
2015-09-16 00:47:54 +00:00
|
|
|
#
|
|
|
|
|
2017-02-23 09:15:38 +00:00
|
|
|
find_package(MPI REQUIRED)
|
|
|
|
add_library(mpi SHARED IMPORTED)
|
|
|
|
set_property(TARGET mpi PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${MPI_C_INCLUDE_PATH})
|
|
|
|
set_property(TARGET mpi PROPERTY IMPORTED_LOCATION ${MPI_LIBRARY})
|
2010-10-07 03:00:07 +00:00
|
|
|
|
2017-02-23 09:15:38 +00:00
|
|
|
find_package(ZLIB REQUIRED)
|
|
|
|
|
|
|
|
find_package(FLEX REQUIRED)
|
2010-10-07 03:00:07 +00:00
|
|
|
|
2017-02-23 09:15:38 +00:00
|
|
|
find_package(Git REQUIRED)
|
2010-10-07 03:00:07 +00:00
|
|
|
|
2015-08-15 18:23:15 +00:00
|
|
|
|
2010-10-07 03:00:07 +00:00
|
|
|
#
|
2017-02-23 09:15:38 +00:00
|
|
|
# Recurse into the source
|
2013-07-18 01:02:34 +00:00
|
|
|
#
|
2010-10-07 03:00:07 +00:00
|
|
|
|
2017-02-23 09:15:38 +00:00
|
|
|
# Set variabable to indicate that we are compiling internally. Used in applications.
|
|
|
|
set(FOAM_FOUND 1)
|
2010-10-07 03:00:07 +00:00
|
|
|
|
2017-02-23 09:15:38 +00:00
|
|
|
# Write something into FOAMTargets.cmake so that we can append to the file.
|
|
|
|
file(WRITE ${CMAKE_BINARY_DIR}/cmake/FOAMTargets.cmake "#" )
|
2010-10-07 03:00:07 +00:00
|
|
|
|
2017-02-23 09:15:38 +00:00
|
|
|
add_subdirectory(src)
|
|
|
|
add_subdirectory(applications)
|
2010-10-07 03:00:07 +00:00
|
|
|
|
2010-10-09 18:58:08 +00:00
|
|
|
|
|
|
|
#
|
2017-02-23 09:15:38 +00:00
|
|
|
# Flags and definitions
|
2010-10-09 18:58:08 +00:00
|
|
|
#
|
2017-02-23 09:15:38 +00:00
|
|
|
|
|
|
|
# Define and process the definitions
|
|
|
|
set(FOAM_PRECISION "double" CACHE STRING "Numerical precision")
|
|
|
|
set_property(CACHE FOAM_PRECISION PROPERTY STRINGS single double)
|
|
|
|
if(FOAM_PRECISION EQUAL "single")
|
|
|
|
target_compile_definitions(OSspecific PUBLIC -DWM_SP)
|
2015-08-15 18:23:15 +00:00
|
|
|
else()
|
2017-02-23 09:15:38 +00:00
|
|
|
target_compile_definitions(OSspecific PUBLIC -DWM_SP)
|
2010-10-09 18:58:08 +00:00
|
|
|
endif()
|
2010-10-07 03:00:07 +00:00
|
|
|
|
2017-02-23 09:15:38 +00:00
|
|
|
target_compile_definitions(OSspecific PUBLIC -DNoRepository)
|
|
|
|
|
|
|
|
#option(FOAM_PRECISION "help string describing option" -WM_DP)
|
2010-10-15 21:24:50 +00:00
|
|
|
|
2015-08-18 13:51:41 +00:00
|
|
|
|
2015-09-16 00:47:54 +00:00
|
|
|
#
|
2017-02-23 09:15:38 +00:00
|
|
|
# Exports and install
|
|
|
|
#
|
|
|
|
|
|
|
|
include(GenerateExportHeader)
|
|
|
|
set(ConfigPackageLocation lib/cmake/foam)
|
2010-10-07 03:00:07 +00:00
|
|
|
|
2017-02-23 09:15:38 +00:00
|
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
write_basic_package_version_file(
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake/FOAMConfigVersion.cmake"
|
|
|
|
VERSION ${FOAM_VERSION}
|
|
|
|
COMPATIBILITY AnyNewerVersion
|
2010-10-07 03:00:07 +00:00
|
|
|
)
|
|
|
|
|
2017-02-23 09:15:38 +00:00
|
|
|
configure_package_config_file(cmake/FOAMConfig.cmake.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/cmake/FOAMConfig.cmake
|
|
|
|
INSTALL_DESTINATION ${ConfigPackageLocation}
|
2010-10-07 03:00:07 +00:00
|
|
|
)
|
|
|
|
|
2017-02-23 09:15:38 +00:00
|
|
|
install(EXPORT FOAMTargets
|
|
|
|
FILE FOAMTargets.cmake
|
|
|
|
DESTINATION ${ConfigPackageLocation}
|
2010-10-07 03:00:07 +00:00
|
|
|
)
|
|
|
|
|
2017-02-23 09:15:38 +00:00
|
|
|
install(FILES
|
|
|
|
cmake/FOAMConfig.cmake
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake/FOAMConfigVersion.cmake"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake/FOAMMacros.cmake"
|
|
|
|
DESTINATION ${ConfigPackageLocation}
|
|
|
|
COMPONENT Devel
|
|
|
|
)
|
2010-10-07 03:00:07 +00:00
|
|
|
|
2017-02-23 09:15:38 +00:00
|
|
|
file(GLOB_RECURSE files "${CMAKE_CURRENT_SOURCE_DIR}/etc/*")
|
|
|
|
install(FILES ${files} DESTINATION etc)
|
2010-10-07 03:00:07 +00:00
|
|
|
|
2017-02-23 09:15:38 +00:00
|
|
|
#
|
|
|
|
# Register with CMake user package registry
|
|
|
|
#
|
2010-10-07 03:00:07 +00:00
|
|
|
|
2017-02-23 09:15:38 +00:00
|
|
|
export(PACKAGE FOAM)
|
2010-10-07 03:00:07 +00:00
|
|
|
|
2017-02-23 09:15:38 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Make a package
|
2010-10-07 03:00:07 +00:00
|
|
|
#
|
2017-02-23 09:15:38 +00:00
|
|
|
|
|
|
|
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Henrik Rusche")
|
|
|
|
set(CPACK_PACKAGE_CONTACT "h.rusche@wikki-gmbh.de")
|
|
|
|
set(CPACK_GENERATOR "DEB")
|
|
|
|
set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/foam-extend-4.0")
|
|
|
|
set(CPACK_SOURCE_STRIP_FILES "1")
|
|
|
|
include(CPack)
|
|
|
|
|