98d1bb5296
build / cmake build (CUDA 12.4, Ubuntu 22.04) (push) Failing after 3m3s
test-u4-runner / u4 runner smoke test (push) Successful in 1s
build / ffmpeg filter patch (out-of-tree) (push) Has been skipped
release / build runtime Docker image (push) Failing after 5m58s
release / build source tarball (push) Successful in 6m2s
- CHANGELOG: [Unreleased] → [0.2.0] — 2026-05-19 - CMakeLists VERSION 0.1.0 → 0.2.0 (both root + libcuframes) - CUFRAMES_VERSION_MINOR: 1 → 2 в include/cuframes/cuframes.h См. issue #2 (closed) + PR #4 (merged).
80 lines
2.6 KiB
CMake
80 lines
2.6 KiB
CMake
cmake_minimum_required(VERSION 3.20)
|
||
|
||
# libcuframes — главная shared library
|
||
find_package(CUDAToolkit REQUIRED)
|
||
find_package(Threads REQUIRED)
|
||
|
||
set(CUFRAMES_SOURCES
|
||
src/utils.c
|
||
src/protocol.c
|
||
src/producer.c
|
||
src/consumer.c
|
||
src/consumer_async.c
|
||
src/packet_ring.c
|
||
)
|
||
|
||
add_library(cuframes SHARED ${CUFRAMES_SOURCES})
|
||
add_library(cuframes_static STATIC ${CUFRAMES_SOURCES})
|
||
|
||
foreach(target cuframes cuframes_static)
|
||
target_include_directories(${target}
|
||
PUBLIC
|
||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
|
||
$<INSTALL_INTERFACE:include>
|
||
PRIVATE
|
||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||
)
|
||
target_compile_features(${target} PRIVATE c_std_11)
|
||
target_compile_options(${target} PRIVATE
|
||
-Wall -Wextra -Wpedantic
|
||
-Wno-address-of-packed-member # известная проблема atomics на packed structs (x86_64 ok)
|
||
$<$<CONFIG:Debug>:-O0 -g>
|
||
$<$<CONFIG:Release>:-O2 -g>
|
||
)
|
||
target_link_libraries(${target}
|
||
PUBLIC
|
||
CUDA::cudart
|
||
Threads::Threads
|
||
rt # для shm_open
|
||
)
|
||
endforeach()
|
||
|
||
# Set SOVERSION на shared lib для ABI tracking
|
||
set_target_properties(cuframes PROPERTIES
|
||
VERSION 0.2.0
|
||
SOVERSION 0
|
||
)
|
||
|
||
# Optionally — explicit visibility для exports. C-linkage уже handled extern "C"
|
||
# в header'е. Используем -fvisibility=hidden + указываем default для public symbols
|
||
# через __attribute__((visibility("default"))). Но мы это сделаем в v0.2 — пока
|
||
# default visibility внутри source files.
|
||
target_compile_definitions(cuframes PRIVATE CUFRAMES_BUILDING_DLL)
|
||
target_compile_definitions(cuframes_static PRIVATE CUFRAMES_STATIC_LIB)
|
||
|
||
# Override default fvisibility (на текущем этапе экспортируем всё)
|
||
foreach(target cuframes cuframes_static)
|
||
set_target_properties(${target} PROPERTIES
|
||
C_VISIBILITY_PRESET default
|
||
)
|
||
endforeach()
|
||
|
||
# Install rules — нужны для downstream проектов которые используют cmake --install
|
||
# (FFmpeg-cuframes Dockerfile builders, deb-пакетирование).
|
||
include(GNUInstallDirs)
|
||
install(TARGETS cuframes cuframes_static
|
||
EXPORT cuframesTargets
|
||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||
)
|
||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/cuframes
|
||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||
FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp"
|
||
)
|
||
|
||
# Tests
|
||
if(BUILD_TESTING)
|
||
add_subdirectory(tests)
|
||
endif()
|