qtbindings 4.6.3.4 → 4.8.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. data/KNOWN_ISSUES.txt +19 -5
  2. data/README.txt +119 -93
  3. data/Rakefile +28 -27
  4. data/examples/desktop/systray/window.rb +43 -47
  5. data/examples/draganddrop/dropsite/dropsitewidget.rb +10 -9
  6. data/examples/mainwindows/mdi/mainwindow.rb +4 -4
  7. data/examples/network/broadcastsender/sender.rb +3 -1
  8. data/examples/qtscribble/scribble.rb +270 -0
  9. data/examples/ruboids/LICENSE.txt +58 -0
  10. data/examples/run_all.rb +1 -0
  11. data/examples/textedit/textedit.rb +150 -0
  12. data/examples/widgets/scribble/scribblearea.rb +19 -19
  13. data/ext/cmake/modules/BasicFindPackageVersion.cmake.in +30 -0
  14. data/ext/cmake/modules/FindLibraryWithDebug.cmake +113 -0
  15. data/ext/cmake/modules/FindPhonon.cmake +71 -0
  16. data/ext/cmake/modules/FindQImageBlitz.cmake +51 -0
  17. data/ext/cmake/modules/FindRuby.cmake +17 -17
  18. data/ext/cmake/modules/MacroOptionalFindPackage.cmake +6 -26
  19. data/ext/cmake/modules/MacroWriteBasicCMakeVersionFile.cmake +22 -0
  20. data/ext/cmake/modules/SmokeConfig.cmake.in +109 -0
  21. data/ext/generator/cmake/BasicFindPackageVersion.cmake.in +30 -0
  22. data/ext/generator/cmake/CMakeLists.txt +24 -0
  23. data/ext/generator/cmake/FindLibraryWithDebug.cmake +113 -0
  24. data/ext/generator/cmake/FindPhonon.cmake +71 -0
  25. data/ext/generator/cmake/FindQImageBlitz.cmake +51 -0
  26. data/ext/generator/cmake/FindQScintilla.cmake +57 -0
  27. data/ext/generator/cmake/FindQwt5.cmake +104 -0
  28. data/ext/generator/cmake/HandleImportedTargetsInCMakeRequiredLibraries.cmake +85 -0
  29. data/ext/generator/cmake/MacroLogFeature.cmake +146 -0
  30. data/ext/generator/cmake/MacroOptionalAddBindings.cmake +47 -0
  31. data/ext/generator/cmake/MacroOptionalFindPackage.cmake +28 -0
  32. data/ext/generator/cmake/MacroWriteBasicCMakeVersionFile.cmake +22 -0
  33. data/ext/generator/cmake/SmokeConfig.cmake.in +109 -0
  34. data/ext/generator/config.h +25 -0
  35. data/ext/generator/generatorpreprocessor.cpp +60 -41
  36. data/ext/generator/generators/dump/CMakeLists.txt +5 -0
  37. data/ext/generator/generators/smoke/CMakeLists.txt +5 -0
  38. data/ext/generator/generators/smoke/globals.h +3 -1
  39. data/ext/generator/generators/smoke/helpers.cpp +21 -2
  40. data/ext/generator/generators/smoke/writeSmokeDataFile.cpp +26 -1
  41. data/ext/generator/main.cpp +5 -1
  42. data/ext/generator/options.cpp +1 -0
  43. data/ext/generator/options.h +1 -0
  44. data/ext/generator/parser/CMakeLists.txt +10 -1
  45. data/ext/generator/parser/parser.cpp +6 -6
  46. data/ext/generator/parser/parser.h +2 -12
  47. data/ext/generator/parser/parsesession.cpp +1 -0
  48. data/ext/generator/parser/rpp/CMakeLists.txt +6 -0
  49. data/ext/generator/parser/rpp/chartools.cpp +3 -3
  50. data/ext/generator/parser/rpp/chartools.h +3 -1
  51. data/ext/generator/parser/rpp/pp-scanner.cpp +2 -1
  52. data/ext/generator/parser/rpp/tests/CMakeLists.txt +4 -0
  53. data/ext/generator/parser/tests/CMakeLists.txt +16 -0
  54. data/ext/generator/smoke.h +557 -0
  55. data/ext/generator/smokegen_string.h +43 -0
  56. data/ext/generator/type.cpp +15 -6
  57. data/ext/generator/type_compiler.cpp +2 -0
  58. data/ext/ruby/qtruby/src/qtruby.cpp +147 -143
  59. data/ext/ruby/qttest/qttesthandlers.cpp +1 -0
  60. data/ext/smoke/qtcore/QtGuess.txt +23 -25
  61. data/ext/smoke/qtcore/smokeconfig.xml +1 -0
  62. data/ext/smoke/qtdbus/smokeconfig.xml +2 -0
  63. data/ext/smoke/qtgui/smokeconfig.xml +14 -4
  64. data/ext/smoke/qthelp/smokeconfig.xml +1 -0
  65. data/ext/smoke/qtmultimedia/smokeconfig.xml +1 -0
  66. data/ext/smoke/qtnetwork/smokeconfig.xml +2 -0
  67. data/ext/smoke/qtopengl/smokeconfig.xml +1 -0
  68. data/ext/smoke/qtsql/smokeconfig.xml +1 -0
  69. data/ext/smoke/qtsvg/smokeconfig.xml +1 -0
  70. data/ext/smoke/qtwebkit/smokeconfig.xml +3 -0
  71. data/extconf.rb +37 -23
  72. data/lib/Qt/qtruby4.rb +4 -4
  73. data/lib/Qt4.rb +1 -1
  74. data/lib/qtbindings_version.rb +2 -2
  75. metadata +50 -40
@@ -0,0 +1,57 @@
1
+ # - Try to find the QScintilla2 includes and library
2
+ # which defines
3
+ #
4
+ # QSCINTILLA_FOUND - system has QScintilla2
5
+ # QSCINTILLA_INCLUDE_DIR - where to find qextscintilla.h
6
+ # QSCINTILLA_LIBRARIES - the libraries to link against to use QScintilla
7
+ # QSCINTILLA_LIBRARY - where to find the QScintilla library (not for general use)
8
+
9
+ # copyright (c) 2007 Thomas Moenicke thomas.moenicke@kdemail.net
10
+ #
11
+ # Redistribution and use is allowed according to the terms of the FreeBSD license.
12
+
13
+ IF(NOT QT4_FOUND)
14
+ INCLUDE(FindQt4)
15
+ ENDIF(NOT QT4_FOUND)
16
+
17
+ SET(QSCINTILLA_FOUND FALSE)
18
+
19
+ IF(QT4_FOUND)
20
+ FIND_PATH(QSCINTILLA_INCLUDE_DIR qsciglobal.h
21
+ "${QT_INCLUDE_DIR}/Qsci" /usr/include /usr/include/Qsci
22
+ )
23
+
24
+ SET(QSCINTILLA_NAMES ${QSCINTILLA_NAMES} qscintilla2 libqscintilla2)
25
+ FIND_LIBRARY(QSCINTILLA_LIBRARY
26
+ NAMES ${QSCINTILLA_NAMES}
27
+ PATHS ${QT_LIBRARY_DIR}
28
+ )
29
+
30
+ IF (QSCINTILLA_LIBRARY AND QSCINTILLA_INCLUDE_DIR)
31
+
32
+ SET(QSCINTILLA_LIBRARIES ${QSCINTILLA_LIBRARY})
33
+ SET(QSCINTILLA_FOUND TRUE)
34
+
35
+ IF (CYGWIN)
36
+ IF(BUILD_SHARED_LIBS)
37
+ # No need to define QSCINTILLA_USE_DLL here, because it's default for Cygwin.
38
+ ELSE(BUILD_SHARED_LIBS)
39
+ SET (QSCINTILLA_DEFINITIONS -DQSCINTILLA_STATIC)
40
+ ENDIF(BUILD_SHARED_LIBS)
41
+ ENDIF (CYGWIN)
42
+
43
+ ENDIF (QSCINTILLA_LIBRARY AND QSCINTILLA_INCLUDE_DIR)
44
+ ENDIF(QT4_FOUND)
45
+
46
+ IF (QSCINTILLA_FOUND)
47
+ IF (NOT QScintilla_FIND_QUIETLY)
48
+ MESSAGE(STATUS "Found QScintilla2: ${QSCINTILLA_LIBRARY}")
49
+ ENDIF (NOT QScintilla_FIND_QUIETLY)
50
+ ELSE (QSCINTILLA_FOUND)
51
+ IF (QScintilla_FIND_REQUIRED)
52
+ MESSAGE(FATAL_ERROR "Could not find QScintilla library")
53
+ ENDIF (QScintilla_FIND_REQUIRED)
54
+ ENDIF (QSCINTILLA_FOUND)
55
+
56
+ MARK_AS_ADVANCED(QSCINTILLA_INCLUDE_DIR QSCINTILLA_LIBRARY)
57
+
@@ -0,0 +1,104 @@
1
+ # Find the Qwt 5.x includes and library, either the version linked to Qt3 or the version linked to Qt4
2
+ #
3
+ # On Windows it makes these assumptions:
4
+ # - the Qwt DLL is where the other DLLs for Qt are (QT_DIR\bin) or in the path
5
+ # - the Qwt .h files are in QT_DIR\include\Qwt or in the path
6
+ # - the Qwt .lib is where the other LIBs for Qt are (QT_DIR\lib) or in the path
7
+ #
8
+ # Qwt5_INCLUDE_DIR - where to find qwt.h if Qwt
9
+ # Qwt5_Qt4_LIBRARY - The Qwt5 library linked against Qt4 (if it exists)
10
+ # Qwt5_Qt3_LIBRARY - The Qwt5 library linked against Qt4 (if it exists)
11
+ # Qwt5_Qt4_FOUND - Qwt5 was found and uses Qt4
12
+ # Qwt5_Qt3_FOUND - Qwt5 was found and uses Qt3
13
+ # Qwt5_FOUND - Set to TRUE if Qwt5 was found (linked either to Qt3 or Qt4)
14
+
15
+ # Copyright (c) 2007, Pau Garcia i Quiles, <pgquiles@elpauer.org>
16
+ #
17
+ # Redistribution and use is allowed according to the terms of the BSD license.
18
+ # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
19
+
20
+ # Condition is "(A OR B) AND C", CMake does not support parentheses but it evaluates left to right
21
+ IF(Qwt5_Qt4_LIBRARY OR Qwt5_Qt3_LIBRARY AND Qwt5_INCLUDE_DIR)
22
+ SET(Qwt5_FIND_QUIETLY TRUE)
23
+ ENDIF(Qwt5_Qt4_LIBRARY OR Qwt5_Qt3_LIBRARY AND Qwt5_INCLUDE_DIR)
24
+
25
+ IF(NOT QT4_FOUND)
26
+ FIND_PACKAGE( Qt4 REQUIRED QUIET )
27
+ ENDIF(NOT QT4_FOUND)
28
+
29
+ IF( QT4_FOUND )
30
+ # Is Qwt5 installed? Look for header files
31
+ FIND_PATH( Qwt5_INCLUDE_DIR qwt.h
32
+ PATHS ${QT_INCLUDE_DIR} /usr/local/qwt/include /usr/include/qwt
33
+ PATH_SUFFIXES qwt qwt5 qwt-qt4 qwt5-qt4 qwt-qt3 qwt5-qt3 include qwt/include qwt5/include qwt-qt4/include qwt5-qt4/include qwt-qt3/include qwt5-qt3/include ENV PATH)
34
+
35
+ # Find Qwt version
36
+ IF( Qwt5_INCLUDE_DIR )
37
+ FILE( READ ${Qwt5_INCLUDE_DIR}/qwt_global.h QWT_GLOBAL_H )
38
+ STRING( REGEX MATCH "#define *QWT_VERSION *(0x05*)" QWT_IS_VERSION_5 ${QWT_GLOBAL_H})
39
+
40
+ IF( QWT_IS_VERSION_5 )
41
+ STRING(REGEX REPLACE ".*#define[\\t\\ ]+QWT_VERSION_STR[\\t\\ ]+\"([0-9]+\\.[0-9]+\\.[0-9]+)\".*" "\\1" Qwt_VERSION "${QWT_GLOBAL_H}")
42
+
43
+ # Find Qwt5 library linked to Qt4
44
+ FIND_LIBRARY( Qwt5_Qt4_TENTATIVE_LIBRARY NAMES qwt5-qt4 qwt-qt4 qwt5 qwt PATHS /usr/local/qwt/lib /usr/local/lib /usr/lib ${QT_LIBRARY_DIR})
45
+ IF( UNIX AND NOT CYGWIN)
46
+ IF( Qwt5_Qt4_TENTATIVE_LIBRARY )
47
+ #MESSAGE("Qwt5_Qt4_TENTATIVE_LIBRARY = ${Qwt5_Qt4_TENTATIVE_LIBRARY}")
48
+ EXECUTE_PROCESS( COMMAND "ldd" ${Qwt5_Qt4_TENTATIVE_LIBRARY} OUTPUT_VARIABLE Qwt_Qt4_LIBRARIES_LINKED_TO )
49
+ STRING( REGEX MATCH "QtCore" Qwt5_IS_LINKED_TO_Qt4 ${Qwt_Qt4_LIBRARIES_LINKED_TO})
50
+ IF( Qwt5_IS_LINKED_TO_Qt4 )
51
+ SET( Qwt5_Qt4_LIBRARY ${Qwt5_Qt4_TENTATIVE_LIBRARY} )
52
+ SET( Qwt5_Qt4_FOUND TRUE )
53
+ IF (NOT Qwt5_FIND_QUIETLY)
54
+ MESSAGE( STATUS "Found Qwt: ${Qwt5_Qt4_LIBRARY}" )
55
+ ENDIF (NOT Qwt5_FIND_QUIETLY)
56
+ ENDIF( Qwt5_IS_LINKED_TO_Qt4 )
57
+ ENDIF( Qwt5_Qt4_TENTATIVE_LIBRARY )
58
+ ELSE( UNIX AND NOT CYGWIN)
59
+ # Assumes qwt.dll is in the Qt dir
60
+ SET( Qwt5_Qt4_LIBRARY ${Qwt5_Qt4_TENTATIVE_LIBRARY} )
61
+ SET( Qwt5_Qt4_FOUND TRUE )
62
+ IF (NOT Qwt5_FIND_QUIETLY)
63
+ MESSAGE( STATUS "Found Qwt version ${Qwt_VERSION} linked to Qt4" )
64
+ ENDIF (NOT Qwt5_FIND_QUIETLY)
65
+ ENDIF( UNIX AND NOT CYGWIN)
66
+
67
+
68
+ # Find Qwt5 library linked to Qt3
69
+ FIND_LIBRARY( Qwt5_Qt3_TENTATIVE_LIBRARY NAMES qwt-qt3 qwt qwt5-qt3 qwt5 )
70
+ IF( UNIX AND NOT CYGWIN)
71
+ IF( Qwt5_Qt3_TENTATIVE_LIBRARY )
72
+ #MESSAGE("Qwt5_Qt3_TENTATIVE_LIBRARY = ${Qwt5_Qt3_TENTATIVE_LIBRARY}")
73
+ EXECUTE_PROCESS( COMMAND "ldd" ${Qwt5_Qt3_TENTATIVE_LIBRARY} OUTPUT_VARIABLE Qwt-Qt3_LIBRARIES_LINKED_TO )
74
+ STRING( REGEX MATCH "qt-mt" Qwt5_IS_LINKED_TO_Qt3 ${Qwt-Qt3_LIBRARIES_LINKED_TO})
75
+ IF( Qwt5_IS_LINKED_TO_Qt3 )
76
+ SET( Qwt5_Qt3_LIBRARY ${Qwt5_Qt3_TENTATIVE_LIBRARY} )
77
+ SET( Qwt5_Qt3_FOUND TRUE )
78
+ IF (NOT Qwt5_FIND_QUIETLY)
79
+ MESSAGE( STATUS "Found Qwt version ${Qwt_VERSION} linked to Qt3" )
80
+ ENDIF (NOT Qwt5_FIND_QUIETLY)
81
+ ENDIF( Qwt5_IS_LINKED_TO_Qt3 )
82
+ ENDIF( Qwt5_Qt3_TENTATIVE_LIBRARY )
83
+ ELSE( UNIX AND NOT CYGWIN)
84
+ SET( Qwt5_Qt3_LIBRARY ${Qwt5_Qt3_TENTATIVE_LIBRARY} )
85
+ SET( Qwt5_Qt3_FOUND TRUE )
86
+ IF (NOT Qwt5_FIND_QUIETLY)
87
+ MESSAGE( STATUS "Found Qwt: ${Qwt5_Qt3_LIBRARY}" )
88
+ ENDIF (NOT Qwt5_FIND_QUIETLY)
89
+ ENDIF( UNIX AND NOT CYGWIN)
90
+
91
+ ENDIF( QWT_IS_VERSION_5 )
92
+
93
+ IF( Qwt5_Qt4_FOUND OR Qwt5_Qt3_FOUND )
94
+ SET( Qwt5_FOUND TRUE )
95
+ ENDIF( Qwt5_Qt4_FOUND OR Qwt5_Qt3_FOUND )
96
+
97
+ MARK_AS_ADVANCED( Qwt5_INCLUDE_DIR Qwt5_Qt4_LIBRARY Qwt5_Qt3_LIBRARY )
98
+ ENDIF( Qwt5_INCLUDE_DIR )
99
+
100
+ IF (NOT Qwt5_FOUND AND Qwt5_FIND_REQUIRED)
101
+ MESSAGE(FATAL_ERROR "Could not find Qwt 5.x")
102
+ ENDIF (NOT Qwt5_FOUND AND Qwt5_FIND_REQUIRED)
103
+
104
+ ENDIF( QT4_FOUND )
@@ -0,0 +1,85 @@
1
+
2
+ # This is a helper function used by CheckCXXSourceRuns.cmake and
3
+ # CheckCXXSourceCompiles.cmake. Actually it should be used by all macros which
4
+ # use TRY_COMPILE() or TRY_RUN().
5
+ # It takes the CMAKE_REQUIRED_LIBRARY variable and searches it for imported
6
+ # (library) targets. Since the project created by TRY_COMPILE() (and TRY_RUN())
7
+ # does not know about these imported targets, this macro here replaces these
8
+ # imported targets with the actual library files on disk and it also
9
+ # adds the libraries from the link interface of these imported targets.
10
+ # E.g the imported target KDE4__kdeui is replaced on my system with /opt/kdelibs/lib/libkdeui.so
11
+ # and the link interface libraries, which includes e.g. /opt/kdelibs/lib/libkdecore.so.
12
+ # This way imported targets work also when used with CHECK_CXX_SOURCE_COMPILES/RUNS().
13
+
14
+ # Copyright (c) 2009, Alexander Neundorf, <neundorf@kde.org>
15
+ #
16
+ # Redistribution and use is allowed according to the terms of the BSD license.
17
+ # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
18
+
19
+ FUNCTION(HANDLE_IMPORTED_TARGETS_IN_CMAKE_REQUIRED_LIBRARIES _RESULT)
20
+ # handle imported library targets
21
+ SET(_CCSR_IMP_TARGETS_MAP)
22
+ SET(_CCSR_REQ_LIBS ${CMAKE_REQUIRED_LIBRARIES})
23
+ SET(_CHECK_FOR_IMPORTED_TARGETS TRUE)
24
+ SET(_CCSR_LOOP_COUNTER 0)
25
+ WHILE(_CHECK_FOR_IMPORTED_TARGETS)
26
+ MATH(EXPR _CCSR_LOOP_COUNTER "${_CCSR_LOOP_COUNTER} + 1 ")
27
+ SET(_CCSR_NEW_REQ_LIBS )
28
+ SET(_CHECK_FOR_IMPORTED_TARGETS FALSE)
29
+ FOREACH(_CURRENT_LIB ${_CCSR_REQ_LIBS})
30
+ GET_TARGET_PROPERTY(_importedConfigs ${_CURRENT_LIB} IMPORTED_CONFIGURATIONS)
31
+ IF (_importedConfigs)
32
+ # Ok, so this is an imported target.
33
+ # First we get the imported configurations.
34
+ # Then we get the location of the actual library on disk of the first configuration.
35
+ # then we'll get its link interface libraries property,
36
+ # iterate through it and replace all imported targets we find there
37
+ # with there actual location.
38
+
39
+ # guard against infinite loop: abort after 100 iterations ( 100 is arbitrary chosen)
40
+ IF ("${_CCSR_LOOP_COUNTER}" LESS 100)
41
+ SET(_CHECK_FOR_IMPORTED_TARGETS TRUE)
42
+ # ELSE ("${_CCSR_LOOP_COUNTER}" LESS 1)
43
+ # MESSAGE(STATUS "********* aborting loop, counter : ${_CCSR_LOOP_COUNTER}")
44
+ ENDIF ("${_CCSR_LOOP_COUNTER}" LESS 100)
45
+
46
+ LIST(GET _importedConfigs 0 _firstImportedConfig)
47
+ GET_TARGET_PROPERTY(_firstImportedLocation ${_CURRENT_LIB} IMPORTED_LOCATION_${_firstImportedConfig})
48
+ GET_TARGET_PROPERTY(_linkInterfaceLibs ${_CURRENT_LIB} IMPORTED_LINK_INTERFACE_LIBRARIES_${_firstImportedConfig} )
49
+
50
+ LIST(APPEND _CCSR_NEW_REQ_LIBS ${_firstImportedLocation})
51
+ # MESSAGE(STATUS "Appending lib ${_CURRENT_LIB} as ${_firstImportedLocation}")
52
+ IF(_linkInterfaceLibs)
53
+ FOREACH(_currentLinkInterfaceLib ${_linkInterfaceLibs})
54
+ # MESSAGE(STATUS "Appending link interface lib ${_currentLinkInterfaceLib}")
55
+ IF(_currentLinkInterfaceLib)
56
+ LIST(APPEND _CCSR_NEW_REQ_LIBS ${_currentLinkInterfaceLib} )
57
+ ENDIF(_currentLinkInterfaceLib)
58
+ ENDFOREACH(_currentLinkInterfaceLib ${_linkInterfaceLibs})
59
+ ENDIF(_linkInterfaceLibs)
60
+ ELSE(_importedConfigs)
61
+ # "Normal" libraries are just used as they are.
62
+ LIST(APPEND _CCSR_NEW_REQ_LIBS ${_CURRENT_LIB} )
63
+ # MESSAGE(STATUS "Appending lib directly: ${_CURRENT_LIB}")
64
+ ENDIF(_importedConfigs)
65
+ ENDFOREACH(_CURRENT_LIB ${_CCSR_REQ_LIBS})
66
+
67
+ SET(_CCSR_REQ_LIBS ${_CCSR_NEW_REQ_LIBS} )
68
+ ENDWHILE(_CHECK_FOR_IMPORTED_TARGETS)
69
+
70
+ # Finally we iterate once more over all libraries. This loop only removes
71
+ # all remaining imported target names (there shouldn't be any left anyway).
72
+ SET(_CCSR_NEW_REQ_LIBS )
73
+ FOREACH(_CURRENT_LIB ${_CCSR_REQ_LIBS})
74
+ GET_TARGET_PROPERTY(_importedConfigs ${_CURRENT_LIB} IMPORTED_CONFIGURATIONS)
75
+ IF (NOT _importedConfigs)
76
+ LIST(APPEND _CCSR_NEW_REQ_LIBS ${_CURRENT_LIB} )
77
+ # MESSAGE(STATUS "final: appending ${_CURRENT_LIB}")
78
+ ELSE (NOT _importedConfigs)
79
+ # MESSAGE(STATUS "final: skipping ${_CURRENT_LIB}")
80
+ ENDIF (NOT _importedConfigs)
81
+ ENDFOREACH(_CURRENT_LIB ${_CCSR_REQ_LIBS})
82
+ SET(${_RESULT} ${_CCSR_NEW_REQ_LIBS} PARENT_SCOPE)
83
+
84
+ ENDFUNCTION(HANDLE_IMPORTED_TARGETS_IN_CMAKE_REQUIRED_LIBRARIES _CCSR_REQ_LIBS)
85
+
@@ -0,0 +1,146 @@
1
+ # This file defines the Feature Logging macros.
2
+ #
3
+ # MACRO_LOG_FEATURE(VAR FEATURE DESCRIPTION URL [REQUIRED [MIN_VERSION [COMMENTS]]])
4
+ # Logs the information so that it can be displayed at the end
5
+ # of the configure run
6
+ # VAR : TRUE or FALSE, indicating whether the feature is supported
7
+ # FEATURE: name of the feature, e.g. "libjpeg"
8
+ # DESCRIPTION: description what this feature provides
9
+ # URL: home page
10
+ # REQUIRED: TRUE or FALSE, indicating whether the featue is required
11
+ # MIN_VERSION: minimum version number. empty string if unneeded
12
+ # COMMENTS: More info you may want to provide. empty string if unnecessary
13
+ #
14
+ # MACRO_DISPLAY_FEATURE_LOG()
15
+ # Call this to display the collected results.
16
+ # Exits CMake with a FATAL error message if a required feature is missing
17
+ #
18
+ # Example:
19
+ #
20
+ # INCLUDE(MacroLogFeature)
21
+ #
22
+ # FIND_PACKAGE(JPEG)
23
+ # MACRO_LOG_FEATURE(JPEG_FOUND "libjpeg" "Support JPEG images" "http://www.ijg.org" TRUE "3.2a" "")
24
+ # ...
25
+ # MACRO_DISPLAY_FEATURE_LOG()
26
+
27
+ # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
28
+ # Copyright (c) 2006, Allen Winter, <winter@kde.org>
29
+ # Copyright (c) 2009, Sebastian Trueg, <trueg@kde.org>
30
+ #
31
+ # Redistribution and use is allowed according to the terms of the BSD license.
32
+ # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
33
+
34
+ IF (NOT _macroLogFeatureAlreadyIncluded)
35
+ SET(_file ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
36
+ IF (EXISTS ${_file})
37
+ FILE(REMOVE ${_file})
38
+ ENDIF (EXISTS ${_file})
39
+
40
+ SET(_file ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
41
+ IF (EXISTS ${_file})
42
+ FILE(REMOVE ${_file})
43
+ ENDIF (EXISTS ${_file})
44
+
45
+ SET(_file ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
46
+ IF (EXISTS ${_file})
47
+ FILE(REMOVE ${_file})
48
+ ENDIF (EXISTS ${_file})
49
+
50
+ SET(_macroLogFeatureAlreadyIncluded TRUE)
51
+ ENDIF (NOT _macroLogFeatureAlreadyIncluded)
52
+
53
+
54
+ MACRO(MACRO_LOG_FEATURE _var _package _description _url ) # _required _minvers _comments)
55
+
56
+ STRING(TOUPPER "${ARGV4}" _required)
57
+ SET(_minvers "${ARGV5}")
58
+ SET(_comments "${ARGV6}")
59
+
60
+ IF (${_var})
61
+ SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
62
+ ELSE (${_var})
63
+ IF ("${_required}" STREQUAL "TRUE")
64
+ SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
65
+ ELSE ("${_required}" STREQUAL "TRUE")
66
+ SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
67
+ ENDIF ("${_required}" STREQUAL "TRUE")
68
+ ENDIF (${_var})
69
+
70
+ SET(_logtext " * ${_package}")
71
+
72
+ IF (NOT ${_var})
73
+ IF (${_minvers} MATCHES ".*")
74
+ SET(_logtext "${_logtext} (${_minvers} or higher)")
75
+ ENDIF (${_minvers} MATCHES ".*")
76
+ SET(_logtext "${_logtext} <${_url}>\n ")
77
+ ELSE (NOT ${_var})
78
+ SET(_logtext "${_logtext} - ")
79
+ ENDIF (NOT ${_var})
80
+
81
+ SET(_logtext "${_logtext}${_description}")
82
+
83
+ IF (NOT ${_var})
84
+ IF (${_comments} MATCHES ".*")
85
+ SET(_logtext "${_logtext}\n ${_comments}")
86
+ ENDIF (${_comments} MATCHES ".*")
87
+ # SET(_logtext "${_logtext}\n") #double-space missing features?
88
+ ENDIF (NOT ${_var})
89
+
90
+ FILE(APPEND "${_LOGFILENAME}" "${_logtext}\n")
91
+
92
+ ENDMACRO(MACRO_LOG_FEATURE)
93
+
94
+
95
+ MACRO(MACRO_DISPLAY_FEATURE_LOG)
96
+
97
+ SET(_missingFile ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
98
+ SET(_enabledFile ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
99
+ SET(_disabledFile ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
100
+
101
+ IF (EXISTS ${_missingFile} OR EXISTS ${_enabledFile} OR EXISTS ${_disabledFile})
102
+ SET(_printSummary TRUE)
103
+ ENDIF (EXISTS ${_missingFile} OR EXISTS ${_enabledFile} OR EXISTS ${_disabledFile})
104
+
105
+ IF(_printSummary)
106
+ SET(_missingDeps 0)
107
+ IF (EXISTS ${_enabledFile})
108
+ FILE(READ ${_enabledFile} _enabled)
109
+ FILE(REMOVE ${_enabledFile})
110
+ SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following external packages were located on your system.\n-- This installation will have the extra features provided by these packages.\n-----------------------------------------------------------------------------\n${_enabled}")
111
+ ENDIF (EXISTS ${_enabledFile})
112
+
113
+
114
+ IF (EXISTS ${_disabledFile})
115
+ SET(_missingDeps 1)
116
+ FILE(READ ${_disabledFile} _disabled)
117
+ FILE(REMOVE ${_disabledFile})
118
+ SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following OPTIONAL packages could NOT be located on your system.\n-- Consider installing them to enable more features from this software.\n-----------------------------------------------------------------------------\n${_disabled}")
119
+ ENDIF (EXISTS ${_disabledFile})
120
+
121
+
122
+ IF (EXISTS ${_missingFile})
123
+ SET(_missingDeps 1)
124
+ FILE(READ ${_missingFile} _requirements)
125
+ SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following REQUIRED packages could NOT be located on your system.\n-- You must install these packages before continuing.\n-----------------------------------------------------------------------------\n${_requirements}")
126
+ FILE(REMOVE ${_missingFile})
127
+ SET(_haveMissingReq 1)
128
+ ENDIF (EXISTS ${_missingFile})
129
+
130
+
131
+ IF (NOT ${_missingDeps})
132
+ SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- Congratulations! All external packages have been found.")
133
+ ENDIF (NOT ${_missingDeps})
134
+
135
+
136
+ MESSAGE(${_summary})
137
+ MESSAGE("-----------------------------------------------------------------------------\n")
138
+
139
+
140
+ IF(_haveMissingReq)
141
+ MESSAGE(FATAL_ERROR "Exiting: Missing Requirements")
142
+ ENDIF(_haveMissingReq)
143
+
144
+ ENDIF(_printSummary)
145
+
146
+ ENDMACRO(MACRO_DISPLAY_FEATURE_LOG)
@@ -0,0 +1,47 @@
1
+ # Copyright (c) 2010 Maciej Mrozowski <reavertm@gmail.com>
2
+ #
3
+ # Redistribution and use is allowed according to the terms of the GPL license.
4
+
5
+ # Conditionally enable bindings.
6
+ # Pass -DDISABLE_<component_name>=ON to disable certain binding even if its dependencies are found.
7
+ # CMake project needs to be set before using this macro.
8
+ # Macro sets following variables:
9
+ # ${CMAKE_PROJECT_NAME}_ENABLED - list of enabled bindings
10
+ # ${CMAKE_PROJECT_NAME}_DISABLED - list of disabled bindings
11
+ # Usage:
12
+ # macro_optional_add_bindings(<component_found> <component_name> <subdir1> [<subdir2> ...])
13
+ #
14
+ # Example:
15
+ # project(SMOKE)
16
+ # [...]
17
+ # macro_optional_add_bindings(NEPOMUK_FOUND "Nepomuk" nepomuk nepomukquery)
18
+ # [...]
19
+ # macro_display_bindings_log()
20
+ macro(MACRO_OPTIONAL_ADD_BINDINGS _component_found _component_name)
21
+ get_property(_PREFIX VARIABLE PROPERTY PROJECT_NAME)
22
+ if(${_component_found} AND NOT DISABLE_${_component_name})
23
+ foreach(_subdir ${ARGN})
24
+ add_subdirectory(${_subdir})
25
+ endforeach(_subdir ${ARGN})
26
+ list(APPEND ${_PREFIX}_ENABLED ${_component_name})
27
+ else(${_component_found} AND NOT DISABLE_${_component_name})
28
+ list(APPEND ${_PREFIX}_DISABLED ${_component_name})
29
+ endif(${_component_found} AND NOT DISABLE_${_component_name})
30
+ set(_PREFIX)
31
+ endmacro(MACRO_OPTIONAL_ADD_BINDINGS)
32
+
33
+ # Show bindings summary
34
+ # Usage:
35
+ # macro_display_bindings_log()
36
+ macro(MACRO_DISPLAY_BINDINGS_LOG)
37
+ get_property(_PREFIX VARIABLE PROPERTY PROJECT_NAME)
38
+ if (${_PREFIX}_ENABLED)
39
+ list(SORT ${_PREFIX}_ENABLED)
40
+ endif (${_PREFIX}_ENABLED)
41
+ if (${_PREFIX}_DISABLED)
42
+ list(SORT ${_PREFIX}_DISABLED)
43
+ endif (${_PREFIX}_DISABLED)
44
+ message(STATUS "Build ${_PREFIX} bindings: ${${_PREFIX}_ENABLED}")
45
+ message(STATUS "Skip ${_PREFIX} bindings: ${${_PREFIX}_DISABLED}")
46
+ set(_PREFIX)
47
+ endmacro(MACRO_DISPLAY_BINDINGS_LOG)
@@ -0,0 +1,28 @@
1
+ # - MACRO_OPTIONAL_FIND_PACKAGE() combines FIND_PACKAGE() with an OPTION()
2
+ # MACRO_OPTIONAL_FIND_PACKAGE( <name> [QUIT] )
3
+ # This macro is a combination of OPTION() and FIND_PACKAGE(), it
4
+ # works like FIND_PACKAGE(), but additionally it automatically creates
5
+ # an option name WITH_<name>, which can be disabled via the cmake GUI.
6
+ # or via -DWITH_<name>=OFF
7
+ # The standard <name>_FOUND variables can be used in the same way
8
+ # as when using the normal FIND_PACKAGE()
9
+
10
+ # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
11
+ #
12
+ # Redistribution and use is allowed according to the terms of the BSD license.
13
+ # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
14
+
15
+
16
+ macro (MACRO_OPTIONAL_FIND_PACKAGE _name )
17
+ option(WITH_${_name} "Search for ${_name} package" ON)
18
+ if (WITH_${_name})
19
+ find_package(${_name} ${ARGN})
20
+ else (WITH_${_name})
21
+ set(${_name}_FOUND)
22
+ set(${_name}_INCLUDE_DIR)
23
+ set(${_name}_INCLUDES)
24
+ set(${_name}_LIBRARY)
25
+ set(${_name}_LIBRARIES)
26
+ endif (WITH_${_name})
27
+ endmacro (MACRO_OPTIONAL_FIND_PACKAGE)
28
+