[x265] [PATCH 2 of 2] cmake: show multilib details in build info string
Steve Borho
steve at borho.org
Thu Aug 20 09:50:54 CEST 2015
# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1440046220 -19800
# Thu Aug 20 10:20:20 2015 +0530
# Branch stable
# Node ID 8d7b81c902a513c1c78ae1388e5db982c2b629d0
# Parent 6fb3f94d24b563d60b401d0dae9bc090f99546c0
cmake: show multilib details in build info string
multilib x265 -V will look like this:
x265 [info]: HEVC encoder version 1.7+423-6fb3f94d24b5
x265 [info]: build info [Mac OS X][clang 6.1.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
$ ./x265 -D10 -V
x265 [info]: HEVC encoder version 1.7+423-6fb3f94d24b5
x265 [info]: build info [Mac OS X][clang 6.1.0][64 bit] 10bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
diff -r 6fb3f94d24b5 -r 8d7b81c902a5 source/CMakeLists.txt
--- a/source/CMakeLists.txt Thu Aug 20 09:21:08 2015 +0530
+++ b/source/CMakeLists.txt Thu Aug 20 10:20:20 2015 +0530
@@ -287,6 +287,11 @@
if(EXTRA_LINK_FLAGS)
list(APPEND LINKER_OPTIONS ${EXTRA_LINK_FLAGS})
endif()
+if(EXTRA_LIB)
+ option(LINKED_8BIT "8bit libx265 is being linked with this library" OFF)
+ option(LINKED_10BIT "10bit libx265 is being linked with this library" OFF)
+ option(LINKED_12BIT "12bit libx265 is being linked with this library" OFF)
+endif(EXTRA_LIB)
mark_as_advanced(EXTRA_LIB EXTRA_LINK_FLAGS)
if(X64)
diff -r 6fb3f94d24b5 -r 8d7b81c902a5 source/common/CMakeLists.txt
--- a/source/common/CMakeLists.txt Thu Aug 20 09:21:08 2015 +0530
+++ b/source/common/CMakeLists.txt Thu Aug 20 10:20:20 2015 +0530
@@ -1,9 +1,21 @@
# vim: syntax=cmake
+list(APPEND VFLAGS "-DX265_VERSION=${X265_VERSION}")
+if(EXTRA_LIB)
+ if(LINKED_8BIT)
+ list(APPEND VFLAGS "-DLINKED_8BIT=1")
+ endif(LINKED_8BIT)
+ if(LINKED_10BIT)
+ list(APPEND VFLAGS "-DLINKED_10BIT=1")
+ endif(LINKED_10BIT)
+ if(LINKED_12BIT)
+ list(APPEND VFLAGS "-DLINKED_12BIT=1")
+ endif(LINKED_12BIT)
+endif(EXTRA_LIB)
+
if(ENABLE_ASSEMBLY)
set_source_files_properties(threading.cpp primitives.cpp PROPERTIES COMPILE_FLAGS -DENABLE_ASSEMBLY=1)
- set_source_files_properties(version.cpp PROPERTIES COMPILE_FLAGS
- "-DX265_VERSION=${X265_VERSION} -DENABLE_ASSEMBLY=1")
+ list(APPEND VFLAGS "-DENABLE_ASSEMBLY=1")
set(SSE3 vec/dct-sse3.cpp)
set(SSSE3 vec/dct-ssse3.cpp)
@@ -69,10 +81,12 @@
set(ASM_PRIMITIVES ${ASM_PRIMITIVES} x86/${SRC})
endforeach()
source_group(Assembly FILES ${ASM_PRIMITIVES})
-else(ENABLE_ASSEMBLY)
- set_source_files_properties(version.cpp PROPERTIES COMPILE_FLAGS -DX265_VERSION=${X265_VERSION})
endif(ENABLE_ASSEMBLY)
+# set_target_properties can't do list expansion
+string(REPLACE ";" " " VERSION_FLAGS "${VFLAGS}")
+set_source_files_properties(version.cpp PROPERTIES COMPILE_FLAGS ${VERSION_FLAGS})
+
check_symbol_exists(strtok_r "string.h" HAVE_STRTOK_R)
if(HAVE_STRTOK_R)
set_source_files_properties(param.cpp PROPERTIES COMPILE_FLAGS -DHAVE_STRTOK_R=1)
diff -r 6fb3f94d24b5 -r 8d7b81c902a5 source/common/version.cpp
--- a/source/common/version.cpp Thu Aug 20 09:21:08 2015 +0530
+++ b/source/common/version.cpp Thu Aug 20 10:20:20 2015 +0530
@@ -111,5 +111,21 @@
#endif
+#if LINKED_8BIT
+#define ADD8 "+8bit"
+#else
+#define ADD8 ""
+#endif
+#if LINKED_10BIT
+#define ADD10 "+10bit"
+#else
+#define ADD10 ""
+#endif
+#if LINKED_12BIT
+#define ADD12 "+12bit"
+#else
+#define ADD12 ""
+#endif
+
const char* PFX(version_str) = XSTR(X265_VERSION);
-const char* PFX(build_info_str) = ONOS COMPILEDBY BITS ASM ATOMICS CHECKED BITDEPTH;
+const char* PFX(build_info_str) = ONOS COMPILEDBY BITS ASM ATOMICS CHECKED BITDEPTH ADD8 ADD10 ADD12;
diff -r 6fb3f94d24b5 -r 8d7b81c902a5 source/encoder/CMakeLists.txt
--- a/source/encoder/CMakeLists.txt Thu Aug 20 09:21:08 2015 +0530
+++ b/source/encoder/CMakeLists.txt Thu Aug 20 10:20:20 2015 +0530
@@ -12,18 +12,17 @@
endif()
if(EXTRA_LIB)
- option(LINKED_8BIT "8bit libx265 is being linked with this library" OFF)
- option(LINKED_10BIT "10bit libx265 is being linked with this library" OFF)
- option(LINKED_12BIT "12bit libx265 is being linked with this library" OFF)
if(LINKED_8BIT)
- add_definitions(-DLINKED_8BIT=1)
+ list(APPEND APIFLAGS "-DLINKED_8BIT=1")
endif(LINKED_8BIT)
if(LINKED_10BIT)
- add_definitions(-DLINKED_10BIT=1)
+ list(APPEND APIFLAGS "-DLINKED_10BIT=1")
endif(LINKED_10BIT)
if(LINKED_12BIT)
- add_definitions(-DLINKED_12BIT=1)
+ list(APPEND APIFLAGS "-DLINKED_12BIT=1")
endif(LINKED_12BIT)
+ string(REPLACE ";" " " APIFLAGSTR "${APIFLAGS}")
+ set_source_files_properties(api.cpp PROPERTIES COMPILE_FLAGS ${APIFLAGSTR})
endif(EXTRA_LIB)
add_library(encoder OBJECT ../x265.h
More information about the x265-devel
mailing list