From d2b93796ca1e0af38272fcbb9f32d424f64340d9 Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Sat, 14 Dec 2019 15:52:14 -0800 Subject: [PATCH 01/16] Add CMake instructions to README --- README.md | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b14851e..a6607ba 100644 --- a/README.md +++ b/README.md @@ -192,7 +192,9 @@ the older data with the same workflows available in this open source release. ## Building ISCE -### Configuration control +### SCons (recommended) + +#### Configuration control Scons requires that configuration information be present in a directory specified by the environment variable SCONS\_CONFIG\_DIR. First, create a @@ -252,7 +254,7 @@ and the install files. Also, in the following the capitalization of 'isce' as lower case does matter. This is the case-sensitive package name that Python code uses for importing isce. -### Install ISCE +#### Install ISCE cd isce scons install @@ -273,7 +275,7 @@ This will build the necessary components and install them into the location specified in the configuration file as PRJ\_SCONS\_INSTALL. -#### Note about compiling ISCE after an unsuccessful build. +##### Note about compiling ISCE after an unsuccessful build. When building ISCE, scons will check the list of header files and libraries that ISCE requires. Scons will cache the results of this dependency checking. So, @@ -290,6 +292,24 @@ directory containing the SConstruct file): and then try "scons install" again. +### CMake (experimental) +Make sure you have the following prerequisites: +* CMake ≥ 3.12 +* GCC ≥ 4.8 (with C++11 support) +* Python ≥ 3.5 +* Cython +* FFTW 3 +* GDAL + +```sh +git clone https://github.com/isce-framework/isce2 +cd isce2 +mkdir build +cd build +cmake .. -DCMAKE_INSTALL_PREFIX=/my/isce/install/location +make install +``` + ### Setup Your Environment Once everything is installed, you will need to set the following environment From 5eadebc85d34afcf3e98affabb21f2dc6ea8f9da Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Fri, 22 May 2020 13:08:01 -0700 Subject: [PATCH 02/16] Add documentation for common cmake options --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index a6607ba..cd8ff27 100644 --- a/README.md +++ b/README.md @@ -310,6 +310,29 @@ cmake .. -DCMAKE_INSTALL_PREFIX=/my/isce/install/location make install ``` +#### Additional cmake configuration options + +CMake uses `CMAKE_PREFIX_PATH` as a global prefix for finding packages, +which can come in handy when using e.g. Anaconda: + +```sh +cmake [...] -DCMAKE_PREFIX_PATH=$CONDA_PREFIX +``` + +On macOS, cmake will also look for systemwide "frameworks", +which is usually not what you want when using Conda or Macports. + +```sh +cmake [...] -DCMAKE_FIND_FRAMEWORK=NEVER +``` + +For packagers, the `PYTHON_MODULE_DIR` can be used to specify ISCE2's +package installation location relative to the installation prefix + +```sh +cmake [...] -DPYTHON_MODULE_DIR=lib/python3.8m/site-packages +``` + ### Setup Your Environment Once everything is installed, you will need to set the following environment From 149b4aa29acc2151e6acdc257b33e84792d76ac7 Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Fri, 22 May 2020 13:11:39 -0700 Subject: [PATCH 03/16] Add GPUampcor support with proper version check --- components/zerodop/CMakeLists.txt | 8 +++++++- components/zerodop/GPUampcor/CMakeLists.txt | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/components/zerodop/CMakeLists.txt b/components/zerodop/CMakeLists.txt index f311321..afd838f 100644 --- a/components/zerodop/CMakeLists.txt +++ b/components/zerodop/CMakeLists.txt @@ -3,7 +3,13 @@ add_subdirectory(geozero) add_subdirectory(topozero) if(CMAKE_CUDA_COMPILER) - # add_subdirectory(GPUampcor) TODO cublas_device removed from CUDA ≥ 10 + + # cublas_device removed from CUDA ≥ 10 + if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA" AND + CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 10) + add_subdirectory(GPUampcor) + endif() + add_subdirectory(GPUgeo2rdr) endif() diff --git a/components/zerodop/GPUampcor/CMakeLists.txt b/components/zerodop/GPUampcor/CMakeLists.txt index 302b182..3f416e4 100644 --- a/components/zerodop/GPUampcor/CMakeLists.txt +++ b/components/zerodop/GPUampcor/CMakeLists.txt @@ -12,3 +12,7 @@ target_link_libraries(GPUampcor PRIVATE cublas DataAccessor_static ) +InstallSameDir( + GPUampcor + __init__.py + ) From 8725bd0573c9b7583e082a058237d3446c12e575 Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Fri, 22 May 2020 13:13:46 -0700 Subject: [PATCH 04/16] Simplify package-relative installation --- .cmake/isce2_helpers.cmake | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.cmake/isce2_helpers.cmake b/.cmake/isce2_helpers.cmake index f147569..8e67efa 100644 --- a/.cmake/isce2_helpers.cmake +++ b/.cmake/isce2_helpers.cmake @@ -50,22 +50,16 @@ endfunction() # Note that it first checks if a provided file is a target, # and if so, installs it as a TARGET instead. Make sure your # filenames and target names don't have any overlap! - function(InstallSameDir) -mark_as_advanced(isce2_bin_base) foreach(name ${ARGN}) if(TARGET ${name}) set(installtype TARGETS) else() set(installtype FILES) endif() - file(RELATIVE_PATH path ${isce2_bin_dir} ${CMAKE_CURRENT_BINARY_DIR}) + file(RELATIVE_PATH path ${isce2_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}) install(${installtype} ${name} DESTINATION ${ISCE2_PKG}/${path} ) endforeach() endfunction() -# We use this instead of CMAKE_BINARY_DIR to handle -# cases where isce2 is added as a subdirectory -set(isce2_bin_dir ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH - "ISCE2 root build directory") From f3fa2b0c6f547d6c595ae2e37b2a29f99d76a1b9 Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Fri, 22 May 2020 13:18:37 -0700 Subject: [PATCH 05/16] Fix ISSI libname and data installation --- contrib/issi/components/ISSI/CMakeLists.txt | 11 +++++++++-- .../issi/components/ISSI/src/CMakeLists.txt | 1 - .../ISSI/src/igrf_data/CMakeLists.txt | 18 ------------------ 3 files changed, 9 insertions(+), 21 deletions(-) delete mode 100644 contrib/issi/components/ISSI/src/CMakeLists.txt delete mode 100644 contrib/issi/components/ISSI/src/igrf_data/CMakeLists.txt diff --git a/contrib/issi/components/ISSI/CMakeLists.txt b/contrib/issi/components/ISSI/CMakeLists.txt index 10f2fa1..98d429c 100644 --- a/contrib/issi/components/ISSI/CMakeLists.txt +++ b/contrib/issi/components/ISSI/CMakeLists.txt @@ -8,12 +8,19 @@ add_library(issi SHARED src/polcal.c src/tecToPhase.c ) +set_target_properties(issi PROPERTIES + PREFIX "" + OUTPUT_NAME issi + SUFFIX .so) target_include_directories(issi PUBLIC include) -add_subdirectory(src) - InstallSameDir( issi __init__.py FR.py ) + +file(RELATIVE_PATH relpath ${isce2_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}) +install(DIRECTORY src/igrf_data + DESTINATION ${ISCE2_PKG}/${relpath} + ) diff --git a/contrib/issi/components/ISSI/src/CMakeLists.txt b/contrib/issi/components/ISSI/src/CMakeLists.txt deleted file mode 100644 index 61f2d84..0000000 --- a/contrib/issi/components/ISSI/src/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(igrf_data) diff --git a/contrib/issi/components/ISSI/src/igrf_data/CMakeLists.txt b/contrib/issi/components/ISSI/src/igrf_data/CMakeLists.txt deleted file mode 100644 index 714613b..0000000 --- a/contrib/issi/components/ISSI/src/igrf_data/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -InstallSameDir( - dgrf00.dat - dgrf45.dat - dgrf50.dat - dgrf55.dat - dgrf60.dat - dgrf65.dat - dgrf70.dat - dgrf75.dat - dgrf80.dat - dgrf85.dat - dgrf90.dat - dgrf95.dat - igrf05.dat - igrf05full.dat - igrf05s.dat - igrf10.dat - ) From ab5c20e629dead38fbddc56c5e89a14cc2df9770 Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Fri, 22 May 2020 13:18:56 -0700 Subject: [PATCH 06/16] Add envisat module --- components/isceobj/Sensor/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/isceobj/Sensor/CMakeLists.txt b/components/isceobj/Sensor/CMakeLists.txt index 45d14b1..41850f0 100644 --- a/components/isceobj/Sensor/CMakeLists.txt +++ b/components/isceobj/Sensor/CMakeLists.txt @@ -2,7 +2,14 @@ add_subdirectory(db) add_subdirectory(TOPS) add_subdirectory(MultiMode) +add_library(asa_im_decode src/asa_im_decode/asa_im_decode.c) +set_target_properties(asa_im_decode PROPERTIES + PREFIX "" + OUTPUT_NAME envisat + SUFFIX .so) + set(installfiles + asa_im_decode alos __init__.py ALOS.py From 1ad638b1def78857c0312d9eb2e4e9a543a71814 Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Fri, 22 May 2020 13:21:12 -0700 Subject: [PATCH 07/16] Install watermask and upsampledem modules --- contrib/demUtils/CMakeLists.txt | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/contrib/demUtils/CMakeLists.txt b/contrib/demUtils/CMakeLists.txt index bc1ea64..de5e950 100644 --- a/contrib/demUtils/CMakeLists.txt +++ b/contrib/demUtils/CMakeLists.txt @@ -17,8 +17,31 @@ Python_add_library(demStitch MODULE demstitcher/bindings/demStitch.c ) +Python_add_library(upsampledem MODULE + upsampledem/bindings/upsampledemmodule.cpp + upsampledem/src/upsampledem.f + upsampledem/src/upsampledemSetState.f + upsampledem/src/upsampledemState.f + ) +target_include_directories(upsampledem PRIVATE + upsampledem/include + ) +target_link_libraries(upsampledem PRIVATE + utilLib + ) + +Python_add_library(watermask MODULE + watermask/bindings/watermaskmodule.cpp + watermask/src/watermask.cpp + ) +target_include_directories(watermask PRIVATE + watermask/include + ) + InstallSameDir( demStitch + upsampledem + watermask correct_geoid_i2_srtm __init__.py correct_geoid_i2_srtm/Correct_geoid_i2_srtm.py @@ -27,6 +50,5 @@ InstallSameDir( demstitcher/DemStitcherV3.py swbdstitcher/SWBDStitcher.py upsampledem/UpsampleDem.py - watermask/test/mask.py watermask/WaterMask.py ) From 17d5f06d651b353a95020aaf80fcf9fd15ec0982 Mon Sep 17 00:00:00 2001 From: Ryan Burns <47790121+rtburns-jpl@users.noreply.github.com> Date: Fri, 22 May 2020 13:50:15 -0700 Subject: [PATCH 08/16] Add contents section links for scons/cmake --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cd8ff27..961b0ba 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,10 @@ TERRASARX, and UAVSAR. - [Note On 'python3' Exectuable Convention](#python3-convention) - [License required for dependencies to enable some workflows in ISCE](#license-required-for-dependencies-to-enable-some-workflows-in-isce) 2. [Building ISCE](#building-isce) - - [Configuration control: SCONS\_CONFIG\_DIR and SConfigISCE](#configuration-control) - - [Install ISCE](#install-isce) + - [SCons](#scons-recommended) + - [Configuration control: SCONS\_CONFIG\_DIR and SConfigISCE](#configuration-control) + - [Install ISCE](#install-isce) + - [CMake](#cmake-experimental) - [Setup Your Environment](#setup-your-environment) 3. [Running ISCE](#running-isce) - [Running ISCE from the command line](#running-isce-from-the-command-line) From 6cd15a5bcde4bfaa2d4e143e71205849fccca0dd Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Fri, 22 May 2020 15:29:44 -0700 Subject: [PATCH 09/16] Fix isceLib cython compilation --- library/isceLib/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/isceLib/CMakeLists.txt b/library/isceLib/CMakeLists.txt index 2e735a4..2bae12f 100644 --- a/library/isceLib/CMakeLists.txt +++ b/library/isceLib/CMakeLists.txt @@ -1,4 +1,5 @@ -Python_add_library(isceLib MODULE +cython_add_module(isceLib + pyx/isceLib.pyx src/Ellipsoid.cpp src/LinAlg.cpp src/Orbit.cpp From 58e39cce25548671da53a555fa26951feca11d31 Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Thu, 28 May 2020 16:59:39 -0700 Subject: [PATCH 10/16] Fix TargetX11 helper --- .cmake/TargetX11.cmake | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.cmake/TargetX11.cmake b/.cmake/TargetX11.cmake index f997883..805ae0d 100644 --- a/.cmake/TargetX11.cmake +++ b/.cmake/TargetX11.cmake @@ -5,6 +5,9 @@ set(components find_package(X11 COMPONENTS ${components}) +# The X11::{component} targets only exist for CMake ≥ 3.14, +# so we create them here for backwards compatibility. + if(X11_FOUND) # make X11 look like a regular find_package component @@ -13,11 +16,9 @@ if(X11_FOUND) list(APPEND components X11) foreach(component ${components}) - message("${component} include = ${X11_${component}_INCLUDE_PATH}") - if(X11_${component}_FOUND) - if(NOT TARGET X11::${component}) - add_library(X11::${component} IMPORTED INTERFACE) - endif() + if(X11_${component}_FOUND AND + NOT TARGET X11::${component}) + add_library(X11::${component} IMPORTED INTERFACE) target_link_libraries(X11::${component} INTERFACE ${X11_${component}_LIB}) target_include_directories(X11::${component} SYSTEM From b12fde65d81b2a43ec04fdf5b3952a2efbca50d4 Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Thu, 28 May 2020 17:51:13 -0700 Subject: [PATCH 11/16] Add PyCuAmpcor support --- CMakeLists.txt | 3 +- contrib/CMakeLists.txt | 2 +- contrib/PyCuAmpcor/CMakeLists.txt | 47 +++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 contrib/PyCuAmpcor/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 3292dc4..1b857f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,8 @@ endif() list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/.cmake) -find_package(Python 3.5 REQUIRED COMPONENTS Interpreter Development) +find_package(Python 3.5 REQUIRED COMPONENTS Interpreter Development + OPTIONAL_COMPONENTS NumPy) find_package(FFTW REQUIRED) find_package(Motif) find_package(OpenMP REQUIRED COMPONENTS C CXX Fortran) diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index 4b8ba1e..e1c8031 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -5,7 +5,7 @@ add_subdirectory(frameUtils) #add_subdirectory(unwUtils) add_subdirectory(downsample_unwrapper) -#add_subdirectory(PyCuAmpcor) +add_subdirectory(PyCuAmpcor) add_subdirectory(splitSpectrum) add_subdirectory(alos2filter) add_subdirectory(alos2proc) diff --git a/contrib/PyCuAmpcor/CMakeLists.txt b/contrib/PyCuAmpcor/CMakeLists.txt new file mode 100644 index 0000000..93a08ad --- /dev/null +++ b/contrib/PyCuAmpcor/CMakeLists.txt @@ -0,0 +1,47 @@ +# Early exit if prereqs not available +if(NOT CMAKE_CUDA_COMPILER OR + NOT TARGET GDAL::GDAL OR + NOT TARGET Python::NumPy) + return() +endif() + +set(CMAKE_CUDA_STANDARD 11) +set(CMAKE_CUDA_STANDARD_REQUIRED TRUE) + +cython_add_module(PyCuAmpcor + src/PyCuAmpcor.pyx + src/GDALImage.cu + src/SConscript + src/SlcImage.cu + src/cuAmpcorChunk.cu + src/cuAmpcorController.cu + src/cuAmpcorParameter.cu + src/cuArrays.cu + src/cuArraysCopy.cu + src/cuArraysPadding.cu + src/cuCorrFrequency.cu + src/cuCorrNormalization.cu + src/cuCorrTimeDomain.cu + src/cuDeramp.cu + src/cuEstimateStats.cu + src/cuOffset.cu + src/cuOverSampler.cu + src/cuSincOverSampler.cu + ) +target_include_directories(PyCuAmpcor PRIVATE + src + ${CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES} # + ) +target_link_directories(PyCuAmpcor PRIVATE + ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES} # cufft + ) +target_link_libraries(PyCuAmpcor PRIVATE + GDAL::GDAL + Python::NumPy + cufft + ) + +InstallSameDir( + __init__.py + PyCuAmpcor + ) From c209df26ad0850abaf428b5d44dcced0ce7471b0 Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Thu, 4 Jun 2020 11:42:37 -0700 Subject: [PATCH 12/16] Set up proper fortran module directories --- components/isceobj/Util/CMakeLists.txt | 22 +++++++++++----------- components/stdproc/stdproc/CMakeLists.txt | 9 ++++----- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/components/isceobj/Util/CMakeLists.txt b/components/isceobj/Util/CMakeLists.txt index b44a6f0..6905f71 100644 --- a/components/isceobj/Util/CMakeLists.txt +++ b/components/isceobj/Util/CMakeLists.txt @@ -81,15 +81,9 @@ add_library(utilLib SHARED target_include_directories(utilLib PUBLIC include ) -target_link_libraries(utilLib PUBLIC +target_link_libraries(utilLib PRIVATE FFTW::Float ) -# TODO (fortran module include) -# This seems to be needed to use this library's modules, -# but is there a more idiomatic way to do this? -target_include_directories(utilLib INTERFACE - ${CMAKE_CURRENT_BINARY_DIR} - ) add_library(combinedLib SHARED Library/geometry/src/geometryModule.F @@ -120,11 +114,17 @@ target_include_directories(combinedlibmodule PUBLIC target_link_libraries(combinedlibmodule PUBLIC combinedLib ) -# TODO (fortran module include) -# This seems to be needed to use this library's modules, -# but is there a more idiomatic way to do this? + +# Set up fortran module paths +set(mdir ${CMAKE_CURRENT_BINARY_DIR}/utillib_fortran_modules) +set_property(TARGET utilLib PROPERTY Fortran_MODULE_DIRECTORY ${mdir}) +target_include_directories(utilLib INTERFACE + $<$:${mdir}> + ) +set(mdir ${CMAKE_CURRENT_BINARY_DIR}/combinelib_fortran_modules) +set_property(TARGET combinedLib PROPERTY Fortran_MODULE_DIRECTORY ${mdir}) target_include_directories(combinedLib INTERFACE - ${CMAKE_CURRENT_BINARY_DIR} + $<$:${mdir}> ) install(TARGETS diff --git a/components/stdproc/stdproc/CMakeLists.txt b/components/stdproc/stdproc/CMakeLists.txt index c40da12..42795b9 100644 --- a/components/stdproc/stdproc/CMakeLists.txt +++ b/components/stdproc/stdproc/CMakeLists.txt @@ -8,15 +8,14 @@ add_library(formslcLib SHARED formslcLib/src/io.c ) set_property(TARGET formslcLib PROPERTY POSITION_INDEPENDENT_CODE ON) -target_include_directories(formslcLib PRIVATE formslcLib/include) target_link_libraries(formslcLib PUBLIC utilLib ) -# TODO (fortran module include) -# This seems to be needed to use this library's modules, -# but is there a more idiomatic way to do this? + +set(mdir ${CMAKE_CURRENT_BINARY_DIR}/formslc_fortran_modules) +set_property(TARGET formslcLib PROPERTY Fortran_MODULE_DIRECTORY ${mdir}) target_include_directories(formslcLib INTERFACE - ${CMAKE_CURRENT_BINARY_DIR} + $<$:${mdir}> ) add_subdirectory(correct) From 98efa18f1544a1eb04c50b3b681dbb12a69fff26 Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Fri, 12 Jun 2020 17:42:47 -0700 Subject: [PATCH 13/16] Use cmake findcudatoolkit --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b857f5..86db431 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,14 +2,15 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR) project(isce2 LANGUAGES C CXX Fortran) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/.cmake) + include(CheckLanguage) check_language(CUDA) if(CMAKE_CUDA_COMPILER) enable_language(CUDA) + find_package(CUDAToolkit) # TODO added in cmake 3.17 - copy this module endif() -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/.cmake) - find_package(Python 3.5 REQUIRED COMPONENTS Interpreter Development OPTIONAL_COMPONENTS NumPy) find_package(FFTW REQUIRED) From 53cceb221b030d75040dd2bb107186c2b403538b Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Fri, 12 Jun 2020 17:47:06 -0700 Subject: [PATCH 14/16] Update GPUampcor prereqs, but disable it for now --- components/zerodop/GPUampcor/CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/components/zerodop/GPUampcor/CMakeLists.txt b/components/zerodop/GPUampcor/CMakeLists.txt index 3f416e4..42d6f62 100644 --- a/components/zerodop/GPUampcor/CMakeLists.txt +++ b/components/zerodop/GPUampcor/CMakeLists.txt @@ -1,3 +1,9 @@ +if(NOT TARGET CUDA::cublas) + return() +endif() + +return() # TODO get cublas_device working or remove usage of it + cython_add_module(GPUampcor GPUampcor.pyx cuda/GPUamp.cu @@ -9,8 +15,9 @@ target_include_directories(GPUampcor PUBLIC include ) target_link_libraries(GPUampcor PRIVATE - cublas + CUDA::cublas DataAccessor_static + FFTW::Float ) InstallSameDir( GPUampcor From ed25d657fa3a79131b289610f9c179132ca4b35b Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Fri, 12 Jun 2020 17:53:40 -0700 Subject: [PATCH 15/16] Update pycuampcor prereqs --- CMakeLists.txt | 2 ++ contrib/PyCuAmpcor/CMakeLists.txt | 15 +++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 86db431..c526ec4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,8 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/.cmake) include(CheckLanguage) check_language(CUDA) if(CMAKE_CUDA_COMPILER) + set(CMAKE_CUDA_STANDARD 11) + set(CMAKE_CUDA_STANDARD_REQUIRED TRUE) enable_language(CUDA) find_package(CUDAToolkit) # TODO added in cmake 3.17 - copy this module endif() diff --git a/contrib/PyCuAmpcor/CMakeLists.txt b/contrib/PyCuAmpcor/CMakeLists.txt index 93a08ad..f6414e1 100644 --- a/contrib/PyCuAmpcor/CMakeLists.txt +++ b/contrib/PyCuAmpcor/CMakeLists.txt @@ -1,7 +1,9 @@ # Early exit if prereqs not available -if(NOT CMAKE_CUDA_COMPILER OR - NOT TARGET GDAL::GDAL OR - NOT TARGET Python::NumPy) +if(NOT TARGET GDAL::GDAL +OR NOT TARGET Python::NumPy +OR NOT TARGET CUDA::cublas +OR NOT TARGET CUDA::cufft + ) return() endif() @@ -30,15 +32,12 @@ cython_add_module(PyCuAmpcor ) target_include_directories(PyCuAmpcor PRIVATE src - ${CMAKE_CUDA_IMPLICIT_INCLUDE_DIRECTORIES} # - ) -target_link_directories(PyCuAmpcor PRIVATE - ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES} # cufft ) target_link_libraries(PyCuAmpcor PRIVATE + CUDA::cufft + CUDA::cublas GDAL::GDAL Python::NumPy - cufft ) InstallSameDir( From 14db470624e710aeea2b32eba57f18882b4e39d5 Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Mon, 15 Jun 2020 22:28:08 -0700 Subject: [PATCH 16/16] Use rpaths for linked libraries --- .cmake/isce2_buildflags.cmake | 20 +++++++++++--------- components/isceobj/Util/CMakeLists.txt | 3 ++- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.cmake/isce2_buildflags.cmake b/.cmake/isce2_buildflags.cmake index 447f0c0..a5b28b4 100644 --- a/.cmake/isce2_buildflags.cmake +++ b/.cmake/isce2_buildflags.cmake @@ -14,13 +14,15 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED y) set(CMAKE_CXX_EXTENSIONS n) -# TODO (fix RPATHs) -# We have to hack our RPATHs a bit for these shared libraries to be -# loaded by others on the install-side. Maybe these libraries should -# be combined and/or installed to a common ISCE2 lib directory. -# Is there a semantic way to propagate their RPATHs -# without using these global variables? +include(GNUInstallDirs) + +# add automatically determined parts of the RPATH, which point to directories +# outside of the build tree, to the install RPATH set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON) -list(APPEND CMAKE_INSTALL_RPATH - ${CMAKE_INSTALL_PREFIX}/${ISCE2_PKG}/components/isceobj/Util - ) + +# the RPATH to be used when installing, but only if it's not a system directory +set(abs_libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) +list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES ${abs_libdir} isSystemDir) +if("${isSystemDir}" STREQUAL "-1") + list(APPEND CMAKE_INSTALL_RPATH ${abs_libdir}) +endif() diff --git a/components/isceobj/Util/CMakeLists.txt b/components/isceobj/Util/CMakeLists.txt index 6905f71..1975968 100644 --- a/components/isceobj/Util/CMakeLists.txt +++ b/components/isceobj/Util/CMakeLists.txt @@ -130,7 +130,8 @@ target_include_directories(combinedLib INTERFACE install(TARGETS utilLib combinedLib - LIBRARY DESTINATION lib) + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) InstallSameDir( combinedlibmodule