[build] Add install configuration to CMakeLists.txt

This commit is contained in:
Marko Viitanen 2022-04-28 16:15:09 +03:00
parent 481fdf913b
commit 2016f30dc0
2 changed files with 54 additions and 4 deletions

View file

@ -76,13 +76,17 @@ file(GLOB LIB_SOURCES_STRATEGIES_AVX2 "src/strategies/avx2/*.c")
set(CLI_SOURCES "src/encmain.c" "src/cli.c" "src/yuv_io.c")
# Add the getopt and pthread for visual studio
if(MSVC)
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)
endif()
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 -mbmi -mpopcnt -mlzcnt -mbmi2" )
set(THREADS_PREFER_PTHREAD_FLAG ON)
@ -100,9 +104,18 @@ else()
target_link_libraries(uvg266 PUBLIC ${EXTRA_LIBS})
endif()
# INSTALL
#source_group( "Header Files" FILES ${INC_FILES} )
#source_group( "Resource Files" FILES ${RESOURCE_FILE} )
# ToDo: make configurable
install(FILES ${PROJECT_SOURCE_DIR}/src/uvg266.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pkgconfig)
install(TARGETS uvg266 DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
install(TARGETS libuvg266 DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
if(USE_SHARED_LIB) # Just add the lib to the bin directory for now
install(TARGETS libuvg266 DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
endif()
install(FILES ${PROJECT_SOURCE_DIR}/src/uvg266.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
install(FILES ${PROJECT_SOURCE_DIR}/doc/uvg266.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man)
# TESTS
if(EXISTS "${PROJECT_SOURCE_DIR}/greatest/greatest.h")

37
src/version.h.in Normal file
View file

@ -0,0 +1,37 @@
#pragma once
/*****************************************************************************
* This file is part of uvg266 VVC encoder.
*
* Copyright (c) 2022, Tampere University, ITU/ISO/IEC, project contributors
* 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 Tampere University or ITU/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
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
****************************************************************************/
#ifndef UVG_VERSION
#define UVG_VERSION @PROJECT_VERSION@
#endif
#define VERSION_STRING QUOTE_EXPAND(UVG_VERSION)