diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2017-07-03 12:40:55 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2017-07-03 12:40:55 +0200 |
commit | 48d334acbeb665aae9c2f9f4867ff0afe836e7d3 (patch) | |
tree | 6ca13a6fbf4ef00eee73b5c76e2c9e1cbaa20293 /bin/gui/CMakeLists.txt | |
parent | f6b224b1cb6a7004a46c3606413db63f5101b816 (diff) | |
download | uca-48d334acbeb665aae9c2f9f4867ff0afe836e7d3.tar.gz uca-48d334acbeb665aae9c2f9f4867ff0afe836e7d3.tar.bz2 uca-48d334acbeb665aae9c2f9f4867ff0afe836e7d3.tar.xz uca-48d334acbeb665aae9c2f9f4867ff0afe836e7d3.zip |
gui: use glib-resources to bake in UI
Diffstat (limited to 'bin/gui/CMakeLists.txt')
-rw-r--r-- | bin/gui/CMakeLists.txt | 53 |
1 files changed, 32 insertions, 21 deletions
diff --git a/bin/gui/CMakeLists.txt b/bin/gui/CMakeLists.txt index e722ab0..a8869dd 100644 --- a/bin/gui/CMakeLists.txt +++ b/bin/gui/CMakeLists.txt @@ -1,44 +1,55 @@ cmake_minimum_required(VERSION 2.6) -#{{{ Variables -set(CMAKE_INSTALL_GLADEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/libuca") -#}}} -#{{{ Configure find_package(PkgConfig) +find_program(GLIB_COMPILE_RESOURCES glib-compile-resources REQUIRED) pkg_check_modules(GTK2 gtk+-2.0>=2.22) pkg_check_modules(GTHREAD2 gthread-2.0) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in - ${CMAKE_CURRENT_BINARY_DIR}/config.h) - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/control.glade - ${CMAKE_CURRENT_BINARY_DIR}) -#}}} -#{{{ Target if (GTK2_FOUND) + set(GRESOURCES_XML "${CMAKE_CURRENT_SOURCE_DIR}/uca-camera-control.gresource.xml") + set(GRESOURCES_H "${CMAKE_CURRENT_BINARY_DIR}/resources.h") + set(GRESOURCES_C "${CMAKE_CURRENT_BINARY_DIR}/resources.c") + + add_custom_command( + OUTPUT ${GRESOURCES_H} + COMMAND ${GLIB_COMPILE_RESOURCES} + --target ${GRESOURCES_H} + --generate-header ${GRESOURCES_XML} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/uca-camera-control.glade" ${GRESOURCES_XML} + ) + + add_custom_command( + OUTPUT ${GRESOURCES_C} + COMMAND ${GLIB_COMPILE_RESOURCES} + --target ${GRESOURCES_C} + --generate-source ${GRESOURCES_XML} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/uca-camera-control.glade" ${GRESOURCES_XML} + ) + include_directories(${GTK2_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR}) - set(BINARY "uca-camera-control") - add_executable(${BINARY} + add_executable(uca-camera-control uca-camera-control.c egg-property-cell-renderer.c egg-property-tree-view.c - egg-histogram-view.c) + egg-histogram-view.c + ${GRESOURCES_C} + ) + + add_custom_target(resources DEPENDS ${GRESOURCES_C} ${GRESOURCES_H}) + add_dependencies(uca-camera-control resources) - target_link_libraries(${BINARY} + target_link_libraries(uca-camera-control m uca ${GTK2_LIBRARIES} ${GTHREAD2_LIBRARIES}) - install(TARGETS ${BINARY} + install(TARGETS uca-camera-control RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT executables) - - install(FILES control.glade - DESTINATION ${CMAKE_INSTALL_GLADEDIR} - COMPONENT executables) endif() -#}}} |