diff options
author | Thomas White <taw@physics.org> | 2022-08-25 11:32:47 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2022-08-25 11:32:47 +0200 |
commit | d7079c3725df973d1444478881d8debfe39e065c (patch) | |
tree | 6a9b514f50af2e6db94047d3842c4ab2f1cd4702 /CMakeLists.txt | |
parent | 7f2c2fb5a158b313804775ba431f0131914db1b6 (diff) |
GUI: Get icons via a GResource
Otherwise we have to mess around with custom paths whenever CrystFEL is
installed in a non-system location.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 59419e35..7dd1a6b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,6 +58,21 @@ pkg_search_module(GTK gtk+-3.0) if (GTK_FOUND) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations") link_directories(${GTK_LIBRARY_DIRS}) + + + find_program(GLIB_COMPILE_RESOURCES NAMES glib-compile-resources REQUIRED) + + add_custom_command(OUTPUT crystfel-gresources.c + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data + VERBATIM + COMMAND ${GLIB_COMPILE_RESOURCES} + ARGS --generate-source + --target=${CMAKE_CURRENT_BINARY_DIR}/crystfel-gresources.c + crystfel.gresource.xml) + + add_custom_target(crystfel-gresources + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/crystfel-gresources.c) + endif () # If no version of GTK was found, try for GDK @@ -417,7 +432,8 @@ if (GTK_FOUND) src/gtkmultifilechooserbutton.c src/gui_backend_slurm.c) add_executable(crystfel ${CRYSTFEL_GUI_SOURCES} - ${CMAKE_CURRENT_BINARY_DIR}/version.c) + ${CMAKE_CURRENT_BINARY_DIR}/version.c + ${CMAKE_CURRENT_BINARY_DIR}/crystfel-gresources.c) target_include_directories(crystfel PRIVATE ${COMMON_INCLUDES} ${GTK_INCLUDE_DIRS}) target_link_libraries (crystfel ${COMMON_LIBRARIES} util ${GTK_LIBRARIES}) |