mirror of
https://github.com/k4yt3x/video2x.git
synced 2025-01-15 12:18:52 +00:00
build(cmake): use GNU install directories
Signed-off-by: k4yt3x <i@k4yt3x.com>
This commit is contained in:
parent
1668c8a050
commit
7c867b1b97
@ -1,6 +1,10 @@
|
|||||||
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
|
||||||
project(video2x VERSION 6.3.1 LANGUAGES CXX)
|
project(video2x VERSION 6.3.1 LANGUAGES CXX)
|
||||||
|
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
include(ExternalProject)
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
# The FindBoost module is removed in CMake 3.30
|
# The FindBoost module is removed in CMake 3.30
|
||||||
if(POLICY CMP0167)
|
if(POLICY CMP0167)
|
||||||
cmake_policy(SET CMP0167 NEW)
|
cmake_policy(SET CMP0167 NEW)
|
||||||
@ -266,9 +270,6 @@ if(VIDEO2X_BUILD_CLI)
|
|||||||
list(APPEND VIDEO2X_LIBS Boost::program_options)
|
list(APPEND VIDEO2X_LIBS Boost::program_options)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Include ExternalProject module
|
|
||||||
include(ExternalProject)
|
|
||||||
|
|
||||||
# Add librealesrgan-ncnn-vulkan as an external project
|
# Add librealesrgan-ncnn-vulkan as an external project
|
||||||
ExternalProject_Add(
|
ExternalProject_Add(
|
||||||
realesrgan
|
realesrgan
|
||||||
@ -396,26 +397,21 @@ if(VIDEO2X_BUILD_CLI)
|
|||||||
target_link_libraries(video2x PRIVATE libvideo2x ${VIDEO2X_LIBS})
|
target_link_libraries(video2x PRIVATE libvideo2x ${VIDEO2X_LIBS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Define the default installation directories
|
# Determine the installation directories
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(BIN_DESTINATION_DEFAULT ".")
|
set(INSTALL_BIN_DESTINATION ".")
|
||||||
set(INCLUDE_DESTINATION_DEFAULT "include/libvideo2x")
|
set(INSTALL_INCLUDE_DESTINATION "include/libvideo2x")
|
||||||
set(LIB_DESTINATION_DEFAULT ".")
|
set(INSTALL_LIB_DESTINATION ".")
|
||||||
set(MODEL_DESTINATION_DEFAULT ".")
|
set(INSTALL_MODEL_DESTINATION ".")
|
||||||
|
set(INSTALL_CMAKE_DESTINATION "cmake/Video2X")
|
||||||
else()
|
else()
|
||||||
set(BIN_DESTINATION_DEFAULT "bin")
|
set(INSTALL_BIN_DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||||
set(INCLUDE_DESTINATION_DEFAULT "include/libvideo2x")
|
set(INSTALL_INCLUDE_DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/libvideo2x")
|
||||||
set(LIB_DESTINATION_DEFAULT "lib")
|
set(INSTALL_LIB_DESTINATION "${CMAKE_INSTALL_LIBDIR}")
|
||||||
set(MODEL_DESTINATION_DEFAULT "share/video2x")
|
set(INSTALL_MODEL_DESTINATION "${CMAKE_INSTALL_DATADIR}/video2x")
|
||||||
|
set(INSTALL_CMAKE_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Video2X")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Set the installation directories
|
|
||||||
set(INSTALL_BIN_DESTINATION ${BIN_DESTINATION_DEFAULT} CACHE STRING "")
|
|
||||||
set(INSTALL_INCLUDE_DESTINATION ${INCLUDE_DESTINATION_DEFAULT} CACHE STRING "")
|
|
||||||
set(INSTALL_LIB_DESTINATION ${LIB_DESTINATION_DEFAULT} CACHE STRING "")
|
|
||||||
set(INSTALL_MODEL_DESTINATION ${MODEL_DESTINATION_DEFAULT} CACHE STRING "")
|
|
||||||
set(INSTALL_CMAKE_DESTINATION "${LIB_DESTINATION_DEFAULT}/cmake/Video2X" CACHE PATH "")
|
|
||||||
|
|
||||||
# Common installation rules for libvideo2x and models
|
# Common installation rules for libvideo2x and models
|
||||||
install(TARGETS libvideo2x
|
install(TARGETS libvideo2x
|
||||||
EXPORT Video2XTargets
|
EXPORT Video2XTargets
|
||||||
@ -444,7 +440,6 @@ install(EXPORT Video2XTargets
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Generate the CMake package config file
|
# Generate the CMake package config file
|
||||||
include(CMakePackageConfigHelpers)
|
|
||||||
configure_package_config_file(
|
configure_package_config_file(
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Video2XConfig.cmake.in"
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Video2XConfig.cmake.in"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/Video2XConfig.cmake"
|
"${CMAKE_CURRENT_BINARY_DIR}/Video2XConfig.cmake"
|
||||||
|
Loading…
Reference in New Issue
Block a user