From 2016f30dc09515b872b8fdcb254ebcfd20c1a5a8 Mon Sep 17 00:00:00 2001 From: Marko Viitanen Date: Thu, 28 Apr 2022 16:15:09 +0300 Subject: [PATCH] [build] Add install configuration to CMakeLists.txt --- CMakeLists.txt | 21 +++++++++++++++++---- src/version.h.in | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 src/version.h.in diff --git a/CMakeLists.txt b/CMakeLists.txt index fc359f45..9469e3de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) + set_property( SOURCE ${LIB_SOURCES_STRATEGIES_AVX2} APPEND PROPERTY COMPILE_FLAGS "/arch:AVX2" ) 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") diff --git a/src/version.h.in b/src/version.h.in new file mode 100644 index 00000000..d59a13f2 --- /dev/null +++ b/src/version.h.in @@ -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)