[x265] [PATCH 3/3] Add defines needed by client apps to .pc file
Johannes Kauffmann
johanneskauffmann at hotmail.com
Thu Jun 8 22:11:43 UTC 2023
For now, the only defines also needed by client apps are HIGH_BIT_DEPTH
and ENABLE_LIBVMAF.
Also, use HIGH_BIT_DEPTH define in public header, instead of X265_DEPTH.
---
source/CMakeLists.txt | 15 +++++++++++----
source/x265.h | 2 +-
source/x265.pc.in | 2 +-
3 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index e1c83bf97..cbbd813d2 100755
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -37,6 +37,10 @@ configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")
+# Added to the .pc file, and also passed to add_definitions() later. Use this variable
+# instead of add_definitions() for flags needed by both x265 itself and client applications.
+set(X265_PUBLIC_DEFINES "")
+
# System architecture detection
if (APPLE AND CMAKE_OSX_ARCHITECTURES)
string(TOLOWER "${CMAKE_OSX_ARCHITECTURES}" SYSPROC)
@@ -129,7 +133,7 @@ if(UNIX)
find_library(VMAF vmaf)
option(ENABLE_LIBVMAF "Enable VMAF" OFF)
if(ENABLE_LIBVMAF)
- add_definitions(-DENABLE_LIBVMAF)
+ set(X265_PUBLIC_DEFINES "${X265_PUBLIC_DEFINES} -DENABLE_LIBVMAF")
endif()
endif(UNIX)
@@ -405,14 +409,15 @@ if(X64)
option(HIGH_BIT_DEPTH "Store pixel samples as 16bit values (Main10/Main12)" OFF)
endif(X64)
if(HIGH_BIT_DEPTH)
+ set(X265_PUBLIC_DEFINES "${X265_PUBLIC_DEFINES} -DHIGH_BIT_DEPTH")
option(MAIN12 "Support Main12 instead of Main10" OFF)
if(MAIN12)
- add_definitions(-DHIGH_BIT_DEPTH=1 -DX265_DEPTH=12)
+ add_definitions(-DX265_DEPTH=12)
else()
- add_definitions(-DHIGH_BIT_DEPTH=1 -DX265_DEPTH=10)
+ add_definitions(-DX265_DEPTH=10)
endif()
else(HIGH_BIT_DEPTH)
- add_definitions(-DHIGH_BIT_DEPTH=0 -DX265_DEPTH=8)
+ add_definitions(-DX265_DEPTH=8)
endif(HIGH_BIT_DEPTH)
if (ENABLE_HDR10_PLUS)
@@ -722,6 +727,8 @@ if(ENABLE_SHARED)
endif()
endif()
+add_definitions("${X265_PUBLIC_DEFINES}")
+
if(X265_LATEST_TAG)
# convert lists of link libraries into -lstdc++ -lm etc..
foreach(LIB ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES} ${PLATFORM_LIBS})
diff --git a/source/x265.h b/source/x265.h
index d153d048e..be50639c3 100644
--- a/source/x265.h
+++ b/source/x265.h
@@ -181,7 +181,7 @@ typedef struct x265_weight_param
int wtPresent;
}x265_weight_param;
-#if X265_DEPTH < 10
+#ifndef HIGH_BIT_DEPTH
typedef uint32_t sse_t;
#else
typedef uint64_t sse_t;
diff --git a/source/x265.pc.in b/source/x265.pc.in
index 0bf99e938..993d674a2 100644
--- a/source/x265.pc.in
+++ b/source/x265.pc.in
@@ -8,4 +8,4 @@ Description: H.265/HEVC video encoder
Version: @X265_LATEST_TAG@
Libs: -L${libdir} -lx265
Libs.private: @PRIVATE_LIBS@
-Cflags: -I${includedir}
+Cflags: -I${includedir} @X265_PUBLIC_DEFINES@
--
2.34.1
More information about the x265-devel
mailing list