Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CMake configuration #262

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.txt.user
*.txt.user.*
*.moc
moc_*.cpp
qrc_*.cpp
Expand Down
105 changes: 105 additions & 0 deletions radeon-profile/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
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)

find_library(LIBDRM drm 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
${LIBDRM}
)

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
$<$<CONFIG:Release>:QT_NO_DEBUG_OUTPUT>
)

install(TARGETS ${PROJECT_NAME}
DESTINATION bin
)

add_subdirectory(translations)
add_subdirectory(extra)
7 changes: 7 additions & 0 deletions radeon-profile/extra/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
install(FILES radeon-profile.desktop
DESTINATION share/applications
)

install(FILES radeon-profile.png
DESTINATION share/icons/hicolor/512x512/apps
)
49 changes: 49 additions & 0 deletions radeon-profile/translations/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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}
)