65 lines
1.7 KiB
CMake
65 lines
1.7 KiB
CMake
cmake_minimum_required(VERSION 3.16)
|
|
project(temp-monitor)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
pkg_check_modules(GTK REQUIRED gtk4)
|
|
pkg_check_modules(CAIRO REQUIRED cairo)
|
|
|
|
# Find glib-compile-resources tool
|
|
find_program(GLIB_COMPILE_RESOURCES glib-compile-resources REQUIRED)
|
|
|
|
include_directories(${CMAKE_SOURCE_DIR}/include)
|
|
include_directories(${CMAKE_BINARY_DIR})
|
|
include_directories(${GTK_INCLUDE_DIRS})
|
|
include_directories(${CAIRO_INCLUDE_DIRS})
|
|
|
|
# Compile resources
|
|
add_custom_command(
|
|
OUTPUT ${CMAKE_BINARY_DIR}/resources.c
|
|
COMMAND ${GLIB_COMPILE_RESOURCES}
|
|
--generate-source
|
|
--sourcedir=${CMAKE_SOURCE_DIR}/resources
|
|
--target=${CMAKE_BINARY_DIR}/resources.c
|
|
${CMAKE_SOURCE_DIR}/resources/resources.xml
|
|
DEPENDS ${CMAKE_SOURCE_DIR}/resources/nvme-monitor.svg
|
|
${CMAKE_SOURCE_DIR}/resources/resources.xml
|
|
)
|
|
|
|
set(SOURCES
|
|
src/main.cpp
|
|
src/mainwindow.cpp
|
|
src/temp_monitor.cpp
|
|
src/temperature_chart.cpp
|
|
src/config_manager.cpp
|
|
${CMAKE_BINARY_DIR}/resources.c
|
|
)
|
|
|
|
set(HEADERS
|
|
include/mainwindow.h
|
|
include/temp_monitor.h
|
|
include/temperature_chart.h
|
|
include/config_manager.h
|
|
)
|
|
|
|
add_executable(temp-monitor ${SOURCES} ${HEADERS})
|
|
|
|
target_link_libraries(temp-monitor
|
|
${GTK_LIBRARIES}
|
|
${CAIRO_LIBRARIES}
|
|
m
|
|
)
|
|
|
|
target_compile_options(temp-monitor PRIVATE ${GTK_CFLAGS_OTHER})
|
|
target_compile_options(temp-monitor PRIVATE ${CAIRO_CFLAGS_OTHER})
|
|
|
|
# Install executable
|
|
install(TARGETS temp-monitor
|
|
DESTINATION bin)
|
|
|
|
# Install desktop file for system integration
|
|
install(FILES resources/nvme-monitor.desktop
|
|
DESTINATION share/applications)
|