54 lines
2.0 KiB
CMake
54 lines
2.0 KiB
CMake
cmake_minimum_required(VERSION 3.16.0)
|
|
|
|
set(CMAKE_C_STANDARD 99)
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
project(Practice_Timer)
|
|
|
|
set(G_RESOURCE_DEPENDS ui/settings-window.glade ui/main-window.glade ui/edit-window.glade)
|
|
set(G_RESOURCE ${CMAKE_CURRENT_SOURCE_DIR}/practicetimer.gresource.xml)
|
|
set(G_RESOURCE_C ${CMAKE_CURRENT_SOURCE_DIR}/resources.c)
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
pkg_check_modules(GTK REQUIRED gtk+-3.0 json-glib-1.0)
|
|
|
|
add_compile_definitions(PLOTUTILS_FALLBACK_FORMAT="png" PLOTUTILS_PREFERRED_FORMAT="svg" FILE_WATCHER_POLL_RATE=60 APPLICATION_VERSION="2.2.1")
|
|
|
|
# Uncomment to force a specific path for plotutils
|
|
# set(PLOTUTILS_GRAPH_PATH "/path/to/graph")
|
|
|
|
if(DEFINED PLOTUTILS_GRAPH_PATH)
|
|
add_compile_definitions(PLOTUTILS_GRAPH_PATH="${PLOTUTILS_GRAPH_PATH}")
|
|
elseif(APPLE)
|
|
# Fix issues related to path on macOS
|
|
find_program(APPLE_GRAPH_PATH "graph")
|
|
if (DEFINED APPLE_GRAPH_PATH)
|
|
add_compile_definitions(PLOTUTILS_GRAPH_PATH="${APPLE_GRAPH_PATH}")
|
|
else()
|
|
add_compile_definitions(PLOTUTILS_GRAPH_PATH="")
|
|
endif()
|
|
else()
|
|
add_compile_definitions(PLOTUTILS_GRAPH_PATH="graph")
|
|
endif()
|
|
|
|
if(APPLE)
|
|
add_compile_definitions(IS_APPLE)
|
|
endif()
|
|
|
|
include_directories(${GTK_INCLUDE_DIRS})
|
|
link_directories(${GTK_LIBRARY_DIRS})
|
|
add_definitions(${GTK_CFLAGS_OTHER} "-Wall")
|
|
|
|
add_custom_command(OUTPUT ${G_RESOURCE_C} MAIN_DEPENDENCY ${G_RESOURCE} DEPENDS ${G_RESOURCE_DEPENDS} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PRE_BUILD COMMAND glib-compile-resources ${G_RESOURCE} --target=${G_RESOURCE_C} --generate-source)
|
|
|
|
add_custom_target(resource_target DEPENDS ${G_REOSURCE_C})
|
|
|
|
add_executable(Practice_Timer main.c TimerApplication.c TimerMainWindow.c TimerMiniWindow.c TimerEditWindow.c TimerSettingsWindow.c TimerClock.c TimerTaskTree.c TimerGraphWindow.c TimerGraph.c TimerFileWatcher.c ${G_RESOURCE_C})
|
|
|
|
set_source_files_properties(${G_RESOURCE_C} PROPERTIES GENERATED TRUE)
|
|
|
|
add_dependencies(Practice_Timer resource_target)
|
|
|
|
target_link_libraries(Practice_Timer m ${GTK_LIBRARIES})
|