Skip to content

Commit d9c35fe

Browse files
Modify the cmake to make it install package automatically.
1 parent 650aa2b commit d9c35fe

File tree

112 files changed

+22082
-62
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+22082
-62
lines changed

CMakeLists.txt

Lines changed: 74 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -85,59 +85,85 @@ include_directories(
8585
)
8686

8787
# ExternalProject for HDF5
88-
ExternalProject_Add(
89-
hdf5_ext
90-
URL https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.1/src/hdf5-1.10.1.tar.gz
91-
PREFIX ${CMAKE_SOURCE_DIR}/_deps/hdf5
92-
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=${DEP_INSTALL_DIR} --enable-cxx --enable-fortran --enable-shared --with-pic CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} FC=${CMAKE_Fortran_COMPILER}
93-
BUILD_COMMAND make -j${N_CORES}
94-
INSTALL_COMMAND make install
95-
UPDATE_COMMAND ""
96-
BUILD_ALWAYS FALSE
97-
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
98-
)
88+
find_library(HDF5_LIB NAMES hdf5 hdf5_serial HINTS ${DEP_INSTALL_DIR}/lib NO_DEFAULT_PATH)
89+
find_library(HDF5_HL_LIB NAMES hdf5_hl HINTS ${DEP_INSTALL_DIR}/lib NO_DEFAULT_PATH)
90+
if(NOT HDF5_LIB OR NOT HDF5_HL_LIB)
91+
ExternalProject_Add(
92+
hdf5_ext
93+
URL https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.1/src/hdf5-1.10.1.tar.gz
94+
PREFIX ${CMAKE_SOURCE_DIR}/_deps/hdf5
95+
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=${DEP_INSTALL_DIR} --enable-cxx --enable-fortran --enable-shared --with-pic CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} FC=${CMAKE_Fortran_COMPILER}
96+
BUILD_COMMAND make -j${N_CORES}
97+
INSTALL_COMMAND make install
98+
UPDATE_COMMAND ""
99+
BUILD_ALWAYS FALSE
100+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
101+
)
102+
else()
103+
message(STATUS "HDF5 found: ${HDF5_LIB}")
104+
message(STATUS "HDF5 high-level library found: ${HDF5_HL_LIB}")
105+
endif()
99106

100107
# ExternalProject for NetCDF-C (depends on HDF5)
101-
ExternalProject_Add(
102-
netcdf-c_ext
103-
URL https://github.com/Unidata/netcdf-c/archive/v4.3.3.1.tar.gz
104-
PREFIX ${CMAKE_SOURCE_DIR}/_deps/netcdf-c
105-
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=${DEP_INSTALL_DIR} --enable-netcdf-4 --enable-shared --with-pic --disable-dap CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} FC=${CMAKE_Fortran_COMPILER} CPPFLAGS=-I${DEP_INSTALL_DIR}/include LDFLAGS=-L${DEP_INSTALL_DIR}/lib
106-
BUILD_COMMAND make -j${N_CORES}
107-
INSTALL_COMMAND make install
108-
UPDATE_COMMAND ""
109-
BUILD_ALWAYS FALSE
110-
DEPENDS hdf5_ext
111-
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
112-
)
108+
find_library(NETCDF_LIB NAMES netcdf HINTS ${DEP_INSTALL_DIR}/lib NO_DEFAULT_PATH)
109+
if(NOT NETCDF_LIB)
110+
ExternalProject_Add(
111+
netcdf-c_ext
112+
URL https://github.com/Unidata/netcdf-c/archive/v4.3.3.1.tar.gz
113+
PREFIX ${CMAKE_SOURCE_DIR}/_deps/netcdf-c
114+
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=${DEP_INSTALL_DIR} --enable-netcdf-4 --enable-shared --with-pic --disable-dap CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} FC=${CMAKE_Fortran_COMPILER} CPPFLAGS=-I${DEP_INSTALL_DIR}/include LDFLAGS=-L${DEP_INSTALL_DIR}/lib
115+
BUILD_COMMAND make -j${N_CORES}
116+
INSTALL_COMMAND make install
117+
UPDATE_COMMAND ""
118+
BUILD_ALWAYS FALSE
119+
DEPENDS hdf5_ext
120+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
121+
)
122+
else()
123+
message(STATUS "NetCDF-C found in ${DEP_INSTALL_DIR}/lib")
124+
endif()
113125

114126
# ExternalProject for NetCDF-CXX (depends on NetCDF-C)
115-
ExternalProject_Add(
116-
netcdf-cxx4_ext
117-
URL https://github.com/Unidata/netcdf-cxx4/archive/v4.3.0.tar.gz
118-
PREFIX ${CMAKE_SOURCE_DIR}/_deps/netcdf-cxx4
119-
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=${DEP_INSTALL_DIR} --enable-shared --with-pic CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} CPPFLAGS=-I${DEP_INSTALL_DIR}/include LDFLAGS=-L${DEP_INSTALL_DIR}/lib
120-
BUILD_COMMAND make -j${N_CORES}
121-
INSTALL_COMMAND make install
122-
UPDATE_COMMAND ""
123-
BUILD_ALWAYS FALSE
124-
DEPENDS netcdf-c_ext
125-
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
126-
)
127+
find_library(NETCDF_CXX_LIB NAMES netcdf_c++4 HINTS ${DEP_INSTALL_DIR}/lib NO_DEFAULT_PATH)
128+
if(NOT NETCDF_CXX_LIB)
129+
ExternalProject_Add(
130+
netcdf-cxx4_ext
131+
URL https://github.com/Unidata/netcdf-cxx4/archive/v4.3.0.tar.gz
132+
PREFIX ${CMAKE_SOURCE_DIR}/_deps/netcdf-cxx4
133+
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=${DEP_INSTALL_DIR} --enable-shared --with-pic CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} CPPFLAGS=-I${DEP_INSTALL_DIR}/include LDFLAGS=-L${DEP_INSTALL_DIR}/lib
134+
BUILD_COMMAND make -j${N_CORES}
135+
INSTALL_COMMAND make install
136+
UPDATE_COMMAND ""
137+
BUILD_ALWAYS FALSE
138+
DEPENDS netcdf-c_ext
139+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
140+
)
141+
else()
142+
message(STATUS "NetCDF-C++ found in ${DEP_INSTALL_DIR}/lib")
143+
endif()
144+
127145

128146
# ExternalProject for Boost
129-
ExternalProject_Add(
130-
boost_ext
131-
URL https://archives.boost.io/release/1.87.0/source/boost_1_87_0.tar.gz
132-
PREFIX ${CMAKE_SOURCE_DIR}/_deps/boost
133-
CONFIGURE_COMMAND <SOURCE_DIR>/bootstrap.sh --prefix=${DEP_INSTALL_DIR}
134-
BUILD_COMMAND <SOURCE_DIR>/b2 -j${BOOST_BUILD_CORES} install --prefix=${DEP_INSTALL_DIR}
135-
BUILD_IN_SOURCE TRUE
136-
INSTALL_COMMAND ""
137-
UPDATE_COMMAND ""
138-
BUILD_ALWAYS FALSE
139-
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
140-
)
147+
find_library(BOOST_SYSTEM_LIB NAMES boost_system HINTS ${DEP_INSTALL_DIR}/lib NO_DEFAULT_PATH)
148+
find_library(BOOST_FILESYSTEM_LIB NAMES boost_filesystem HINTS ${DEP_INSTALL_DIR}/lib NO_DEFAULT_PATH)
149+
if(NOT BOOST_SYSTEM_LIB OR NOT BOOST_FILESYSTEM_LIB)
150+
ExternalProject_Add(
151+
boost_ext
152+
URL https://archives.boost.io/release/1.87.0/source/boost_1_87_0.tar.gz
153+
PREFIX ${CMAKE_SOURCE_DIR}/_deps/boost
154+
CONFIGURE_COMMAND <SOURCE_DIR>/bootstrap.sh --prefix=${DEP_INSTALL_DIR}
155+
BUILD_COMMAND <SOURCE_DIR>/b2 -j${BOOST_BUILD_CORES} install --prefix=${DEP_INSTALL_DIR}
156+
BUILD_IN_SOURCE TRUE
157+
INSTALL_COMMAND ""
158+
UPDATE_COMMAND ""
159+
BUILD_ALWAYS FALSE
160+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
161+
)
162+
else()
163+
message(STATUS "Boost found in ${DEP_INSTALL_DIR}/lib")
164+
set(Boost_INCLUDE_DIRS ${DEP_INSTALL_DIR}/include)
165+
set(Boost_LIBRARIES ${BOOST_SYSTEM_LIB} ${BOOST_FILESYSTEM_LIB})
166+
endif()
141167

142168
# Add rte-rrtmgp-cpp as a subdirectory
143169
add_subdirectory(external/rte-rrtmgp-cpp)
@@ -190,7 +216,7 @@ target_link_libraries(vvm2d PRIVATE
190216
)
191217

192218
# Add dependencies
193-
add_dependencies(vvm2d hdf5_ext netcdf-c_ext netcdf-cxx4_ext boost_ext)
219+
# add_dependencies(vvm2d hdf5_ext netcdf-c_ext netcdf-cxx4_ext boost_ext)
194220

195221
# Set runtime library paths (-rpath)
196222
set_target_properties(vvm2d PROPERTIES

external/rte-rrtmgp-cpp/.gitmodules

Lines changed: 0 additions & 6 deletions
This file was deleted.

external/rte-rrtmgp-cpp/config/default.cmake

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ set(USER_FC_FLAGS "-std=f2003 -fdefault-real-8 -fdefault-double-8 -fPIC -ffixed-
1616
set(USER_FC_FLAGS_RELEASE "-O3 -DNDEBUG -march=native")
1717
set(USER_FC_FLAGS_DEBUG "-O0 -g -Wall -Wno-unknown-pragmas")
1818

19-
set(NETCDF_INCLUDE_DIR "/home/Aaron/local/inlcude")
20-
set(NETCDF_LIB_C "/home/Aaron/local/lib/libnetcdf.so")
21-
set(HDF5_LIB_1 "/home/Aaron/local/lib/libhdf5.so")
22-
set(HDF5_LIB_2 "/home/Aaron/local/lib/libhdf5_hl.so")
23-
24-
set(LIBS ${NETCDF_LIB_C} ${HDF5_LIB_2} ${HDF5_LIB_1} m z curl)
19+
# set(NETCDF_INCLUDE_DIR "/home/Aaron/local/inlcude")
20+
# set(NETCDF_LIB_C "/home/Aaron/local/lib/libnetcdf.so")
21+
# set(HDF5_LIB_1 "/home/Aaron/local/lib/libhdf5.so")
22+
# set(HDF5_LIB_2 "/home/Aaron/local/lib/libhdf5_hl.so")
23+
#
24+
# set(LIBS ${NETCDF_LIB_C} ${HDF5_LIB_2} ${HDF5_LIB_1} m z curl)
2525
set(INCLUDE_DIRS ${FFTW_INCLUDE_DIR} ${NETCDF_INCLUDE_DIR})
2626

2727
add_definitions(-DRESTRICTKEYWORD=__restrict__)
Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
cff-version: 1.2.0
2+
title: "RRTMGP data"
3+
authors:
4+
- family-names: Pincus
5+
given-names: Robert
6+
orcid: "https://orcid.org/0000-0002-0016-3470"
7+
- family-names: Mlawer
8+
given-names: Eli J.
9+
orcid: "https://orcid.org/0000-0001-7962-4307"
10+
- family-names: Delamere
11+
given-names: Jennifer
12+
orcid: "https://orcid.org/0000-0001-5074-6458"
13+
- family-names: Iacono
14+
given-names: Michael J.
15+
orcid: "https://orcid.org/0000-0002-9578-0649"
16+
- family-names: Pernak
17+
given-names: Rick
18+
orcid: "https://orcid.org/0000-0002-3624-2314"
19+
type: dataset
20+
date-released: "2023-05-30"
21+
abstract: "Data for RRTMGP gas, cloud, and aersol optics; inputs and reference results for examples distributed in RTE+RRTMGP"
22+
identifiers:
23+
- description: "All versions"
24+
type: doi
25+
value: 10.5281/zenodo.7988260
26+
- description: "Version 1.7"
27+
type: doi
28+
value: 10.5281/zenodo.7988261
29+
keywords:
30+
- netCDF
31+
- "RTE+RRTMGP"
32+
- "atmospheric radiation"
33+
- "radiative transfer"
34+
- "climate model"
35+
- research
36+
license: BSD-3-Clause
37+
message: "If you use this software, please cite it using these metadata."
38+
repository-code: "https://github.com/earth-system-radiaton/rrtmgp-data"
39+
version: 1.7
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2015-2018, Atmospheric and Environmental Research and Regents of the University of Colorado.
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
* Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# About RRTMGP data
2+
3+
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7988260.svg)](https://doi.org/10.5281/zenodo.7988260)
4+
5+
This directory contains data for use with the
6+
[RRTMGP k-distribution](https://github.com/earth-system-radiation/rte-rrtmgp) for computing
7+
absorption and scattering by gases in the the earth's atmosphere, as well an example implementation
8+
of cloud optics and an implementation of aerosol optics following the MERRA aerosol description.
9+
10+
The data have been copied and renamed from the
11+
[RRTMGP repository](https://github.com/earth-system-radiation/rte-rrtmgp)
12+
at commit 74a0e09.
13+
14+
Data used by the gas optics, cloud optics, and aerosol optics schemes are in the root
15+
directory.
16+
17+
RTE+RRTMGP is distributed with some examples which are used to test implementations.
18+
The inputs and reference outputs for the current data are provided in `examples/`
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)