Skip to content

Commit 1dcb310

Browse files
rtburns-jplGitHub Enterprise
authored andcommitted
Merge pull request #721 from rtburns/c++17
Bump to C++17 and CMake 3.18, use conda spec file on CI
2 parents c6a957e + 9cd147f commit 1dcb310

File tree

14 files changed

+357
-43
lines changed

14 files changed

+357
-43
lines changed

.cmake/ConfigISCE.cmake

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,37 @@ if(CMAKE_VERSION VERSION_LESS 3.19)
1919
endif()
2020

2121
# Check that compiler supports C++17
22-
# (Only checks GCC and Clang currently)
22+
# (Only checks GCC and AppleClang currently)
2323
function(CheckCXX)
2424
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
25-
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
25+
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
2626
message(FATAL_ERROR
27-
"Insufficient GCC version - requires 6.0 or greater")
27+
"Insufficient GCC version - requires 7.0 or greater")
2828
endif()
2929
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
3030
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5)
3131
message(FATAL_ERROR
32-
"Insufficient Clang version - requires 5.0 or greater")
32+
"Insufficient AppleClang version - requires 5.0 or greater")
3333
endif()
3434
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
3535
else()
3636
message(WARNING
3737
"Unsupported compiler detected - courageously continuing")
3838
endif()
3939

40-
# Require C++17 (no extensions) for host code
40+
if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
41+
if(CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 11)
42+
message(FATAL_ERROR
43+
"NVCC 11+ required - detected ${CMAKE_CUDA_COMPILER_VERSION}")
44+
endif()
45+
# TODO: Can we check the CUDA host compiler here? We require GCC 7+
46+
endif()
47+
48+
# Require C++17 (no extensions) for all C++ and CUDA code
4149
set(CMAKE_CXX_STANDARD 17 PARENT_SCOPE)
4250
set(CMAKE_CXX_STANDARD_REQUIRED ON PARENT_SCOPE)
4351
set(CMAKE_CXX_EXTENSIONS OFF PARENT_SCOPE)
44-
# Require C++14 (no extensions) for device code
45-
set(CMAKE_CUDA_STANDARD 14 PARENT_SCOPE)
52+
set(CMAKE_CUDA_STANDARD 17 PARENT_SCOPE)
4653
set(CMAKE_CUDA_STANDARD_REQUIRED ON PARENT_SCOPE)
4754
set(CMAKE_CUDA_EXTENSIONS OFF PARENT_SCOPE)
4855

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.14)
1+
cmake_minimum_required(VERSION 3.18)
22

33
include(${CMAKE_CURRENT_LIST_DIR}/.cmake/Isce3Version.cmake)
44
isce3_get_version(ISCE3_VERSION_COMPONENTS ISCE3_VERSION_FULL)

doc/doxygen/install/centos.dox

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ISCE3 has the following dependencies
1010
<li> Numpy
1111
<li> GDAL 2.3 or above with Python bindings
1212
<li> HDF5 1.10.2 or above with h5py
13-
<li> CMake 3.14 or above
13+
<li> CMake 3.18 or above
1414
<li> CUDA 9.0 or above (for GPU-based processing)
1515
<li> ruamel.yaml
1616
</ol>

doc/doxygen/install/osx.dox

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ISCE has the following dependencies
99
<li> Numpy
1010
<li> GDAL 2.3 or above with Python bindings
1111
<li> HDF5 1.10.2 or above with h5py
12-
<li> cmake 3.12 or above
12+
<li> CMake 3.18 or above
1313
<li> ruamel yaml for python3.7
1414
</ol>
1515

extern/CMakeLists.txt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,15 @@ macro(getpackage_hdf5)
6969

7070
# XXX This target is defined as INTERFACE rather than IMPORTED so it can be
7171
# exported in order to save downstream projects from having to redefine it.
72-
add_library(hdf5 INTERFACE)
73-
add_library(HDF5::HDF5 ALIAS hdf5)
74-
set_target_properties(hdf5 PROPERTIES
75-
INTERFACE_INCLUDE_DIRECTORIES "${HDF5_INCLUDE_DIRS}"
76-
INTERFACE_LINK_LIBRARIES "${HDF5_CXX_LIBRARIES}"
77-
)
78-
79-
install(TARGETS hdf5 EXPORT isce3-targets)
72+
if(NOT TARGET HDF5::HDF5)
73+
add_library(hdf5 INTERFACE)
74+
add_library(HDF5::HDF5 ALIAS hdf5)
75+
set_target_properties(hdf5 PROPERTIES
76+
INTERFACE_INCLUDE_DIRECTORIES "${HDF5_INCLUDE_DIRS}"
77+
INTERFACE_LINK_LIBRARIES "${HDF5_CXX_LIBRARIES}"
78+
)
79+
install(TARGETS hdf5 EXPORT isce3-targets)
80+
endif()
8081
endmacro()
8182

8283
macro(getpackage_openmp_optional)

python/extensions/pybind_isce3/CMakeLists.txt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@ include(Sources.cmake)
66
set(ISCEEXTENSION pybind_isce3)
77
pybind11_add_module(${ISCEEXTENSION} ${SRCS})
88

9-
# required c++ standard
10-
# XXX nominally, c++17 is experimentally supported but it produces a long list
11-
# XXX of awful compilation errors for me (w/ g++ v6.1)
12-
set_target_properties(${ISCEEXTENSION}
13-
PROPERTIES
14-
CXX_STANDARD 14
15-
CXX_STANDARD_REQUIRED ON
16-
)
17-
189
# include path
1910
target_include_directories(${ISCEEXTENSION} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/..)
2011

tools/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,14 @@ After some local development, you can just rerun the build step - CMake will onl
6060
```sh
6161
./tools/run.py build
6262
```
63+
64+
#### Updating conda specfiles
65+
66+
See [Building identical conda environments](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#building-identical-conda-environments)
67+
68+
- Create a fresh conda environment
69+
- Install runtime dependencies from requirements.txt
70+
- `conda list --explicit > runtime/spec-file.txt`
71+
- Install dev dependencies from requirements.txt
72+
- `conda list --explicit > dev/spec-file.txt`
73+
- Make sure the dev dependencies are a superset of the runtime dependencies

tools/imagesets/centos7conda/dev/Dockerfile

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,10 @@ RUN set -ex \
1414
&& rm -rf /var/cache/yum \
1515
&& rm -rf /var/cache/yum
1616

17-
# Prefer installing from main, as forge is slow to resolve dependencies.
18-
COPY requirements.txt.main.dev /tmp/requirements.txt.main
19-
COPY requirements.txt.forge.dev /tmp/requirements.txt.forge
20-
RUN conda install --yes -c main --file /tmp/requirements.txt.main \
21-
&& conda install --yes -c conda-forge --file /tmp/requirements.txt.forge \
17+
COPY spec-file.txt /tmp/spec-file.txt
18+
RUN conda install --yes --file /tmp/spec-file.txt \
2219
&& conda clean -tipsy \
2320
&& rm -rf /opt/conda/pkgs \
24-
&& rm /tmp/requirements.txt.{main,forge}
21+
&& rm /tmp/spec-file.txt
2522

2623
ENV CUDAHOSTCXX=x86_64-conda_cos6-linux-gnu-g++
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
cmake>=3.18
12
gxx_linux-64

tools/imagesets/centos7conda/dev/requirements.txt.main.dev

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
cmake
21
eigen
32
git
43
ninja

0 commit comments

Comments
 (0)