Diff of /CMakeLists.txt [b0f579] .. [12f629] Maximize Restore

  Switch to unified view

a/CMakeLists.txt b/CMakeLists.txt
...
...
9
## will create a directory in the SDK root that the hugin
9
## will create a directory in the SDK root that the hugin
10
## CMake build scripts can use.
10
## CMake build scripts can use.
11
##    
11
##    
12
## Builds libpano13 and selected panotools, by default without 
12
## Builds libpano13 and selected panotools, by default without 
13
## support for the Java programs ptpicker and pteditor.  You
13
## support for the Java programs ptpicker and pteditor.  You
14
## can define HAVE_JAVA on the CMake command line; the Java
14
## can define SUPPORT_JAVA_PROGRAMS on the CMake command line; the script
15
## header jni.h and its dependencies must then be in your
15
## produces error if the Java header jni.h and its dependencies are not found.
16
## include search path(this script does not find them).
17
##
16
##
18
## This script uses the Hugin CMake modules to find required
17
## This script uses the Hugin CMake modules to find required
19
## image file format libraries, so it needs to know the name
18
## image file format libraries, so it needs to know the name
20
## of the Hign source tree root.  By default that must be
19
## of the Hign source tree root.  By default that must be
21
## "../hugin" relative to the libpano root(that contains
20
## "../hugin" relative to the libpano root(that contains
...
...
34
33
35
#
34
#
36
# find dependencies
35
# find dependencies
37
#
36
#
38
IF (UNIX)
37
IF (UNIX)
39
FIND_PACKAGE(PkgConfig)
38
  FIND_PACKAGE(PkgConfig)
40
ENDIF (UNIX)
39
ENDIF (UNIX)
41
40
42
## Locate the hugin source root and its parent directory
41
## Locate the hugin source root and its parent directory
43
IF(HUGIN_BASE_DIR)
42
IF(HUGIN_BASE_DIR)
44
  GET_FILENAME_COMPONENT(SOURCE_BASE_DIR ${HUGIN_BASE_DIR} PATH CACHE)
43
  GET_FILENAME_COMPONENT(SOURCE_BASE_DIR ${HUGIN_BASE_DIR} PATH CACHE)
...
...
93
  SET(sys_compat_c "sys_compat_win.c")
92
  SET(sys_compat_c "sys_compat_win.c")
94
ELSE(WIN32)
93
ELSE(WIN32)
95
  ##
94
  ##
96
  ## Cleaner Debian Packaging (enable by -DDISABLE_DPKG=OFF)
95
  ## Cleaner Debian Packaging (enable by -DDISABLE_DPKG=OFF)
97
  ##
96
  ##
98
  OPTION (DISABLE_DPKG "Do not use debian scripts to get package dependences" ON)
99
97
100
  SET(sys_c "sys_ansi.c")
98
  SET(sys_c "sys_ansi.c")
101
  SET(sys_h "sys_ansi.h")
99
  SET(sys_h "sys_ansi.h")
102
  SET(sys_compat_c "sys_compat_unix.c")
100
  SET(sys_compat_c "sys_compat_unix.c")
103
ENDIF(WIN32)
101
ENDIF(WIN32)
104
102
103
OPTION(SUPPORT_JAVA_PROGRAMS "Set this to support for the Java programs ptpicker and pteditor" OFF)
104
if(SUPPORT_JAVA_PROGRAMS)
105
  find_package(Java REQUIRED)
106
  find_package(JNI REQUIRED)
107
  include_directories(${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2})
108
endif()
105
109
106
##
110
##
107
## Graphics libraries
111
## Graphics libraries
108
##
112
##
109
# wxWidgets sub-packages will be used if native ones aren't found
113
# wxWidgets sub-packages will be used if native ones aren't found
...
...
180
ENDIF(UNIX)
184
ENDIF(UNIX)
181
185
182
##
186
##
183
## Here is the part that builds libpano
187
## Here is the part that builds libpano
184
##
188
##
185
if(HAVE_JAVA)
189
if(SUPPORT_JAVA_PROGRAMS)
186
  set(java_h pteditor.h ptutils.h)
190
  set(java_h pteditor.h ptutils.h)
187
  set(java_c ptpicker.c pteditor.c)
191
  set(java_c ptpicker.c pteditor.c)
188
else()
192
else()
189
  set(java_c javastub.c)
193
  set(java_c javastub.c)
190
endif(HAVE_JAVA)
194
endif(SUPPORT_JAVA_PROGRAMS)
191
195
192
set(pano13_install_hdr
196
set(pano13_install_hdr
193
  panorama.h
197
  panorama.h
194
  filter.h
198
  filter.h
195
  version.h
199
  version.h
...
...
267
if(NOT WIN32)
271
if(NOT WIN32)
268
  # Create and install shared library on non-windows
272
  # Create and install shared library on non-windows
269
  add_library(pano13 SHARED ${pano13_hdr} ${pano13_res} ${pano13_src})
273
  add_library(pano13 SHARED ${pano13_hdr} ${pano13_res} ${pano13_src})
270
  target_link_libraries(pano13 ${_common_libs})
274
  target_link_libraries(pano13 ${_common_libs})
271
  set_target_properties(pano13 PROPERTIES VERSION "3.0.0" SOVERSION "3")
275
  set_target_properties(pano13 PROPERTIES VERSION "3.0.0" SOVERSION "3")
272
  install(TARGETS pano13 LIBRARY DESTINATION lib)
276
  install(TARGETS pano13 LIBRARY DESTINATION lib COMPONENT libraries)
273
  set(_pano_target pano13)
277
  set(_pano_target pano13)
274
  #create and install static library
278
  #create and install static library
275
  add_library(pano13a STATIC ${pano13_hdr} ${pano13_res} ${pano13_src})
279
  add_library(pano13a STATIC ${pano13_hdr} ${pano13_res} ${pano13_src})
276
  set_target_properties(pano13a PROPERTIES OUTPUT_NAME pano13)
280
  set_target_properties(pano13a PROPERTIES OUTPUT_NAME pano13)
277
  install(TARGETS pano13a ARCHIVE DESTINATION lib)
281
  install(TARGETS pano13a ARCHIVE DESTINATION lib COMPONENT libraries)
278
else()
282
else()
279
  IF(BUILD_DLL)
283
  IF(BUILD_DLL)
280
    # Create and install shared library
284
    # Create and install shared library
281
    ADD_DEFINITIONS(-DPANO13_DLL)
285
    ADD_DEFINITIONS(-DPANO13_DLL)
282
    add_library(pano13 SHARED ${pano13_hdr} ${pano13_res} ${pano13_src})
286
    add_library(pano13 SHARED ${pano13_hdr} ${pano13_res} ${pano13_src})
283
    target_link_libraries(pano13 ${_common_libs})
287
    target_link_libraries(pano13 ${_common_libs})
284
    set_target_properties(pano13 PROPERTIES VERSION "3.0.0" SOVERSION "3")
288
    set_target_properties(pano13 PROPERTIES VERSION "3.0.0" SOVERSION "3")
285
    IF(MINGW)
289
    IF(MINGW)
286
      set_target_properties(pano13 PROPERTIES PREFIX "")
290
      set_target_properties(pano13 PROPERTIES PREFIX "")
287
    ENDIF()
291
    ENDIF()
288
    install(TARGETS pano13 RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)
292
    install(TARGETS pano13 RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib COMPONENT libraries)
289
  ELSE(BUILD_DLL)
293
  ELSE(BUILD_DLL)
290
    #create and install static library
294
    #create and install static library
291
    add_library(pano13 STATIC ${pano13_hdr} ${pano13_res} ${pano13_src})
295
    add_library(pano13 STATIC ${pano13_hdr} ${pano13_res} ${pano13_src})
292
    install(TARGETS pano13 ARCHIVE DESTINATION lib)
296
    install(TARGETS pano13 ARCHIVE DESTINATION lib COMPONENT libraries)
293
  ENDIF(BUILD_DLL)
297
  ENDIF(BUILD_DLL)
294
  set(_pano_target pano13)
298
  set(_pano_target pano13)
295
endif()
299
endif()
296
300
297
IF( CMAKE_SIZEOF_VOID_P EQUAL 8 AND MSVC )
301
IF( CMAKE_SIZEOF_VOID_P EQUAL 8 AND MSVC )
...
...
304
    IF(NOT BUILD_DLL)
308
    IF(NOT BUILD_DLL)
305
        SET_TARGET_PROPERTIES(pano13 PROPERTIES STATIC_LIBRARY_FLAGS \"/machine:x64\")
309
        SET_TARGET_PROPERTIES(pano13 PROPERTIES STATIC_LIBRARY_FLAGS \"/machine:x64\")
306
    ENDIF()
310
    ENDIF()
307
ENDIF()
311
ENDIF()
308
312
309
install(FILES ${pano13_install_hdr} DESTINATION "include/pano13")
313
install(FILES ${pano13_install_hdr} DESTINATION "include/pano13" COMPONENT headers)
310
314
311
# install documentation expected by hugin install script
315
# install documentation expected by hugin install script
312
INSTALL(
316
INSTALL(
313
  FILES
317
  FILES
314
    AUTHORS
318
    AUTHORS
315
    COPYING
319
    COPYING
316
    README
320
    README
317
  DESTINATION "include/pano13"
321
  DESTINATION "include/pano13"
322
  COMPONENT headers
318
        )
323
        )
319
INSTALL(
324
INSTALL(
320
  FILES
325
  FILES
321
        doc/Optimize.txt
326
        doc/Optimize.txt
322
        doc/PTblender.readme
327
        doc/PTblender.readme
323
        doc/PTmender.readme
328
        doc/PTmender.readme
324
        doc/stitch.txt
329
        doc/stitch.txt
325
  DESTINATION "include/pano13/doc"
330
  DESTINATION "include/pano13/doc"
331
  COMPONENT doc
326
        )
332
        )
327
333
328
set(TOP_SRC_DIR ${CMAKE_SOURCE_DIR})
334
set(TOP_SRC_DIR ${CMAKE_SOURCE_DIR})
329
335
330
add_subdirectory(man)
336
add_subdirectory(man)
...
...
374
set(LIB_TIFF ${TIFF_LIBRARY})
380
set(LIB_TIFF ${TIFF_LIBRARY})
375
set(LIB_ZLIB ${ZLIB_LIBRARY})
381
set(LIB_ZLIB ${ZLIB_LIBRARY})
376
set(LIB_PNG ${PNG_LIBRARY})
382
set(LIB_PNG ${PNG_LIBRARY})
377
set(VERSION ${PACKAGE_VERSION})
383
set(VERSION ${PACKAGE_VERSION})
378
configure_file("${TOP_SRC_DIR}/libpano13.pc.in" "${CMAKE_BINARY_DIR}/libpano13.pc" @ONLY)
384
configure_file("${TOP_SRC_DIR}/libpano13.pc.in" "${CMAKE_BINARY_DIR}/libpano13.pc" @ONLY)
379
install(FILES "${CMAKE_BINARY_DIR}/libpano13.pc" DESTINATION "lib/pkgconfig")
385
install(FILES "${CMAKE_BINARY_DIR}/libpano13.pc" DESTINATION "lib/pkgconfig" COMPONENT libraries)
380
386
381
set(CPACK_PACKAGE_VERSION_MAJOR "${PANO_MAJOR_VERSION}")
387
set(CPACK_PACKAGE_VERSION_MAJOR "${PANO_MAJOR_VERSION}")
382
set(CPACK_PACKAGE_VERSION_MINOR "${PANO_MINOR_VERSION}")
388
set(CPACK_PACKAGE_VERSION_MINOR "${PANO_MINOR_VERSION}")
383
set(CPACK_PACKAGE_VERSION_PATCH "${PANO_PATCH_VERSION}")
389
set(CPACK_PACKAGE_VERSION_PATCH "${PANO_PATCH_VERSION}")
384
390
385
# needed by rpm
391
# needed by rpm
386
set(CPACK_SET_DESTDIR "ON")
392
set(CPACK_SET_DESTDIR "OFF")
387
393
388
# the next ones are needed by deb
394
# the next ones are needed by deb
389
set(CPACK_PACKAGE_CONTACT "${PACKAGE_BUGREPORT}")
395
set(CPACK_PACKAGE_CONTACT "${PACKAGE_BUGREPORT}")
390
set(CPACK_SOURCE_PACKAGE_FILE_NAME "libpano13")
396
set(CPACK_SOURCE_PACKAGE_FILE_NAME "libpano13")
391
set(CPACK_PACKAGE_DESCRIPTION_FILE "${TOP_SRC_DIR}/README")
397
set(CPACK_PACKAGE_DESCRIPTION_FILE "${TOP_SRC_DIR}/README")
...
...
412
    endforeach()
418
    endforeach()
413
  endif()
419
  endif()
414
endif()
420
endif()
415
421
416
set(CPACK_SOURCE_PACKAGE_FILE_NAME "libpano13-${PANO_MAJOR_VERSION}.${PANO_MINOR_VERSION}.${PANO_PATCH_VERSION}")
422
set(CPACK_SOURCE_PACKAGE_FILE_NAME "libpano13-${PANO_MAJOR_VERSION}.${PANO_MINOR_VERSION}.${PANO_PATCH_VERSION}")
423
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/CpackDescription.txt")
424
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Library for manipulating panoramic images")
425
set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1)
426
#set(CPACK_COMPONENTS_ALL libraries tools headers doc)
417
427
418
if(CPACK_BINARY_DEB)
428
if(CPACK_BINARY_DEB)
419
  # Use dpkg-shlibdeps to get the needed dependences
429
  # Use dpkg-shlibdeps to get the needed dependences
420
  if (NOT DISABLE_DPKG)
421
    # Use dpkg-shlibdeps to get the needed dependences
430
  # Use dpkg-shlibdeps to get the needed dependences
422
    SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
431
  SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
423
432
424
    # the following part copied from http://www.cmake.org/Wiki/CMake_RPATH_handling
433
  # the following part copied from http://www.cmake.org/Wiki/CMake_RPATH_handling
425
    # use, i.e. don't skip the full RPATH for the build tree
434
  # use, i.e. don't skip the full RPATH for the build tree
426
    SET(CMAKE_SKIP_BUILD_RPATH  FALSE)
435
  SET(CMAKE_SKIP_BUILD_RPATH  FALSE)
427
436
428
    # when building, don't use the install RPATH already
437
  # when building, don't use the install RPATH already
429
    # (but later on when installing)
438
  # (but later on when installing)
430
    SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
439
  SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
431
440
432
    SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
441
  SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
433
    SET(CPACK_DEBIAN_PACKAGE_DEBUG ON)
442
  SET(CPACK_DEBIAN_PACKAGE_DEBUG ON)
434
443
435
    # add the automatically determined parts of the RPATH
444
  # add the automatically determined parts of the RPATH
436
    # which point to directories outside the build tree to the install RPATH
445
  # which point to directories outside the build tree to the install RPATH
437
    SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
446
  SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
438
447
439
    #this environment will be used by dpkg-shlibdebs to find local created libs
448
  #this environment will be used by dpkg-shlibdebs to find local created libs
440
    string(REGEX REPLACE "^/(.*)" "\\1" LDLIBPATH "${CMAKE_INSTALL_RPATH}")
449
  string(REGEX REPLACE "^/(.*)" "\\1" LDLIBPATH "${CMAKE_INSTALL_RPATH}")
441
450
442
    set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_BINARY_DIR}/CPackEnv.cmake")
451
  set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_BINARY_DIR}/CPackEnv.cmake")
443
    FILE(WRITE "${CPACK_PROJECT_CONFIG_FILE}" "set(ENV{LD_LIBRARY_PATH} \"${LDLIBPATH}\")")
452
  FILE(WRITE "${CPACK_PROJECT_CONFIG_FILE}" "set(ENV{LD_LIBRARY_PATH} \"${LDLIBPATH}\")")
444
  endif()
445
  set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/Debian/postinst")
453
  set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/Debian/postinst")
454
endif()
455
if(CPACK_BINARY_RPM)
456
  set(CPACK_RPM_PACKAGE_DEBUG ON)
457
  set(CPACK_RPM_COMPONENT_INSTALL ON)
458
  set(CPACK_RPM_PACKAGE_LICENSE "GPLv2+")
459
  set(CPACK_RPM_PACKAGE_RELEASE "${PANO_MAJOR_VERSION}.${PANO_MINOR_VERSION}.${PANO_PATCH_VERSION}")
460
  set(CPACK_RPM_PACKAGE_GROUP "Development/Libraries")
461
  set(CPACK_RPM_PACKAGE_OBSOLETES "libpano13-tools < 2.9.18")
462
  #set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/rpm_postinst")
463
  set(CPACK_RPM_PACKAGE_REQUIRES "libjpeg-devel, libtiff-devel, libpng-devel, zlib-devel, libgcj-devel")
446
endif()
464
endif()
447
465
448
include(CPack)
466
include(CPack)
449
467
450
enable_testing()
468
enable_testing()