Skip to content

Commit 42f9bda

Browse files
K20shoresCopilot
andauthored
read the docs (#157)
* read the docs * adding gfotran * adding dependencies * conda names, I guess * maybe this * name * adding pkg-config conda path * adding docs only target * reverting pkg config setting * adding docs only guard to tests * trying to get logo properly * removing unused page * maybe this * pr comments * adding it back * placement * Update environment.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 4999175 commit 42f9bda

11 files changed

Lines changed: 167 additions & 282 deletions

File tree

.github/workflows/gh-pages.yml

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

.readthedocs.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Read the Docs configuration file
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
---
4+
# Required
5+
version: 2
6+
7+
conda:
8+
environment: environment.yml
9+
10+
# Set the OS, Python version, and other tools you might need
11+
build:
12+
os: ubuntu-24.04
13+
tools:
14+
python: "mambaforge-22.9"
15+
16+
# Build documentation in the "docs/" directory with Sphinx
17+
sphinx:
18+
configuration: docs/source/conf.py
19+

CMakeLists.txt

Lines changed: 41 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,13 @@ option(TUVX_ENABLE_COVERAGE "Enable code coverage output" OFF)
4040
option(TUVX_ENABLE_MEMCHECK "Enable memory checking in tests" OFF)
4141
option(TUVX_ENABLE_REGRESSION_TESTS "Enable regression tests" ON)
4242
option(TUVX_BUILD_DOCS "Build the documentation" OFF)
43+
option(TUVX_DOCS_ONLY "Only build the documentation, skip library dependencies" OFF)
4344
option(TUVX_BUILD_CLI "Build the command line interface" ON)
45+
46+
# TUVX_DOCS_ONLY implies TUVX_BUILD_DOCS
47+
if(TUVX_DOCS_ONLY)
48+
set(TUVX_BUILD_DOCS ON CACHE BOOL "Build the documentation" FORCE)
49+
endif()
4450
set(TUVX_MOD_DIR "${PROJECT_BINARY_DIR}/include" CACHE PATH "Directory to find Fortran module files during the build")
4551
set(TUVX_INSTALL_MOD_DIR "${INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}" CACHE PATH "Directory to install Fortran module files")
4652
set(TUVX_INSTALL_INCLUDE_DIR "${INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}" CACHE PATH "Directory to install include files")
@@ -82,45 +88,47 @@ include(cmake/dependencies.cmake)
8288
################################################################################
8389
# TUV-x targets
8490

85-
add_subdirectory(src)
91+
if(NOT TUVX_DOCS_ONLY)
92+
add_subdirectory(src)
8693

87-
if(TUVX_BUILD_CLI)
88-
# add tuv-x standalone executable
89-
add_executable(tuv-x src/tuvx.F90)
94+
if(TUVX_BUILD_CLI)
95+
# add tuv-x standalone executable
96+
add_executable(tuv-x src/tuvx.F90)
9097

91-
set_target_properties(tuv-x
92-
PROPERTIES
93-
LINKER_LANGUAGE Fortran
94-
)
95-
96-
if(NOT BUILD_SHARED_LIBS)
9798
set_target_properties(tuv-x
9899
PROPERTIES
99-
POSITION_INDEPENDENT_CODE ON
100+
LINKER_LANGUAGE Fortran
100101
)
101-
endif()
102102

103-
target_link_libraries(tuv-x
104-
PUBLIC
105-
musica::tuvx
106-
yaml-cpp::yaml-cpp
107-
)
108-
109-
target_include_directories(tuv-x
110-
PUBLIC
111-
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
112-
$<INSTALL_INTERFACE:${TUVX_INSTALL_INCLUDE_DIR}>)
113-
114-
if(TUVX_ENABLE_OPENMP)
115-
target_link_libraries(tuv-x PUBLIC OpenMP::OpenMP_Fortran)
116-
endif()
103+
if(NOT BUILD_SHARED_LIBS)
104+
set_target_properties(tuv-x
105+
PROPERTIES
106+
POSITION_INDEPENDENT_CODE ON
107+
)
108+
endif()
117109

118-
if(TUVX_ENABLE_LAPACK)
119110
target_link_libraries(tuv-x
120-
PUBLIC
121-
${LAPACK_LIBRARIES}
122-
${BLAS_LIBRARIES}
111+
PUBLIC
112+
musica::tuvx
113+
yaml-cpp::yaml-cpp
123114
)
115+
116+
target_include_directories(tuv-x
117+
PUBLIC
118+
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
119+
$<INSTALL_INTERFACE:${TUVX_INSTALL_INCLUDE_DIR}>)
120+
121+
if(TUVX_ENABLE_OPENMP)
122+
target_link_libraries(tuv-x PUBLIC OpenMP::OpenMP_Fortran)
123+
endif()
124+
125+
if(TUVX_ENABLE_LAPACK)
126+
target_link_libraries(tuv-x
127+
PUBLIC
128+
${LAPACK_LIBRARIES}
129+
${BLAS_LIBRARIES}
130+
)
131+
endif()
124132
endif()
125133
endif()
126134

@@ -134,7 +142,7 @@ endif()
134142
################################################################################
135143
# TUV-x tests
136144

137-
if(PROJECT_IS_TOP_LEVEL AND TUVX_ENABLE_TESTS)
145+
if(PROJECT_IS_TOP_LEVEL AND TUVX_ENABLE_TESTS AND NOT TUVX_DOCS_ONLY)
138146
# Test code coverage
139147
if(TUVX_ENABLE_COVERAGE)
140148
include(CodeCoverage)
@@ -155,14 +163,14 @@ endif()
155163
# Packaging
156164

157165
# only include packaging if we are the top level project being built
158-
if(PROJECT_IS_TOP_LEVEL)
166+
if(PROJECT_IS_TOP_LEVEL AND NOT TUVX_DOCS_ONLY)
159167
add_subdirectory(packaging)
160168
endif()
161169

162170
################################################################################
163171
# benchmarking
164172

165-
if(TUVX_ENABLE_BENCHMARK AND TUVX_ENABLE_LAPACK)
173+
if(TUVX_ENABLE_BENCHMARK AND TUVX_ENABLE_LAPACK AND NOT TUVX_DOCS_ONLY)
166174
add_subdirectory(benchmark)
167175
endif()
168176

cmake/dependencies.cmake

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ include(FetchContent)
44
# ##############################################################################
55
# LAPACK
66

7-
if(TUVX_ENABLE_LAPACK)
7+
if(TUVX_ENABLE_LAPACK AND NOT TUVX_DOCS_ONLY)
88
find_package(LAPACK)
99
find_package(LAPACKE)
1010
find_package(BLAS)
@@ -13,7 +13,7 @@ endif()
1313
# ##############################################################################
1414
# Memory check
1515

16-
if(TUVX_ENABLE_MEMCHECK)
16+
if(TUVX_ENABLE_MEMCHECK AND NOT TUVX_DOCS_ONLY)
1717
find_file(
1818
MEMCHECK_SUPPRESS_FILE
1919
DOC "Suppression file for memory checking"
@@ -33,7 +33,7 @@ endif()
3333
# ##############################################################################
3434
# OpenMP
3535

36-
if(TUVX_ENABLE_OPENMP)
36+
if(TUVX_ENABLE_OPENMP AND NOT TUVX_DOCS_ONLY)
3737
find_package(OpenMP)
3838
if(OpenMP_Fortran_FOUND)
3939
message(STATUS "Compiling with OpenMP support")
@@ -46,31 +46,32 @@ endif()
4646
# ##############################################################################
4747
# NetCDF library
4848

49-
find_package(PkgConfig REQUIRED)
50-
51-
pkg_check_modules(netcdff IMPORTED_TARGET REQUIRED netcdf-fortran)
52-
pkg_check_modules(netcdfc IMPORTED_TARGET REQUIRED netcdf)
49+
if(NOT TUVX_DOCS_ONLY)
50+
pkg_check_modules(netcdff IMPORTED_TARGET REQUIRED netcdf-fortran)
51+
pkg_check_modules(netcdfc IMPORTED_TARGET REQUIRED netcdf)
52+
endif()
5353

5454
# ##############################################################################
5555
# yaml-cpp
56-
57-
FetchContent_Declare(
58-
yaml-cpp
59-
GIT_REPOSITORY https://github.com/jbeder/yaml-cpp/
60-
GIT_TAG 65c1c270dbe7eec37b2df2531d7497c4eea79aee
61-
GIT_PROGRESS NOT
62-
FIND_PACKAGE_ARGS NAMES yaml-cpp
63-
${FETCHCONTENT_QUIET})
64-
65-
set(YAML_CPP_BUILD_TOOLS OFF CACHE BOOL "" FORCE)
66-
67-
FetchContent_MakeAvailable(yaml-cpp)
68-
69-
# Ensure yaml-cpp::yaml-cpp target exists (handle both system and FetchContent scenarios)
70-
if(NOT TARGET yaml-cpp::yaml-cpp)
71-
if(TARGET yaml-cpp)
72-
# Create alias for system-installed yaml-cpp that provides 'yaml-cpp' target
73-
add_library(yaml-cpp::yaml-cpp ALIAS yaml-cpp)
56+
if(NOT TUVX_DOCS_ONLY)
57+
FetchContent_Declare(
58+
yaml-cpp
59+
GIT_REPOSITORY https://github.com/jbeder/yaml-cpp/
60+
GIT_TAG 65c1c270dbe7eec37b2df2531d7497c4eea79aee
61+
GIT_PROGRESS NOT
62+
FIND_PACKAGE_ARGS NAMES yaml-cpp
63+
${FETCHCONTENT_QUIET})
64+
65+
set(YAML_CPP_BUILD_TOOLS OFF CACHE BOOL "" FORCE)
66+
67+
FetchContent_MakeAvailable(yaml-cpp)
68+
69+
# Ensure yaml-cpp::yaml-cpp target exists (handle both system and FetchContent scenarios)
70+
if(NOT TARGET yaml-cpp::yaml-cpp)
71+
if(TARGET yaml-cpp)
72+
# Create alias for system-installed yaml-cpp that provides 'yaml-cpp' target
73+
add_library(yaml-cpp::yaml-cpp ALIAS yaml-cpp)
74+
endif()
7475
endif()
7576
endif()
7677

@@ -85,7 +86,7 @@ endif()
8586
# ##############################################################################
8687
# google test and benchmark
8788

88-
if(TUVX_ENABLE_BENCHMARK)
89+
if(TUVX_ENABLE_BENCHMARK AND NOT TUVX_DOCS_ONLY)
8990
FetchContent_Declare(
9091
googlebenchmark
9192
GIT_REPOSITORY https://github.com/google/benchmark.git
@@ -107,7 +108,7 @@ if(TUVX_ENABLE_BENCHMARK)
107108
endif()
108109
endif()
109110

110-
if(TUVX_ENABLE_TESTS)
111+
if(TUVX_ENABLE_TESTS AND NOT TUVX_DOCS_ONLY)
111112
FetchContent_Declare(
112113
googletest
113114
GIT_REPOSITORY https://github.com/google/googletest.git

docker/Dockerfile.docs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,10 @@ RUN dnf -y update \
77
gcc \
88
gcc-c++ \
99
gcc-fortran \
10-
gdb \
1110
git \
12-
lapack-devel \
13-
lcov \
1411
make \
15-
netcdf-fortran-devel \
1612
python3 \
1713
python3-pip \
18-
valgrind \
19-
yaml-cpp-devel \
2014
&& dnf clean all
2115

2216
# build the tuv-x tool
@@ -32,9 +26,7 @@ RUN echo "The suffix is '$SWITCHER_SUFFIX'"
3226
RUN mkdir /build \
3327
&& cd /build \
3428
&& cmake \
35-
-D TUVX_ENABLE_TESTS=OFF \
36-
-D TUVX_ENABLE_BENCHMARK=OFF \
37-
-D TUVX_BUILD_DOCS=ON \
29+
-D TUVX_DOCS_ONLY=ON \
3830
/tuv-x \
3931
&& make docs
4032

docs/source/_static/favicon.ico

87 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)