Skip to content

Commit b20f67c

Browse files
authored
Add static library build to CI suite (#22)
This helps ensure that consumers that build static libraries (like Spark) continue to work. I also fixed a small issue in the Python packaging.
1 parent eaa4930 commit b20f67c

File tree

7 files changed

+49
-11
lines changed

7 files changed

+49
-11
lines changed

.github/workflows/build.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,14 @@ jobs:
6464
date: ${{ inputs.date }}
6565
package-name: rapids_logger
6666
package-type: cpp
67+
static-build:
68+
needs: style
69+
secrets: inherit
70+
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
71+
with:
72+
build_type: ${{ inputs.build_type || 'branch' }}
73+
branch: ${{ inputs.branch }}
74+
sha: ${{ inputs.sha }}
75+
date: ${{ inputs.date }}
76+
container_image: "rapidsai/ci-wheel:latest"
77+
run_script: "ci/build_static.sh"

.github/workflows/pr.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,11 @@ jobs:
3939
build_type: pull-request
4040
matrix_filter: group_by(.ARCH) | map(max_by([(.PY_VER|split(".")|map(tonumber)), (.CUDA_VER|split(".")|map(tonumber))]))
4141
script: ci/build_wheel.sh
42+
static-build:
43+
needs: style
44+
secrets: inherit
45+
uses: rapidsai/shared-workflows/.github/workflows/[email protected]
46+
with:
47+
build_type: pull-request
48+
container_image: "rapidsai/ci-wheel:latest"
49+
run_script: "ci/build_static.sh"

CMakeLists.txt

+8-5
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,18 @@ rapids_cmake_build_type(Release)
3333

3434
rapids_cpm_init()
3535

36-
option(RAPIDS_LOGGER_HIDE_ALL_SPDLOG_SYMBOLS
37-
"Build and link to spdlog in a way that maximizes all symbol hiding" ON
38-
)
3936
option(BUILD_TESTS "Configure CMake to build tests" ON)
4037
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
4138

4239
include(CMakeDependentOption)
43-
# If we are hiding all spdlog symbols then we need to use the bundled fmt library, so this option
44-
# depends on what the above is set to.
40+
# We cannot hide all spdlog symbols if we are building a static library.
41+
cmake_dependent_option(
42+
RAPIDS_LOGGER_HIDE_ALL_SPDLOG_SYMBOLS
43+
"Build and link to spdlog in a way that maximizes all symbol hiding" ON "BUILD_SHARED_LIBS" OFF
44+
)
45+
46+
# If we are hiding all spdlog symbols then we need to use the bundled fmt library, so this option is
47+
# only configurable if we are not hiding those symbols.
4548
cmake_dependent_option(
4649
RAPIDS_LOGGER_FMT_OPTION "The fmt option to use when building spdlog." "EXTERNAL_FMT_HO"
4750
"NOT RAPIDS_LOGGER_HIDE_ALL_SPDLOG_SYMBOLS" "BUNDLED"

ci/build_static.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
# Copyright (c) 2025, NVIDIA CORPORATION.
3+
4+
set -euo pipefail
5+
6+
source rapids-date-string
7+
8+
rapids-logger "Static cpp build"
9+
10+
cmake -S . -B build -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTS=ON
11+
cmake --build build
12+
ctest --test-dir build --output-on-failure

python/rapids-logger/rapids_logger/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from rapids_logger._version import __git_commit__, __version__
15+
from rapids_logger._version import __version__
1616
from rapids_logger.load import load_library
1717

18-
__all__ = ["__git_commit__", "__version__", "load_library"]
18+
__all__ = ["__version__", "load_library"]

tests/template/cmake_test.cmake

+7-4
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,19 @@ function(add_cmake_test source_or_dir)
4848
endforeach()
4949
endif()
5050

51+
find_program(NINJA_EXECUTABLE ninja)
52+
set(generator)
53+
if(NOT "${NINJA_EXECUTABLE}" STREQUAL "NINJA_EXECUTABLE-NOTFOUND")
54+
set(generator "-GNinja")
55+
endif()
56+
5157
set(build_dir "${CMAKE_CURRENT_BINARY_DIR}/${test_name}-build")
5258
add_test(
5359
NAME ${test_name}_configure
5460
COMMAND
5561
${CMAKE_COMMAND} -S ${src_dir} -B ${build_dir}
5662
# This function assumes _version is set in the calling file.
57-
-Drapids_logger_version=${_version}
58-
# Hardcoding Ninja to simplify things. Assumes Ninja is available when running tests, which is
59-
# not a very onerous requirement.
60-
-G Ninja ${extra_args}
63+
-Drapids_logger_version=${_version} ${generator} ${extra_args}
6164
)
6265

6366
add_test(NAME ${test_name}_build COMMAND ${CMAKE_COMMAND} --build ${build_dir})

tests/template/generate_logger_macros/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ target_include_directories(
3030
generate_logger_macros PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>"
3131
"$<INSTALL_INTERFACE:include>"
3232
)
33+
set_target_properties(generate_logger_macros PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON)

0 commit comments

Comments
 (0)