-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathCMakeLists.txt
409 lines (365 loc) · 17.3 KB
/
CMakeLists.txt
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
CMAKE_MINIMUM_REQUIRED (VERSION 2.8.12)
PROJECT (Oyranos)
SET (PROJECT_UP_NAME "OYRANOS" )
SET (PROJECT_DOWN_NAME "oyranos" )
SET (OYRANOS_VERSION_MAJOR 0)
SET (OYRANOS_VERSION_MINOR 9)
SET (OYRANOS_VERSION_MICRO 7)
SET (OYRANOS_DEVEL_MONTH 05)
SET (OYRANOS_DEVEL_YEAR 2022)
SET (PACKAGE_NAME "oyranos")
SET (PACKAGE_DESCRIPTION "Oyranos is a Color Management System (CMS) on operating system level. It allows to match predictably input device colors to output device colors across supporting applications. One goal is to make color management useful for all users in a automated fashion and regardless of any technical knowledge.")
#additional cmake modules for loading libraries
SET (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
IF (NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
ENDIF (NOT CMAKE_BUILD_TYPE)
# some basic and important variables
SET( DOMAIN oyranos.org ) #needed by doxygen
SET( REVERSE_DOMAIN org.oyranos )
SET( OYRANOS_VERSION "${OYRANOS_VERSION_MAJOR}.${OYRANOS_VERSION_MINOR}.${OYRANOS_VERSION_MICRO}" )
SET( OYRANOS_VERSION_MAJORMINOR "${OYRANOS_VERSION_MAJOR}.${OYRANOS_VERSION_MINOR}" )
INCLUDE(GNUInstallDirs)
OPTION(ENABLE_EXAMPLES_${PROJECT_UP_NAME} "Build example applications" ON)
option(ENABLE_TOOLS_${PROJECT_UP_NAME} "Build tools" ON)
OPTION(ENABLE_TESTS_${PROJECT_UP_NAME} "Build tests)" ON)
OPTION(ENABLE_STATIC_LIBS_${PROJECT_UP_NAME} "Build static libs" ON)
OPTION(ENABLE_SHARED_LIBS_${PROJECT_UP_NAME} "Build shared libs" ON)
OPTION(ENABLE_OPENMP "Build with OpenMP" ON)
OPTION(ENABLE_QT "Build Qt5 and Qt4 tools" ON)
OPTION(ENABLE_FLTK "Build FLTK tools" ON)
OPTION(ENABLE_DOCU_${PROJECT_UP_NAME} "Build HTML documentation out of sources" ON)
IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR} AND NOT CMAKE_CROSSCOMPILING)
SET( DOC_PATH ${CMAKE_SOURCE_DIR}/doc )
ELSE()
IF(NOT CMAKE_CROSSCOMPILING)
MESSAGE( "-- ${PROJECT_NAME}: compile as subproject - skip install (ENABLE_INSTALL_${PROJECT_UP_NAME}=OFF)" )
ENDIF()
SET(ENABLE_STATIC_LIBS_${PROJECT_UP_NAME} ON)
SET(ENABLE_SHARED_LIBS_${PROJECT_UP_NAME} OFF)
IF(NOT ENABLE_TESTS_${PROJECT_UP_NAME})
SET(ENABLE_TESTS_${PROJECT_UP_NAME} OFF)
ENDIF(NOT ENABLE_TESTS_${PROJECT_UP_NAME})
SET(ENABLE_TOOLS_${PROJECT_UP_NAME} OFF)
SET(ENABLE_EXAMPLES_${PROJECT_UP_NAME} OFF)
SET(ENABLE_DOCU_${PROJECT_UP_NAME} OFF)
MESSAGE( "-- ENABLE_STATIC_LIBS_${PROJECT_UP_NAME}: ${ENABLE_STATIC_LIBS_${PROJECT_UP_NAME}}" )
MESSAGE( "-- ENABLE_SHARED_LIBS_${PROJECT_UP_NAME}: ${ENABLE_SHARED_LIBS_${PROJECT_UP_NAME}}" )
MESSAGE( "-- ENABLE_TESTS_${PROJECT_UP_NAME}: ${ENABLE_TESTS_${PROJECT_UP_NAME}}" )
MESSAGE( "-- ENABLE_TOOLS_${PROJECT_UP_NAME}: ${ENABLE_TOOLS_${PROJECT_UP_NAME}}" )
MESSAGE( "-- ENABLE_EXAMPLES_${PROJECT_UP_NAME}: ${ENABLE_EXAMPLES_${PROJECT_UP_NAME}}" )
MESSAGE( "-- ENABLE_DOCU_${PROJECT_UP_NAME}: ${ENABLE_DOCU_${PROJECT_UP_NAME}}" )
ENDIF()
IF(CMAKE_CROSSCOMPILING)
OPTION(ENABLE_INSTALL_${PROJECT_UP_NAME} "Install files" ON)
ELSE()
# disable install and build of shared libs for fallback subproject
IF(NOT ENABLE_INSTALL_${PROJECT_UP_NAME})
SET(ENABLE_INSTALL_${PROJECT_UP_NAME} OFF)
ENDIF(NOT ENABLE_INSTALL_${PROJECT_UP_NAME})
ENDIF()
# if our static code lands inside a shared lib, we need -fPIC
SET( CMAKE_POSITION_INDEPENDENT_CODE ON)
MESSAGE( "-- Found CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}" )
IF( CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]" )
MESSAGE( "-- Info build \"${CMAKE_BUILD_TYPE}\"" )
SET( DEBUG 1 )
ENDIF()
FIND_PROGRAM(CMAKE_AR_TMP NAMES ar)
IF(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
SET(CMAKE_COMPILER_IS_CLANG 1)
ENDIF()
IF(NOT GLOBAL_PROFILE_SEARCH_PATH)
IF(${CMAKE_SYSTEM_NAME} MATCHES Android)
SET(GLOBAL_PROFILE_SEARCH_PATH -DGLOBAL_PROFILE_SEARCH_PATH="\\"/storage/sdcard0/Download\\"" CACHE STRING "Use a global path for profile search" FORCE)
ENDIF()
ENDIF()
IF(UNIX)
IF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GLOBAL_PROFILE_SEARCH_PATH}")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GLOBAL_PROFILE_SEARCH_PATH}")
# coverage testing
IF(USE_GCOV AND CMAKE_COMPILER_IS_GNUCC)
SET(ENABLE_SHARED_LIBS_${PROJECT_UP_NAME} OFF)
MESSAGE( "-- ENABLE_SHARED_LIBS_${PROJECT_UP_NAME}: ${ENABLE_SHARED_LIBS_${PROJECT_UP_NAME}} (USE_GCOV + GNUCC)" )
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
ENDIF(USE_GCOV AND CMAKE_COMPILER_IS_GNUCC)
ENDIF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
ENDIF(UNIX)
# Add /usr/local/include to search path
IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
SET(CMAKE_REQUIRED_INCLUDES "/usr/local/include" "/usr/include")
ENDIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
# detect top level projects
IF(USE_SYSTEM_ELEKTRA)
FIND_PACKAGE(ELEKTRA REQUIRED)
ELSE()
FIND_PACKAGE(ELEKTRA)
ENDIF()
IF(HAVE_ELEKTRA)
SET( ELEKTRA_SPEC "Requires: elektra
BuildRequires: elektra-devel" )
INCLUDE_DIRECTORIES( ${ELEKTRA_INCLUDE_DIRS} )
LINK_DIRECTORIES( ${ELEKTRA_LIBRARY_DIRS} )
STRING(REPLACE ";" " " ELEKTRA_PC_LDFLAGS "${ELEKTRA_STATIC_LDFLAGS}")
ENDIF(HAVE_ELEKTRA)
IF(USE_SYSTEM_OPENICC)
FIND_PACKAGE(OpenIcc REQUIRED)
ELSE()
FIND_PACKAGE(OpenIcc)
ENDIF()
IF( HAVE_OPENICC )
INCLUDE_DIRECTORIES( ${OPENICC_INCLUDE_DIR} )
LINK_DIRECTORIES( ${OPENICC_LIBRARY_DIRS} )
SET( EXTRA_LIBS_CONFIG ${EXTRA_LIBS_CONFIG} ${OPENICC_LIBRARIES} )
ELSE( HAVE_OPENICC )
IF(CMAKE_VERSION VERSION_GREATER 2.8.0)
MESSAGE( "-- Use internal: libOpenIcc" )
SET( HAVE_OPENICC TRUE )
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/openicc/src/include ${CMAKE_CURRENT_SOURCE_DIR}/openicc/src/libopenicc )
LINK_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}/openicc/src/libopenicc )
ADD_SUBDIRECTORY( openicc )
SET( OPENICC_LIBRARIES openicc-static )
SET( EXTRA_LIBS_CONFIG ${EXTRA_LIBS_CONFIG} ${OPENICC_LIBRARIES} )
ENDIF()
ENDIF( HAVE_OPENICC )
IF(USE_SYSTEM_OYJL)
FIND_PACKAGE(Oyjl REQUIRED)
ELSE()
FIND_PACKAGE(Oyjl)
ENDIF()
IF(HAVE_OYJL)
INCLUDE_DIRECTORIES( ${OYJL_INCLUDE_DIR} )
SET( OYJL_JSON_TOOL oyjl-translate )
ELSE(HAVE_OYJL)
MESSAGE( "-- Use internal: libOyjl" )
SET (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/openicc/oyjl/cmake")
INCLUDE_DIRECTORIES( openicc/oyjl )
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}/openicc/oyjl )
LINK_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}/openicc/oyjl )
SET( OYJL_LIBRARIES oyjl-static )
SET( OYJL_CORE_LIBRARIES oyjl-core-static )
SET( OYJL_JSON_TOOL ${CMAKE_BINARY_DIR}/openicc/oyjl/oyjl-translate-bootstrap )
SET( OYJL_JSON_TOOL_DEPENDS oyjl-translate-bootstrap )
INSTALL (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/openicc/oyjl/oyjl-translate DESTINATION ${CMAKE_INSTALL_BINDIR})
IF(ENABLE_SHARED_LIBS_OYJL)
INSTALL( TARGETS OyjlCore
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
FRAMEWORK DESTINATION ${FRAMEWORK_DIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/oyjl
RESOURCE DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}
)
INSTALL( TARGETS Oyjl
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
FRAMEWORK DESTINATION ${FRAMEWORK_DIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/oyjl
RESOURCE DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}
)
INSTALL( TARGETS OyjlArgsCli
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
FRAMEWORK DESTINATION ${FRAMEWORK_DIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/oyjl
RESOURCE DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}
)
ENDIF()
FIND_PACKAGE(Qt5 COMPONENTS Widgets Qml Quick Svg LinguistTools)
IF(Qt5Qml_FOUND)
INSTALL (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/openicc/oyjl/oyjl-args-qml/oyjl-args-qml DESTINATION ${CMAKE_INSTALL_BINDIR})
IF(ENABLE_SHARED_LIBS_OYJL)
INSTALL( TARGETS OyjlArgsQml
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
FRAMEWORK DESTINATION ${FRAMEWORK_DIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/oyjl
RESOURCE DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}
)
ENDIF()
ENDIF()
SET( CHEADERS_OYJL_PUBLIC
openicc/oyjl/oyjl_macros.h
openicc/oyjl/oyjl_test.h
openicc/oyjl/oyjl_test_main.h
${CMAKE_BINARY_DIR}/openicc/oyjl/oyjl_version.h
openicc/oyjl/oyjl.h
)
INSTALL (FILES ${CHEADERS_OYJL_PUBLIC} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/oyjl)
IF(OYJL_HAVE_MHD)
INSTALL( TARGETS OyjlArgsWeb
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
FRAMEWORK DESTINATION ${FRAMEWORK_DIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/oyjl
RESOURCE DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}
)
ENDIF(OYJL_HAVE_MHD)
SET( OYJL_LINGUAS cs de eo eu fr ru )
FOREACH( oy_lang ${OYJL_LINGUAS} )
INSTALL( FILES "${CMAKE_CURRENT_BINARY_DIR}/openicc/oyjl/${oy_lang}.gmo" DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/locale/${oy_lang}/LC_MESSAGES/ RENAME oyjl.mo )
ENDFOREACH( oy_lang )
ENDIF(HAVE_OYJL)
SET( EXTRA_LIBS_CORE ${EXTRA_LIBS_CORE} ${OYJL_CORE_LIBRARIES} )
SET( EXTRA_LIBS ${EXTRA_LIBS} ${OYJL_LIBRARIES} )
IF(${CMAKE_SYSTEM_NAME} MATCHES Android)
SET( EXTRA_LIBS_CORE ${EXTRA_LIBS_CORE} log )
ENDIF()
FIND_PACKAGE(DBus)
IF( DBUS_FOUND )
INCLUDE_DIRECTORIES( ${DBUS_INCLUDE_DIR} ${DBUS_ARCH_INCLUDE_DIR} )
SET(HAVE_DBUS 1)
SET( DBUS_LIBS ${DBUS_LIBRARIES} ${THREAD_LIBRARY} )
SET( EXTRA_LIBS_CONFIG ${EXTRA_LIBS_CONFIG} ${DBUS_LIBS} )
ELSE( DBUS_FOUND )
SET( DBUS_LIBS "" )
ENDIF( DBUS_FOUND )
FIND_PACKAGE( X11 )
IF(X11_FOUND)
INCLUDE_DIRECTORIES( ${X11_INCLUDE_DIRS} )
LINK_DIRECTORIES( ${X11_LIBRARY_DIRS} )
SET( X11_EXTRA_LIBS ${X11_LIBRARIES} )
FIND_PACKAGE( Xfixes )
INCLUDE_DIRECTORIES( ${XFIXES_INCLUDE_DIRS} )
LINK_DIRECTORIES( ${XFIXES_LIBRARY_DIRS} )
IF( HAVE_XFIXES )
SET( X11_EXTRA_LIBS ${X11_EXTRA_LIBS} ${XFIXES_LIBRARIES} )
SET( HAVE_X11 1 )
ENDIF( HAVE_XFIXES )
FIND_PACKAGE( XRandR )
INCLUDE_DIRECTORIES( ${XRANDR_INCLUDE_DIRS} )
LINK_DIRECTORIES( ${XRANDR_LIBRARY_DIRS} )
IF( HAVE_XRANDR )
SET( X11_EXTRA_LIBS ${X11_EXTRA_LIBS} ${XRANDR_LIBRARIES} )
ENDIF( HAVE_XRANDR )
FIND_PACKAGE( Xinerama )
INCLUDE_DIRECTORIES( ${XINERAMA_INCLUDE_DIRS} )
LINK_DIRECTORIES( ${XINERAMA_LIBRARY_DIRS} )
IF( HAVE_XINERAMA )
SET( X11_EXTRA_LIBS ${X11_EXTRA_LIBS} ${XINERAMA_LIBRARIES} )
ENDIF( HAVE_XINERAMA )
FIND_PACKAGE( Xxf86vm )
INCLUDE_DIRECTORIES( ${XXF86VM_INCLUDE_DIRS} )
LINK_DIRECTORIES( ${XXF86VM_LIBRARY_DIRS} )
IF( HAVE_XXF86VM )
SET( X11_EXTRA_LIBS ${X11_EXTRA_LIBS} ${XXF86VM_LIBRARIES} )
ENDIF( HAVE_XXF86VM )
ENDIF(X11_FOUND)
IF(USE_SYSTEM_LIBXCM)
FIND_PACKAGE(Xcm REQUIRED)
ELSE()
FIND_PACKAGE(Xcm)
ENDIF()
IF( HAVE_XCM )
INCLUDE_DIRECTORIES( ${XCM_INCLUDE_DIRS} )
LINK_DIRECTORIES( ${XCM_LIBRARY_DIRS} )
ELSE( HAVE_XCM )
IF(CMAKE_VERSION VERSION_GREATER 2.8.0)
# build static libs of fallback subproject
MESSAGE( "-- Use internal: libxcm" )
SET( HAVE_XCM TRUE )
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/libxcm/include/X11/Xcm
${CMAKE_CURRENT_SOURCE_DIR}/libxcm/include
${CMAKE_BINARY_DIR}/src/include/X11/Xcm )
LINK_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}/libxcm/src )
ADD_SUBDIRECTORY( libxcm )
SET( XCM_LIBRARIES xcm-static )
IF( HAVE_X11 )
SET( XCM_LIBRARIES ${XCM_LIBRARIES} ${X11_EXTRA_LIBS} )
ENDIF( HAVE_X11 )
ENDIF()
ENDIF( HAVE_XCM )
IF(USE_SYSTEM_LIBXML2)
FIND_PACKAGE(LibXML2 REQUIRED)
ELSE()
FIND_PACKAGE(LibXML2)
ENDIF()
IF(LIBXML2_FOUND)
INCLUDE_DIRECTORIES( ${LIBXML2_INCLUDE_DIR} )
LINK_DIRECTORIES( ${LIBXML2_LIBRARY_DIRS} )
SET( HAVE_LIBXML2 1 )
ELSE( LIBXML2_FOUND )
MESSAGE( "-- Use internal: libxml2" )
SET( HAVE_LIBXML2 TRUE )
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/openicc/oyjl )
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/openicc/oyjl/libxml2 )
ENDIF(LIBXML2_FOUND)
#now add all directories
ADD_SUBDIRECTORY( cmake )
SET( OY_CMMSUBPATH "${TARGET_PLUGIN_FOLDER}" )
SET( OY_METASUBPATH "${TARGET_PLUGIN_LOADER_FOLDER}" )
SET( OY_ICC_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/color/icc" )
ADD_SUBDIRECTORY( color )
ADD_SUBDIRECTORY( src )
ADD_SUBDIRECTORY( extras )
IF(ENABLE_DOCU_${PROJECT_UP_NAME})
ADD_SUBDIRECTORY( doc )
ENDIF(ENABLE_DOCU_${PROJECT_UP_NAME})
CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/OyranosUninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake/OyranosUninstall.cmake"
IMMEDIATE @ONLY)
ADD_CUSTOM_TARGET( uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake/OyranosUninstall.cmake")
ADD_CUSTOM_TARGET( dist
COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR}/ && git archive --prefix=oyranos-${OYRANOS_VERSION}/ --format=tar HEAD > ${CMAKE_CURRENT_BINARY_DIR}/oyranos-${OYRANOS_VERSION}.tar
COMMAND echo "git: git clone git://guthub.com/oyranos-cms/oyranos.git" > ${CMAKE_CURRENT_BINARY_DIR}/oyranos-${OYRANOS_VERSION}.tar.bz2.hashsum
COMMAND echo "git sha1: " | tr -d "\\n" >> ${CMAKE_CURRENT_BINARY_DIR}/oyranos-${OYRANOS_VERSION}.tar.bz2.hashsum
COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR}/ && git rev-parse HEAD >> ${CMAKE_CURRENT_BINARY_DIR}/oyranos-${OYRANOS_VERSION}.tar.bz2.hashsum
COMMAND rm -rf oyranos-${OYRANOS_VERSION} && tar xf oyranos-${OYRANOS_VERSION}.tar
COMMAND tar cf - oyranos-${OYRANOS_VERSION} | bzip2 > oyranos-${OYRANOS_VERSION}.tar.bz2
COMMAND echo "package: http://sourceforge.net/projects/oyranos/files/Oyranos/Oyranos%20${OYRANOS_VERSION_MAJORMINOR}/oyranos-${OYRANOS_VERSION}.tar.bz2" >> oyranos-${OYRANOS_VERSION}.tar.bz2.hashsum
COMMAND echo "size: " | tr -d "\\n" >> oyranos-${OYRANOS_VERSION}.tar.bz2.hashsum
COMMAND du -b oyranos-${OYRANOS_VERSION}.tar.bz2 | sed s/[[:space:]][[:print:]]*// >> oyranos-${OYRANOS_VERSION}.tar.bz2.hashsum
COMMAND echo "md5sum: " | tr -d "\\n" >> oyranos-${OYRANOS_VERSION}.tar.bz2.hashsum
COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/ && md5sum oyranos-${OYRANOS_VERSION}.tar.bz2 >> oyranos-${OYRANOS_VERSION}.tar.bz2.hashsum
COMMAND echo "sha1sum: " | tr -d "\\n" >> oyranos-${OYRANOS_VERSION}.tar.bz2.hashsum
COMMAND sha1sum oyranos-${OYRANOS_VERSION}.tar.bz2 >> oyranos-${OYRANOS_VERSION}.tar.bz2.hashsum
COMMAND echo "sha256sum: " | tr -d "\\n" >> oyranos-${OYRANOS_VERSION}.tar.bz2.hashsum
COMMAND sha256sum oyranos-${OYRANOS_VERSION}.tar.bz2 >> oyranos-${OYRANOS_VERSION}.tar.bz2.hashsum
COMMENT Make a oyranos source package by using git
VERBATIM
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
)
EXECUTE_PROCESS(COMMAND rpmbuild --showrc
COMMAND awk '/^build arch/ {print $$4}'
OUTPUT_VARIABLE RPMARCH
ERROR_VARIABLE RPMBUILD_ERROR
)
ADD_CUSTOM_TARGET( rpm
COMMAND test -d ${PACKAGE_NAME}-${OYRANOS_VERSION}/ && rm -rf ${PACKAGE_NAME}-${OYRANOS_VERSION}/
COMMAND tar xjf ${PACKAGE_NAME}-${OYRANOS_VERSION}.tar.bz2
COMMAND mkdir -p rpmdir/BUILD rpmdir/SPECS rpmdir/SOURCES rpmdir/SRPMS rpmdir/RPMS/${RPMARCH}
COMMAND cp -f ${PACKAGE_NAME}-${OYRANOS_VERSION}.tar.bz2 rpmdir/SOURCES
COMMAND cp -f ${CMAKE_SOURCE_DIR}/extras/oyranos-rpmlintrc rpmdir/SOURCES
COMMAND rpmbuild --nodeps --clean -ba extras/${PACKAGE_NAME}.spec --define "_topdir ${CMAKE_CURRENT_BINARY_DIR}/rpmdir"
DEPENDS dist
COMMENT Make a oyranos RPM package
VERBATIM
)
ADD_CUSTOM_TARGET( debsrc
COMMAND test -d ${PACKAGE_NAME}-${OYRANOS_VERSION}/ && rm -rf ${PACKAGE_NAME}-${OYRANOS_VERSION}/
COMMAND tar xjf ${PACKAGE_NAME}-${OYRANOS_VERSION}.tar.bz2
COMMAND mv ${PACKAGE_NAME}-${OYRANOS_VERSION}.tar.bz2 ${PACKAGE_NAME}_${OYRANOS_VERSION}.orig.tar.bz2
COMMAND cp -R ${CMAKE_SOURCE_DIR}/extras/debian ${PACKAGE_NAME}-${OYRANOS_VERSION}/
COMMAND dpkg-source -b ${PACKAGE_NAME}-${OYRANOS_VERSION}/
DEPENDS dist
COMMENT Make a oyranos DEB source package
VERBATIM
)
ADD_CUSTOM_TARGET( debian
COMMAND cd ${PACKAGE_NAME}-${OYRANOS_VERSION}/ && debuild -d
DEPENDS debsrc
COMMENT Make a oyranos DEB package
VERBATIM
)
INCLUDE(FeatureSummary)
FEATURE_SUMMARY(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)