#----------------------------------------------------------------------
# Preamble
#----------------------------------------------------------------------
# Set the minimum required version of cmake
cmake_minimum_required (VERSION 3.19 FATAL_ERROR)
# Set name, version and language for the project.
project (wavepacket
VERSION 0.3.6
LANGUAGES CXX
DESCRIPTION "A program for the propagation of quantum-mechanical wavepackets."
HOMEPAGE_URL "https://sourceforge.net/p/wavepacket/cpp")
enable_testing ()
# needed for FindPackage(filesystem) and our utilities
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH};${CMAKE_SOURCE_DIR}/cmake)
include (CMakePackageConfigHelpers)
include (GNUInstallDirs)
include (PythonUtils)
#----------------------------------------------------------------------
# Additional options
#----------------------------------------------------------------------
# If not set by the user, build shared libraries and make a release build.
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build as shared library")
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
endif()
option(WP_BUILD_PYTHON "Build the Python interface" ON)
option(WP_BUILD_DEMOS "Build all demos" ON)
option(WP_BUILD_UNITTESTS "Build the unit tests" ON)
option(WP_BUILD_DOC " Build documentation" ON)
set(WP_PYMOD_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/wavepacket_python/wavepacket CACHE STRING "The installation directory for the Python bindings")
option (WP_USE_PRECOMPILED_HEADERS
"Use precompiled headers to speed up compilation (mainly useful for development, not so much for one-time compilation)"
ON)
mark_as_advanced (WP_USE_PRECOMPILED_HEADERS)
# I am keeping this to have a centralized place for changing the setting later
set(WP_CXX_STANDARD_INTERNAL 17 CACHE STRING INTERNAL)
#----------------------------------------------------------------------
# Find / get external dependencies
#----------------------------------------------------------------------
# The Python interpreter if requested or exit
if (WP_BUILD_PYTHON)
find_package(Python3 COMPONENTS Interpreter Development)
if (NOT Python3_FOUND)
message(ERROR "Need Python3 interpreter and development environment to compile Python module")
endif()
wp_require_python_module(pybind11)
wp_require_python_module(numpy)
endif()
#----------------------------------------------------------------------
# Various subdirectories for the build
#----------------------------------------------------------------------
add_subdirectory(cpp)
if (WP_BUILD_PYTHON)
add_subdirectory(python)
endif()
if (WP_BUILD_DEMOS)
add_subdirectory(Demos)
endif()
if (WP_BUILD_DOC)
add_subdirectory(doc)
endif()
#----------------------------------------------------------------------
# project-wide installation work
#----------------------------------------------------------------------
# installation rules for standard files
install (
FILES AUTHORS LICENSE NEWS README.md
DESTINATION ${CMAKE_INSTALL_DOCDIR})
install (
DIRECTORY licenses
DESTINATION ${CMAKE_INSTALL_DOCDIR})