2020-09-14 17:57:10 +00:00
|
|
|
cmake_minimum_required(VERSION 3.13...3.18)
|
2019-12-22 01:20:44 +00:00
|
|
|
|
|
|
|
project(isce2 LANGUAGES C CXX Fortran)
|
|
|
|
|
2020-06-13 00:42:47 +00:00
|
|
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/.cmake)
|
|
|
|
|
2019-12-22 01:20:44 +00:00
|
|
|
include(CheckLanguage)
|
|
|
|
check_language(CUDA)
|
|
|
|
if(CMAKE_CUDA_COMPILER)
|
2020-06-13 00:53:40 +00:00
|
|
|
set(CMAKE_CUDA_STANDARD 11)
|
|
|
|
set(CMAKE_CUDA_STANDARD_REQUIRED TRUE)
|
2019-12-22 01:20:44 +00:00
|
|
|
enable_language(CUDA)
|
2020-06-13 00:42:47 +00:00
|
|
|
find_package(CUDAToolkit) # TODO added in cmake 3.17 - copy this module
|
2019-12-22 01:20:44 +00:00
|
|
|
endif()
|
|
|
|
|
2020-05-29 00:51:13 +00:00
|
|
|
find_package(Python 3.5 REQUIRED COMPONENTS Interpreter Development
|
|
|
|
OPTIONAL_COMPONENTS NumPy)
|
2019-12-22 01:20:44 +00:00
|
|
|
find_package(FFTW REQUIRED)
|
|
|
|
find_package(Motif)
|
2020-02-27 16:38:50 +00:00
|
|
|
find_package(OpenMP REQUIRED COMPONENTS C CXX Fortran)
|
2020-07-22 01:04:16 +00:00
|
|
|
find_package(OpenCV COMPONENTS core highgui imgproc)
|
2021-02-19 01:56:43 +00:00
|
|
|
find_package(pybind11 CONFIG)
|
2020-07-22 01:04:16 +00:00
|
|
|
|
2019-12-22 01:20:44 +00:00
|
|
|
# Find these, and create IMPORTED INTERFACE libraries for them if they exist
|
|
|
|
include(TargetGDAL)
|
|
|
|
include(TargetMotif)
|
|
|
|
include(TargetX11)
|
|
|
|
include(UseCython)
|
|
|
|
|
2020-09-14 17:57:10 +00:00
|
|
|
# If we're the root cmake project (e.g. not add_subdirectory):
|
|
|
|
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_LIST_DIR}")
|
|
|
|
# override this to also test the resulting extension
|
|
|
|
function(Python_add_library target)
|
|
|
|
_Python_add_library(${target} ${ARGN})
|
2021-07-22 02:18:20 +00:00
|
|
|
set(name "$<TARGET_PROPERTY:${target},OUTPUT_NAME>")
|
2020-09-14 17:57:10 +00:00
|
|
|
add_test(NAME import_${target}
|
|
|
|
COMMAND ${Python_EXECUTABLE} -c
|
2021-07-22 02:18:20 +00:00
|
|
|
"import $<IF:$<BOOL:${name}>,${name},${target}>"
|
2020-09-14 17:57:10 +00:00
|
|
|
)
|
|
|
|
endfunction()
|
|
|
|
endif()
|
|
|
|
|
2019-12-22 01:20:44 +00:00
|
|
|
if(NOT DEFINED PYTHON_MODULE_DIR)
|
|
|
|
set(PYTHON_MODULE_DIR packages CACHE PATH
|
|
|
|
"Python module directory (relative to install prefix)")
|
|
|
|
endif()
|
|
|
|
if(NOT DEFINED ISCE2_PKG)
|
|
|
|
set(ISCE2_PKG ${PYTHON_MODULE_DIR}/isce2 CACHE PATH
|
|
|
|
"ISCE 2 python package install dir (relative to install prefix)")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
include(isce2_buildflags)
|
|
|
|
include(isce2_helpers)
|
|
|
|
|
|
|
|
enable_testing()
|
|
|
|
|
|
|
|
add_subdirectory(applications)
|
|
|
|
add_subdirectory(components)
|
|
|
|
add_subdirectory(contrib components/contrib)
|
|
|
|
add_subdirectory(defaults)
|
|
|
|
add_subdirectory(library)
|
|
|
|
add_subdirectory(test)
|
|
|
|
|
|
|
|
InstallSameDir(
|
|
|
|
__init__.py
|
|
|
|
release_history.py
|
|
|
|
)
|
|
|
|
|
|
|
|
# We also need to create an empty directory for help
|
|
|
|
install(DIRECTORY DESTINATION ${ISCE2_PKG}/helper)
|
|
|
|
|
|
|
|
# CMake will install a python package named "isce2",
|
|
|
|
# but legacy scripts import it as simply "isce".
|
|
|
|
# Make a symlink isce -> isce2 for compatibility.
|
2021-07-22 02:19:27 +00:00
|
|
|
set(symsrc isce2)
|
|
|
|
if(IS_ABSOLUTE "${PYTHON_MODULE_DIR}")
|
|
|
|
set(symdest "${PYTHON_MODULE_DIR}/isce")
|
|
|
|
else()
|
|
|
|
set(symdest "${CMAKE_INSTALL_PREFIX}/${PYTHON_MODULE_DIR}/isce")
|
|
|
|
endif()
|
2019-12-22 01:20:44 +00:00
|
|
|
install(CODE "execute_process(COMMAND
|
|
|
|
${CMAKE_COMMAND} -E create_symlink ${symsrc} ${symdest})")
|