2018-10-28 13:59:29 +00:00
|
|
|
cmake_minimum_required(VERSION 3.5.1)
|
2018-10-27 16:11:29 +01:00
|
|
|
|
|
|
|
project(KittehPlayer)
|
2018-10-28 13:59:29 +00:00
|
|
|
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
|
2018-10-27 16:11:29 +01:00
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -fstrict-aliasing -Wno-deprecated-declarations -Wno-unused-variable")
|
|
|
|
|
|
|
|
option(DEVELOP "Enable runtime QML reloading for developing." OFF)
|
|
|
|
|
|
|
|
find_package(Qt5Core REQUIRED)
|
2018-10-29 14:19:12 +00:00
|
|
|
find_package(Qt5Gui REQUIRED)
|
2018-11-07 07:42:47 +00:00
|
|
|
find_package(Qt5 CONFIG REQUIRED COMPONENTS Qml Quick Gui Widgets Core X11Extras)
|
2018-10-27 16:11:29 +01:00
|
|
|
|
|
|
|
find_package(Qt5QuickCompiler)
|
|
|
|
qtquick_compiler_add_resources(qml_QRC src/qml/qml.qrc)
|
|
|
|
|
2018-10-28 13:59:29 +00:00
|
|
|
find_package(PkgConfig)
|
|
|
|
pkg_check_modules(MPV REQUIRED mpv)
|
2018-11-07 07:42:47 +00:00
|
|
|
pkg_check_modules(X11 REQUIRED x11)
|
|
|
|
pkg_check_modules(Xext REQUIRED xext)
|
2018-10-28 13:59:29 +00:00
|
|
|
|
2018-11-06 11:25:32 +00:00
|
|
|
|
2018-10-27 16:11:29 +01:00
|
|
|
set(SOURCES
|
2018-11-06 11:25:32 +00:00
|
|
|
src/main.cpp
|
2018-11-04 12:45:08 +00:00
|
|
|
src/MpvPlayerBackend.cpp
|
2018-10-27 16:11:29 +01:00
|
|
|
)
|
|
|
|
|
2018-11-06 11:25:32 +00:00
|
|
|
find_program(CCACHE_FOUND ccache)
|
|
|
|
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 MINSIZEREL)
|
|
|
|
|
|
|
|
|
2018-11-04 21:20:11 +00:00
|
|
|
if(TESTING)
|
|
|
|
SET(CMAKE_C_COMPILER "/usr/bin/clang")
|
|
|
|
SET(CMAKE_CXX_COMPILER "/usr/bin/clang++")
|
|
|
|
SET(CMAKE_AR "/usr/bin/llvm-ar")
|
|
|
|
SET(CMAKE_LINKER "/usr/bin/llvm-link")
|
|
|
|
SET(CMAKE_NM "/usr/bin/llvm-nm")
|
|
|
|
SET(CMAKE_OBJDUMP "/usr/bin/llvm-objdump")
|
|
|
|
SET(CMAKE_RANLIB "/usr/bin/llvm-ranlib")
|
|
|
|
endif(TESTING)
|
|
|
|
|
|
|
|
|
2018-10-27 16:11:29 +01:00
|
|
|
if(DEVELOP)
|
|
|
|
set(SOURCES ${SOURCES} runtimeqml/runtimeqml.cpp)
|
|
|
|
add_definitions(-DQRC_SOURCE_PATH="${PROJECT_SOURCE_DIR}/src/qml")
|
2018-10-29 14:19:12 +00:00
|
|
|
add_definitions(-DQT_QML_DEBUG)
|
2018-11-04 21:20:11 +00:00
|
|
|
|
2018-10-27 16:11:29 +01:00
|
|
|
endif(DEVELOP)
|
|
|
|
|
|
|
|
add_executable(KittehPlayer ${SOURCES} ${qml_QRC})
|
|
|
|
|
|
|
|
# Use the Qml/Quick modules from Qt 5.
|
2018-11-07 07:42:47 +00:00
|
|
|
target_link_libraries(KittehPlayer ${MPV_LIBRARIES} ${X11_LIBRARIES} ${Xext_LIBRARIES} Qt5::X11Extras)
|
2018-10-27 16:11:29 +01:00
|
|
|
|
2018-11-07 07:42:47 +00:00
|
|
|
qt5_use_modules(KittehPlayer Qml Quick Core Gui Widgets X11Extras)
|
2018-10-27 16:11:29 +01:00
|
|
|
|
2018-10-28 13:59:29 +00:00
|
|
|
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)
|
2018-10-27 16:11:29 +01:00
|
|
|
|
|
|
|
|