1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-07 03:22:33 +01:00
ScreenPlay/ScreenPlaySysInfo/CMakeLists.txt
Elias Steurer 4504f06eb1 Merge branch 'master' into qt6-support
# Conflicts:
#	CMakeLists.txt
#	ScreenPlay/app.h
#	ScreenPlay/main.cpp
#	ScreenPlay/main.qml
#	ScreenPlay/qml/Navigation/Navigation.qml
#	ScreenPlay/src/settings.h
#	ScreenPlay/translations/ScreenPlay_zh_cn.qm
#	ScreenPlayWallpaper/CMakeLists.txt
#	ScreenPlayWallpaper/SPWResources.qrc
#	ScreenPlayWallpaper/qml/Wallpaper.qml
2021-09-10 11:09:38 +02:00

61 lines
1.4 KiB
CMake

project(ScreenPlaySysInfo LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)
find_package(infoware CONFIG REQUIRED)
find_package(
Qt6
COMPONENTS Quick Core
REQUIRED)
set(src
screenplaysysinfo_plugin.cpp
sysinfo.cpp
cpu.cpp
ram.cpp
storage.cpp
uptime.cpp
gpu.cpp)
set(headers
screenplaysysinfo_plugin.h
sysinfo.h
cpu.h
ram.h
mathhelper.h
storage.h
uptime.h
gpu.h)
add_library(${PROJECT_NAME} SHARED ${src} ${headers})
# QML module deployment
set(URI "ScreenPlay/Sysinfo")
string(REPLACE "." "/" TARGETPATH ${URI})
if(NOT DEFINED QT_QMAKE_EXECUTABLE)
get_target_property(QT_QMAKE_EXECUTABLE Qt6::qmake IMPORTED_LOCATION)
if(NOT QT_QMAKE_EXECUTABLE)
message(FATAL_ERROR "Cannot find qmake")
endif()
endif()
execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_QML OUTPUT_VARIABLE QT_INSTALL_QML_RAW)
string(STRIP ${QT_INSTALL_QML_RAW} QT_INSTALL_QML)
set(DESTDIR "${QT_INSTALL_QML}/${TARGETPATH}")
message("DESTDIR ${DESTDIR}")
file(MAKE_DIRECTORY ${DESTDIR})
configure_file(qmldir ${DESTDIR} COPYONLY)
# Copies ScreenPlaySysInfo.* into qt qml plugins folder
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:ScreenPlaySysInfo> ${DESTDIR}/$<TARGET_FILE_NAME:ScreenPlaySysInfo>)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Core Qt6::Quick infoware)