summaryrefslogtreecommitdiffstats
path: root/bin/gui/CMakeLists.txt
blob: a8869dd7e56ee9dcf07cab5c813162154ee3ba62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
cmake_minimum_required(VERSION 2.6)

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)

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})

    add_executable(uca-camera-control
        uca-camera-control.c
        egg-property-cell-renderer.c
        egg-property-tree-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(uca-camera-control
        m
        uca
        ${GTK2_LIBRARIES}
        ${GTHREAD2_LIBRARIES})

    install(TARGETS uca-camera-control
            RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
            COMPONENT executables)
endif()