-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
130 lines (110 loc) · 4.53 KB
/
Copy pathCMakeLists.txt
File metadata and controls
130 lines (110 loc) · 4.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# The copyright in this software is being made available under the BSD
# License, included below. This software may be subject to other third party
# and contributor rights, including patent rights, and no such rights are
# granted under this license.
#
# Copyright (c) 2025-2026, ISO/IEC
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of the ISO/IEC nor the names of its contributors may
# be used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
# THE POSSIBILITY OF SUCH DAMAGE.
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
project(
v3c_coder
DESCRIPTION
"ISO/IEC 23090-5 Video-based visual volumetric coding (V3C) coder C++ library"
VERSION 0.4.2
LANGUAGES CXX)
include(CMakePackageConfigHelpers)
include(CTest)
include(GNUInstallDirs)
include(CheckCXXSourceCompiles)
option(v3c_coder_BUILD_APPS "Build the stand-alone executable(s)" ON)
option(v3c_coder_BUILD_TESTING "Build the unit tests" ${BUILD_TESTING})
option(v3c_coder_BUILD_PRINTER "Build the V3C HLS printing parser" ON)
option(v3c_coder_BUILD_PARSER "Build the V3C HLS parser" ON)
option(v3c_coder_BUILD_FORMATTER "Build the V3C HLS formatter" ON)
option(v3c_coder_BUILD_BIT_COUNTER "Build the V3C HLS bit counter" ON)
option(v3c_coder_BUILD_DECODER "Build the V3C decoder" ON)
option(v3c_coder_ENABLE_EXCEPTIONS "Build code that relies on exception handling" ON)
if(NOT DEFINED CMAKE_CXX_EXTENSIONS)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
if(NOT DEFINED CMAKE_CXX_STANDARD)
list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_std_23 have_cxx_std_23)
if(${have_cxx_std_23} GREATER_EQUAL 0)
set(CMAKE_CXX_STANDARD 23)
else()
set(CMAKE_CXX_STANDARD 20)
endif()
endif()
message(STATUS "C++ extensions: ${CMAKE_CXX_EXTENSIONS}")
message(STATUS "C++ standard: ${CMAKE_CXX_STANDARD}")
check_cxx_source_compiles("
#include <version>
#if defined(__cpp_lib_format) && __cpp_lib_format >= 201907L
int main() { return 0; }
#else
#error \"C++ <format> library not available\"
#endif
"
HAVE_CPP_LIB_FORMAT)
if(HAVE_CPP_LIB_FORMAT)
message(STATUS "Using C++ <format> library for C++ formatting")
else()
message(STATUS "Using fmt library for C++ formatting")
if(NOT TARGET fmt::fmt)
find_package(fmt REQUIRED)
endif()
endif()
if(WASI)
set(CMAKE_EXECUTABLE_SUFFIX ".wasm")
endif()
add_subdirectory("src")
if(v3c_coder_BUILD_TESTING)
find_package(Catch2 3 REQUIRED)
include(Catch)
add_subdirectory("test")
endif()
if(v3c_coder_BUILD_APPS)
add_subdirectory("app")
endif()
install(
EXPORT v3c-coder-targets
FILE "v3c-coder-targets.cmake"
NAMESPACE v3c_coder::
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/v3c_coder")
export(EXPORT v3c-coder-targets NAMESPACE v3c_coder::)
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/v3c_coderConfig.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/v3c-cpp-coder")
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/v3c_coderConfigVersion.cmake"
VERSION ${v3c_coder_VERSION}
COMPATIBILITY SameMinorVersion)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/v3c_coderConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/v3c_coderConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/v3c_coder")
install(FILES "LICENSE" "README.md" DESTINATION ${CMAKE_INSTALL_PREFIX})