2020-10-29 18:53:52 +01:00
|
|
|
project(ScreenPlaySysInfo LANGUAGES CXX)
|
2020-04-30 20:03:14 +02:00
|
|
|
|
2021-01-28 15:19:46 +01:00
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
2020-04-30 20:03:14 +02:00
|
|
|
set(CMAKE_AUTORCC ON)
|
2020-03-10 12:16:58 +01:00
|
|
|
set(CMAKE_AUTOMOC ON)
|
2020-04-30 20:03:14 +02:00
|
|
|
|
2021-05-12 17:09:24 +02:00
|
|
|
find_package(infoware CONFIG REQUIRED)
|
2020-04-30 20:03:14 +02:00
|
|
|
find_package(
|
2021-06-20 18:50:54 +02:00
|
|
|
QT NAMES Qt6 Qt5
|
|
|
|
COMPONENTS Quick Core
|
|
|
|
REQUIRED)
|
|
|
|
|
|
|
|
find_package(
|
|
|
|
Qt${QT_VERSION_MAJOR}
|
2020-10-29 18:53:52 +01:00
|
|
|
COMPONENTS Quick Core
|
|
|
|
REQUIRED)
|
2020-04-30 20:03:14 +02:00
|
|
|
|
2021-02-13 20:14:10 +01:00
|
|
|
set(src
|
|
|
|
screenplaysysinfo_plugin.cpp
|
|
|
|
sysinfo.cpp
|
|
|
|
cpu.cpp
|
|
|
|
ram.cpp
|
|
|
|
storage.cpp
|
2021-05-12 17:09:24 +02:00
|
|
|
uptime.cpp
|
|
|
|
gpu.cpp)
|
2021-02-13 20:14:10 +01:00
|
|
|
|
|
|
|
set(headers
|
|
|
|
screenplaysysinfo_plugin.h
|
|
|
|
sysinfo.h
|
|
|
|
cpu.h
|
|
|
|
ram.h
|
|
|
|
mathhelper.h
|
|
|
|
storage.h
|
2021-05-12 17:09:24 +02:00
|
|
|
uptime.h
|
|
|
|
gpu.h)
|
2020-03-10 12:34:34 +01:00
|
|
|
|
2020-10-29 18:53:52 +01:00
|
|
|
add_library(${PROJECT_NAME} SHARED ${src} ${headers})
|
2020-04-30 20:03:14 +02:00
|
|
|
|
2020-05-01 17:44:21 +02:00
|
|
|
# QML module deployment
|
|
|
|
set(URI "ScreenPlay/Sysinfo")
|
|
|
|
string(REPLACE "." "/" TARGETPATH ${URI})
|
2020-10-29 18:53:52 +01:00
|
|
|
if(NOT DEFINED QT_QMAKE_EXECUTABLE)
|
2021-06-20 18:50:54 +02:00
|
|
|
get_target_property(QT_QMAKE_EXECUTABLE Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION)
|
2020-10-29 18:53:52 +01:00
|
|
|
if(NOT QT_QMAKE_EXECUTABLE)
|
2020-05-01 17:44:21 +02:00
|
|
|
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}")
|
|
|
|
|
2020-07-08 17:10:27 +02:00
|
|
|
file(MAKE_DIRECTORY ${DESTDIR})
|
|
|
|
|
|
|
|
configure_file(qmldir ${DESTDIR} COPYONLY)
|
2020-05-03 13:11:26 +02:00
|
|
|
|
2020-05-01 17:44:21 +02:00
|
|
|
# Copies ScreenPlaySysInfo.* into qt qml plugins folder
|
|
|
|
add_custom_command(
|
2020-10-29 18:53:52 +01:00
|
|
|
TARGET ${PROJECT_NAME}
|
|
|
|
POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:ScreenPlaySysInfo> ${DESTDIR}/$<TARGET_FILE_NAME:ScreenPlaySysInfo>)
|
2021-06-25 16:28:30 +02:00
|
|
|
|
2021-07-11 08:27:13 +02:00
|
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Quick infoware)
|