1
0
Fork 0
VideoPlayer/CMakeLists.txt
2018-12-22 13:12:15 +00:00

90 lines
2.4 KiB
CMake

cmake_minimum_required(VERSION 3.5.1)
project(KittehPlayer)
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
set(CMAKE_AUTOMOC ON)
include(ExternalProject)
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Concurrent REQUIRED)
find_package(Qt5 CONFIG REQUIRED COMPONENTS Qml Quick Gui Widgets Core X11Extras)
find_package(Qt5QuickCompiler)
if(Qt5QuickCompiler_FOUND)
qtquick_compiler_add_resources(qml_QRC src/qml/qml.qrc)
else()
qt5_add_resources(RESOURCES src/qml/qml.qrc)
endif()
find_package(PkgConfig)
pkg_check_modules(MPV REQUIRED mpv)
pkg_check_modules(X11 x11)
pkg_check_modules(Xext xext)
execute_process(
COMMAND git clone --depth 1 https://github.com/gabime/spdlog.git
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
include_directories(${CMAKE_BINARY_DIR}/spdlog/include)
if(X11_FOUND AND Xext_FOUND)
add_definitions(-DENABLE_X11)
endif(X11_FOUND AND Xext_FOUND)
set(SOURCES
src/main.cpp
src/Backends/DirectMPV/DirectMPVBackend.cpp
src/utils.cpp
src/enums.hpp
src/Process.cpp
src/ThumbnailCache.cpp
src/logger.cpp
src/qmldebugger.cpp
)
if(MPV_VERSION VERSION_GREATER_EQUAL "1.28.0")
set(SOURCES ${SOURCES} src/Backends/MPV/MPVBackend.cpp)
else()
add_definitions(-DDISABLE_MpvPlayerBackend)
endif(MPV_VERSION VERSION_GREATER_EQUAL "1.28.0")
find_program(CCACHE_FOUND cache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)
set(CMAKE_BUILD_TYPE RELEASE)
if(DEFINED ENV{TRAVIS})
execute_process(
COMMAND git rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
find_package(Qt5Network REQUIRED)
add_definitions(-DGIT_COMMIT_HASH="${GIT_COMMIT_HASH}")
endif(DEFINED ENV{TRAVIS})
add_executable(KittehPlayer ${SOURCES} ${qml_QRC})
# Use the Qml/Quick modules from Qt 5.
target_link_libraries(KittehPlayer ${MPV_LIBRARIES} ${X11_LIBRARIES} ${Xext_LIBRARIES} Qt5::X11Extras)
include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS} ${Qt5Concurrent_INCLUDE_DIRS})
qt5_use_modules(KittehPlayer Qml Quick Core Gui Widgets X11Extras)
install (TARGETS ${PROJECT_NAME} DESTINATION bin)
install (FILES "${PROJECT_NAME}.desktop" DESTINATION share/applications)
install (FILES "${PROJECT_NAME}.png" DESTINATION share/icons/hicolor/256x256/apps)