blob: 1ddf5b06ad957b6eeb34db8e2e05be2927478a64 (
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
cmake_minimum_required(VERSION 2.6)
project(uca C)
#{{{ Sources
set(uca_SRCS
uca-camera.c
uca-plugin-manager.c
uca-ring-buffer.c
)
set(uca_HDRS
uca-camera.h
uca-plugin-manager.h
uca-ring-buffer.h
)
create_enums(uca-enums
${CMAKE_CURRENT_SOURCE_DIR}/uca-enums
${uca_HDRS})
#}}}
#{{{ Variables
if (CI_INSTALL_PREFIX)
set(UCA_PREFIX "${CI_INSTALL_PREFIX}")
endif()
#}}}
#{{{ Configure
find_program(INTROSPECTION_SCANNER "g-ir-scanner")
find_program(INTROSPECTION_COMPILER "g-ir-compiler")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libuca.pc.in"
"${CMAKE_CURRENT_BINARY_DIR}/libuca.pc" @ONLY IMMEDIATE)
#}}}
#{{{ Target
include_directories(${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR})
add_library(uca SHARED
${uca_SRCS}
${CMAKE_CURRENT_BINARY_DIR}/uca-enums.c)
set_target_properties(uca PROPERTIES
VERSION ${UCA_VERSION_STRING}
SOVERSION ${UCA_ABI_VERSION})
target_link_libraries(uca ${UCA_DEPS})
#}}}
#{{{ Python
pkg_check_modules(PYTHON python)
if (PYTHON_FOUND)
option(WITH_PYTHON_MULTITHREADING "Enable Python multithreading support" ON)
if (WITH_PYTHON_MULTITHREADING)
include_directories(${PYTHON_INCLUDE_DIRS})
target_link_libraries(uca ${PYTHON_LIBRARIES})
endif ()
endif ()
#}}}
#{{{ GObject introspection
pkg_check_modules(GOBJECT_INTROSPECTION gobject-introspection-1.0)
if (GOBJECT_INTROSPECTION_FOUND)
option(WITH_GIR "Build introspection files" ON)
if (WITH_GIR)
pkg_check_variable(gobject-introspection-1.0 g_ir_scanner)
pkg_check_variable(gobject-introspection-1.0 g_ir_compiler)
set(GIR_PREFIX "Uca-${UCA_ABI_VERSION}.0")
set(GIR_XML "${GIR_PREFIX}.gir")
set(GIR_TYPELIB "${GIR_PREFIX}.typelib")
set(_gir_input)
foreach(_src ${uca_SRCS} ${uca_HDRS})
list(APPEND _gir_input "${CMAKE_CURRENT_SOURCE_DIR}/${_src}")
endforeach()
list(APPEND _gir_input "${CMAKE_CURRENT_BINARY_DIR}/uca-enums.h")
list(APPEND _gir_input "${CMAKE_CURRENT_BINARY_DIR}/uca-enums.c")
add_custom_command(OUTPUT ${GIR_XML}
COMMAND ${GOBJECT_INTROSPECTION_1.0_G_IR_SCANNER}
--namespace=Uca
--nsversion=${UCA_ABI_VERSION}
--library=uca
--no-libtool
--include=GObject-2.0
--include=GModule-2.0
--output ${GIR_XML}
--warn-all
--quiet
${_gir_input}
DEPENDS ${uca_SRCS}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
add_custom_command(OUTPUT ${GIR_TYPELIB}
COMMAND ${GOBJECT_INTROSPECTION_1.0_G_IR_COMPILER}
-o ${GIR_TYPELIB}
${GIR_XML}
DEPENDS ${GIR_XML}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
add_custom_target(gir ALL DEPENDS ${GIR_XML} ${GIR_TYPELIB})
add_dependencies(gir uca)
endif()
endif()
#}}}
#{{{ Installation
install(TARGETS uca
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT libraries)
if(WIN32)
install(TARGETS uca
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT libraries)
endif()
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libuca.pc
DESTINATION ${CMAKE_INSTALL_PKGCONFIGDIR}
COMPONENT libraries)
install(FILES ${uca_HDRS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/uca
COMPONENT headers)
if(WITH_GIR)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${GIR_XML}
DESTINATION ${CMAKE_INSTALL_GIRDIR}
COMPONENT libraries)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${GIR_TYPELIB}
DESTINATION ${CMAKE_INSTALL_TYPELIBDIR}
COMPONENT libraries)
endif()
#}}}
#{{{ CPack
set(CPACK_PACKAGE_DESCRIPTION "Unified Camera Access library")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GObject-based library for accessing scientific cameras")
set(CPACK_PACKAGE_NAME "libuca")
# this doesn't work when building RPMs on Jenkins
set(CPACK_SET_DESTDIR ON)
set(CPACK_PACKAGE_CONTACT "Matthias Vogelgesang")
set(CPACK_PACKAGE_VENDOR "Karlsruhe Institute of Technology/IPE")
set(CPACK_PACKAGE_VERSION_MAJOR ${UCA_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${UCA_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${UCA_VERSION_PATCH})
set(VERSION ${UCA_VERSION_STRING})
set(CPACK_GENERATOR "RPM;")
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_IGNORE_FILES ".git" "tags" ".bzr" ".swp")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "libuca-${UCA_VERSION_STRING}" CACHE INTERNAL "tarball basename")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${UCA_VERSION_STRING}-${CMAKE_SYSTEM_PROCESSOR}")
include(CPack)
#}}}
|