From 0eca06862a1385125e68a0ea9e89340555abcfbc Mon Sep 17 00:00:00 2001 From: Petr Tsymbarovich Date: Fri, 9 Apr 2021 01:13:39 +0300 Subject: [PATCH 1/2] Add CMake configuration --- .gitignore | 2 + radeon-profile/CMakeLists.txt | 102 +++++++++++++++++++++ radeon-profile/extra/CMakeLists.txt | 7 ++ radeon-profile/translations/CMakeLists.txt | 49 ++++++++++ 4 files changed, 160 insertions(+) create mode 100644 radeon-profile/CMakeLists.txt create mode 100644 radeon-profile/extra/CMakeLists.txt create mode 100644 radeon-profile/translations/CMakeLists.txt diff --git a/.gitignore b/.gitignore index 04b7a506..84c62bae 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,8 @@ *.pro.user.* *.qbs.user *.qbs.user.* +*.txt.user +*.txt.user.* *.moc moc_*.cpp qrc_*.cpp diff --git a/radeon-profile/CMakeLists.txt b/radeon-profile/CMakeLists.txt new file mode 100644 index 00000000..ee776dd7 --- /dev/null +++ b/radeon-profile/CMakeLists.txt @@ -0,0 +1,102 @@ +cmake_minimum_required(VERSION 3.19) + +project(radeon-profile + VERSION 20200824 +) + +find_package(Qt5 REQUIRED COMPONENTS + Core + Widgets + Network + Charts + LinguistTools +) + +find_package(X11 REQUIRED) + +add_executable(${PROJECT_NAME} + main.cpp + radeon_profile.cpp + uiElements.cpp + uiEvents.cpp + gpu.cpp + dxorg.cpp + settings.cpp + daemonComm.cpp + ioctlHandler.cpp + ioctl_radeon.cpp + ioctl_amdgpu.cpp + execbin.cpp + dialogs/dialog_defineplot.cpp + dialogs/dialog_rpevent.cpp + dialogs/dialog_topbarcfg.cpp + dialogs/dialog_deinetopbaritem.cpp + tab_events.cpp + tab_plots.cpp + tab_fanControl.cpp + tab_exec.cpp + tab_overclock.cpp + dialogs/dialog_sliders.cpp + dialogs/dialog_plotsconfiguration.cpp +) + +target_sources(${PROJECT_NAME} PRIVATE + radeon_profile.h + gpu.h + dxorg.h + globalStuff.h + daemonComm.h + execbin.h + rpevent.h + ioctlHandler.h + components/rpplot.h + components/pieprogressbar.h + components/topbarcomponents.h + dialogs/dialog_defineplot.h + dialogs/dialog_rpevent.h + dialogs/dialog_topbarcfg.h + dialogs/dialog_deinetopbaritem.h + dialogs/dialog_sliders.h + dialogs/dialog_plotsconfiguration.h + components/slider.h + radeon_profile.ui + components/pieprogressbar.ui + components/slider.ui + dialogs/dialog_defineplot.ui + dialogs/dialog_plotsconfiguration.ui + dialogs/dialog_rpevent.ui + dialogs/dialog_topbarcfg.ui + dialogs/dialog_deinetopbaritem.ui + dialogs/dialog_sliders.ui + radeon-resource.qrc +) + +target_link_libraries(${PROJECT_NAME} PRIVATE + Qt5::Core + Qt5::Widgets + Qt5::Network + Qt5::Charts + X11::X11 + X11::Xrandr +) + +set_target_properties(${PROJECT_NAME} PROPERTIES + AUTOMOC ON + AUTORCC ON + AUTOUIC ON +) + +target_include_directories(${PROJECT_NAME} PRIVATE + ${CMAKE_SOURCE_DIR} +) + +target_compile_definitions(${PROJECT_NAME} PRIVATE + $<$:QT_NO_DEBUG_OUTPUT> +) + +install(TARGETS ${PROJECT_NAME} + DESTINATION bin +) + +add_subdirectory(translations) +add_subdirectory(extra) diff --git a/radeon-profile/extra/CMakeLists.txt b/radeon-profile/extra/CMakeLists.txt new file mode 100644 index 00000000..1de87a2a --- /dev/null +++ b/radeon-profile/extra/CMakeLists.txt @@ -0,0 +1,7 @@ +install(FILES radeon-profile.desktop + DESTINATION share/applications +) + +install(FILES radeon-profile.png + DESTINATION share/icons/hicolor/512x512/apps +) diff --git a/radeon-profile/translations/CMakeLists.txt b/radeon-profile/translations/CMakeLists.txt new file mode 100644 index 00000000..b2497822 --- /dev/null +++ b/radeon-profile/translations/CMakeLists.txt @@ -0,0 +1,49 @@ +set(TS_FILES + strings.it.ts + strings.pl.ts + strings.hr.ts + strings.ru.ts +) + +# Generate a list of input files +set(LST_FILE "${CMAKE_CURRENT_BINARY_DIR}/sources.txt") +file(GLOB_RECURSE SOURCES "${CMAKE_SOURCE_DIR}/*.h" "${CMAKE_SOURCE_DIR}/*.cpp" "${CMAKE_SOURCE_DIR}/*.ui") +string(REPLACE ";" "\n" LST_SOURCES "${SOURCES}") +file(GENERATE + OUTPUT ${LST_FILE} + CONTENT "${LST_SOURCES}" +) + +foreach(TS ${TS_FILES}) + set(TS "${CMAKE_CURRENT_SOURCE_DIR}/${TS}") + list(APPEND TS_FILES_ABS "${TS}") + # Add a command to update ts files + add_custom_command( + OUTPUT ${TS} + COMMAND Qt5::lupdate + ARGS -no-obsolete -silent "@${LST_FILE}" -ts ${TS} + DEPENDS ${SOURCES} + ) + # Add a command to compile qm files + get_filename_component(QM ${TS} NAME_WLE) + set(QM ${QM}.qm) + list(APPEND QM_FILES ${QM}) + list(APPEND QM_FILES_ABS "${CMAKE_CURRENT_BINARY_DIR}/${QM}") + add_custom_command( + OUTPUT ${QM} + COMMAND Qt5::lrelease + ARGS -silent ${TS} -qm ${QM} + MAIN_DEPENDENCY ${TS} + ) +endforeach() + +# Install qm files +install( + FILES ${QM_FILES_ABS} + DESTINATION share/${PROJECT_NAME} +) + +add_custom_target(translations + ALL + DEPENDS ${QM_FILES} +) From 2dbb1f591b6bfa5931f76276dcb33a20abcb0b5e Mon Sep 17 00:00:00 2001 From: Petr Tsymbarovich Date: Fri, 9 Apr 2021 02:21:58 +0300 Subject: [PATCH 2/2] Require libdrm --- radeon-profile/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/radeon-profile/CMakeLists.txt b/radeon-profile/CMakeLists.txt index ee776dd7..ab2405a5 100644 --- a/radeon-profile/CMakeLists.txt +++ b/radeon-profile/CMakeLists.txt @@ -14,6 +14,8 @@ find_package(Qt5 REQUIRED COMPONENTS find_package(X11 REQUIRED) +find_library(LIBDRM drm REQUIRED) + add_executable(${PROJECT_NAME} main.cpp radeon_profile.cpp @@ -78,6 +80,7 @@ target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Charts X11::X11 X11::Xrandr + ${LIBDRM} ) set_target_properties(${PROJECT_NAME} PROPERTIES