[build] Use version info from the CMakeLists.txt

This commit is contained in:
Marko Viitanen 2022-04-28 15:32:26 +03:00
parent 6b07bb3591
commit 481fdf913b
7 changed files with 54 additions and 31 deletions

16
.gitignore vendored
View file

@ -3,8 +3,8 @@
/build/*
!/build/kvazaar_lib
/build/kvazaar_lib/*
!/build/kvazaar_lib/kvazaar_lib.vcxproj
!/build/kvazaar_lib/kvazaar_lib.vcxproj.filters
!/build/uvg266_lib/uvg266_lib.vcxproj
!/build/uvg266_lib/uvg266_lib.vcxproj.filters
/scons_build_*
# Generated documentation
@ -15,6 +15,7 @@
.deps
.dirstamp
.libs
.vs
Makefile
Makefile.in
/aclocal.m4
@ -50,8 +51,9 @@ Makefile.in
*.log
.kdev4
configure.scan
src/kvazaar
src/libkvazaar.so.*
src/kvazaar.pc
tests/kvazaar_tests
tests/kvazaar_tests.trs
src/uvg266
src/libuvg266.so.*
src/uvg266.pc
src/version.h
tests/uvg266_tests
tests/uvg266_tests.trs

View file

@ -4,9 +4,11 @@ project(uvg266
LANGUAGES C CXX
HOMEPAGE_URL https://github.com/ultravideo/uvg266
DESCRIPTION "An open-source VVC encoder licensed under 3-clause BSD"
VERSION 0.2.3)
VERSION 0.2.3 )
# Apply dynamic info to the config files
configure_file("${PROJECT_SOURCE_DIR}/src/uvg266.pc.in" "${PROJECT_SOURCE_DIR}/src/uvg266.pc" @ONLY)
configure_file("${PROJECT_SOURCE_DIR}/src/version.h.in" "${PROJECT_SOURCE_DIR}/src/version.h" @ONLY)
option(USE_SHARED_LIB "Build using shared uvg266 library" ON)
@ -66,8 +68,6 @@ else()
add_library(libuvg266 STATIC ${LIB_SOURCES})
endif()
target_compile_definitions(libuvg266 PUBLIC libuvg266)
target_include_directories(libuvg266 PUBLIC src)
target_include_directories(libuvg266 PUBLIC src/extras)
target_include_directories(libuvg266 PUBLIC src/strategies)
@ -76,16 +76,30 @@ file(GLOB LIB_SOURCES_STRATEGIES_AVX2 "src/strategies/avx2/*.c")
set(CLI_SOURCES "src/encmain.c" "src/cli.c" "src/yuv_io.c")
add_executable(uvg266 ${CLI_SOURCES})
target_link_libraries(uvg266 PUBLIC libuvg266)
if(MSVC)
target_include_directories(libuvg266 PUBLIC src/threadwrapper/include)
set_property( SOURCE ${LIB_SOURCES_STRATEGIES_AVX2} APPEND PROPERTY COMPILE_FLAGS "/arch:AVX2" )
list(APPEND CLI_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/extras/getopt.c ${CMAKE_CURRENT_SOURCE_DIR}/src/threadwrapper/src/pthread.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/threadwrapper/src/semaphore.cpp)
else()
set_property( SOURCE ${LIB_SOURCES_STRATEGIES_AVX2} APPEND PROPERTY COMPILE_FLAGS "-mavx2" )
set_property( SOURCE ${LIB_SOURCES_STRATEGIES_AVX2} APPEND PROPERTY COMPILE_FLAGS "-mavx2 -mbmi -mpopcnt -mlzcnt -mbmi2" )
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(uvg266 PUBLIC Threads::Threads)
include(CheckLibraryExists)
CHECK_LIBRARY_EXISTS(m sin "" HAVE_LIB_M)
if (HAVE_LIB_M)
set(EXTRA_LIBS ${EXTRA_LIBS} m)
endif (HAVE_LIB_M)
target_link_libraries(uvg266 PUBLIC ${EXTRA_LIBS})
endif()
add_executable(uvg266 ${CLI_SOURCES})
target_link_libraries(uvg266 PUBLIC libuvg266)
#source_group( "Header Files" FILES ${INC_FILES} )
#source_group( "Resource Files" FILES ${RESOURCE_FILE} )

View file

@ -1,4 +1,4 @@
.TH KVAZAAR "1" "March 2022" "uvg266 v2.1.0" "User Commands"
.TH UVG266 "1" "April 2022" "uvg266 v0.2.3" "User Commands"
.SH NAME
uvg266 \- open source VVC encoder
.SH SYNOPSIS

View file

@ -47,6 +47,8 @@
#include "config.h" // IWYU pragma: export
#endif
#include "version.h"
// Include some basics in all files, like assert, primitives and NULL.
// If you add anything to this list with export pragma, think long and
// and hard if it's actually a good idea to incude it for every c-file.
@ -274,13 +276,6 @@ typedef int16_t mv_t;
#define QUOTE(x) #x
#define QUOTE_EXPAND(x) QUOTE(x)
// NOTE: When making a release, check to see if incrementing libversion in
// configure.ac is necessary.
#ifndef UVG_VERSION
#define UVG_VERSION 2.1.0
#endif
#define VERSION_STRING QUOTE_EXPAND(UVG_VERSION)
//#define VERBOSE 1
#define SAO_ABS_OFFSET_MAX ((1 << (MIN(UVG_BIT_DEPTH, 10) - 5)) - 1)

View file

@ -20,7 +20,19 @@ if(MSVC)
set_property( SOURCE ${TEST_SOURCES} APPEND PROPERTY COMPILE_FLAGS "/arch:AVX2" )
add_definitions(-DWIN32_LEAN_AND_MEAN -D_WIN32 -DWIN32 -DWIN64)
else()
set_property( SOURCE ${TEST_SOURCES} APPEND PROPERTY COMPILE_FLAGS "-mavx2" )
set_property( SOURCE ${TEST_SOURCES} APPEND PROPERTY COMPILE_FLAGS "-mavx2 -mbmi -mpopcnt -mlzcnt -mbmi2" )
find_package(Threads REQUIRED)
target_link_libraries(uvg266_tests PUBLIC Threads::Threads)
include(CheckLibraryExists)
CHECK_LIBRARY_EXISTS(m sin "" HAVE_LIB_M)
if (HAVE_LIB_M)
set(EXTRA_LIBS ${EXTRA_LIBS} m)
endif (HAVE_LIB_M)
target_link_libraries(uvg266_tests PUBLIC ${EXTRA_LIBS})
endif()
add_definitions(-DCOMPILE_INTEL)

View file

@ -6,11 +6,11 @@ set -e
cd "$(dirname "$0")"
date="$(date +"%B %Y")"
version="$(awk '/#define KVZ_VERSION/ { print $3 }' ../src/global.h)"
manpage_file=../doc/kvazaar.1
version="$(awk '/VERSION/ {print $2}' ../CMakeLists.txt)"
manpage_file=../doc/uvg266.1
cat <<EOF> $manpage_file
.TH KVAZAAR "1" "$date" "uvg266 v$version" "User Commands"
.TH UVG266 "1" "$date" "uvg266 v$version" "User Commands"
.SH NAME
uvg266 \- open source VVC encoder
.SH SYNOPSIS
@ -18,7 +18,7 @@ uvg266 \- open source VVC encoder
.SH DESCRIPTION
EOF
../src/kvazaar --help 2>&1 | tail -n+5 | head -n-4 | \
../bin/uvg266 --help 2>&1 | tail -n+5 | head -n-4 | \
sed 's| : |\n|g;
s| :$||g;
s|^ --|.TP\n\\fB--|g;

View file

@ -42,7 +42,7 @@ readme_file="../README.md"
{
sed '/BEGIN UVG266 HELP MESSAGE/q' -- "$readme_file";
printf '```\n';
../src/kvazaar --help;
../bin/uvg266 --help;
printf '```\n';
sed -n '/END UVG266 HELP MESSAGE/{:a;p;n;ba}' -- "$readme_file";
} >> "$tmpfile"