~ubuntu-branches/ubuntu/utopic/pyside/utopic

« back to all changes in this revision

Viewing changes to cmake/Macros/PySideModules.cmake

  • Committer: Bazaar Package Importer
  • Author(s): Didier Raboud
  • Date: 2011-02-18 18:01:00 UTC
  • mfrom: (1.2.3 upstream) (6.1.6 experimental)
  • Revision ID: james.westby@ubuntu.com-20110218180100-vaczjij7g08fzfme
Tags: 1.0.0~rc1-1
* New 1.0.0~rc1 upstream release
  - Bump the B-D chain versions:
    + apiextractor to 0.10.0-2~
    + generatorrunner to 0.6.6
    + shiboken to 1.0.0~rc1
* Update patches to ~rc1.
* debian/watch: update to handle Release Candidates too.
* Bump XS-Python-Version to >= 2.6.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
macro(create_pyside_module module_name module_include_dir module_libraries module_deps module_typesystem_path module_sources typesystem_name)
 
1
macro(create_pyside_module module_name module_include_dir module_libraries module_deps module_typesystem_path module_sources)
2
2
    string(TOLOWER ${module_name} _module)
3
3
    string(REGEX REPLACE ^qt "" _module ${_module})
 
4
 
 
5
    if(${ARGC} GREATER 6)
 
6
        set (typesystem_name ${ARGV6})
 
7
    else()
 
8
        set (typesystem_name "")
 
9
    endif()
 
10
    if(${ARGC} GREATER 7)
 
11
        string(REPLACE ";" "\\;" dropped_entries "${${ARGV7}}")
 
12
    else()
 
13
        set (dropped_entries "")
 
14
    endif()
 
15
 
4
16
    if (NOT EXISTS ${typesystem_name})
5
17
        set(typesystem_path ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_${_module}.xml)
6
18
    else()
9
21
 
10
22
    add_custom_command(OUTPUT ${${module_sources}}
11
23
                        COMMAND ${GENERATORRUNNER_BINARY} ${GENERATOR_EXTRA_FLAGS}
12
 
                        ${CMAKE_BINARY_DIR}/PySide/global.h
 
24
                        ${pyside_BINARY_DIR}/pyside_global.h
13
25
                        --include-paths=${pyside_SOURCE_DIR}${PATH_SEP}${QT_INCLUDE_DIR}
14
26
                        --typesystem-paths=${pyside_SOURCE_DIR}${PATH_SEP}${${module_typesystem_path}}
15
27
                        --output-directory=${CMAKE_CURRENT_BINARY_DIR}
16
28
                        --license-file=${CMAKE_CURRENT_SOURCE_DIR}/../licensecomment.txt
17
29
                        ${typesystem_path}
18
30
                        --api-version=${SUPPORTED_QT_VERSION}
 
31
                        --drop-type-entries="${dropped_entries}"
19
32
                        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
20
33
                        COMMENT "Running generator for ${module_name}...")
21
34
 
22
35
    include_directories(${module_name} ${${module_include_dir}} ${pyside_SOURCE_DIR})
23
 
    add_library(${module_name} MODULE ${${module_sources}} ${${ARGN}})
 
36
    add_library(${module_name} MODULE ${${module_sources}})
24
37
    set_target_properties(${module_name} PROPERTIES PREFIX "" LIBRARY_OUTPUT_DIRECTORY ${pyside_BINARY_DIR})
25
38
    if(WIN32)
26
39
        set_target_properties(${module_name} PROPERTIES SUFFIX ".pyd")
43
56
    install(FILES ${typesystem_files} DESTINATION share/PySide${pyside_SUFFIX}/typesystems)
44
57
endmacro()
45
58
 
46
 
#macro(check_qt_class_with_namespace module namespace class global_sources [namespace])
47
 
macro(check_qt_class module class global_sources)
48
 
    if (${ARGC} GREATER 3)
49
 
        set (namespace ${ARGV3})
 
59
#macro(check_qt_class_with_namespace module namespace class optional_source_files dropped_entries [namespace] [module])
 
60
macro(check_qt_class module class optional_source_files dropped_entries)
 
61
    if (${ARGC} GREATER 4)
 
62
        set (namespace ${ARGV4})
50
63
        string(TOLOWER ${namespace} _namespace)
51
64
    else ()
52
65
        set (namespace "")
53
66
    endif ()
54
 
    if (${ARGC} GREATER 4)
55
 
        set (include_file ${ARGV4})
 
67
    if (${ARGC} GREATER 5)
 
68
        set (include_file ${ARGV5})
56
69
    else ()
57
 
        set (include_file ${module})
 
70
        set (include_file ${class})
58
71
    endif ()
59
72
    string(TOLOWER ${class} _class)
60
73
    string(TOUPPER ${module} _module)
61
 
    if (${namespace})
 
74
    if (_namespace)
62
75
        set(_cppfile ${CMAKE_CURRENT_BINARY_DIR}/PySide/${module}/${_namespace}_${_class}_wrapper.cpp)
63
76
    else ()
64
77
        set(_cppfile ${CMAKE_CURRENT_BINARY_DIR}/PySide/${module}/${_class}_wrapper.cpp)
65
78
    endif ()
66
79
    if (DEFINED PYSIDE_${class})
67
80
        if (PYSIDE_${class})
68
 
            list(APPEND ${global_sources} ${_cppfile})
 
81
            list(APPEND ${optional_source_files} ${_cppfile})
 
82
        else()
 
83
            list(APPEND ${dropped_entries} PySide.${module}.${class})
69
84
        endif()
70
85
    else()
71
86
        if (NOT ${namespace} STREQUAL "" )
76
91
        set(SRC_FILE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/test${class}.cxx)
77
92
        file(WRITE ${SRC_FILE}
78
93
             "#include <${include_file}>\n"
79
 
             "#include <typeinfo>\n"
80
 
             "${NAMESPACE_USE}\n" 
81
 
             "int main() { typeid(${class}); }\n"
 
94
             "${NAMESPACE_USE}\n"
 
95
             "int main() { sizeof(${class}); }\n"
82
96
        )
83
97
        try_compile(Q_WORKS ${CMAKE_BINARY_DIR}
84
98
                    ${SRC_FILE}
92
106
        set("PYSIDE_${class}" ${Q_WORKS} CACHE STRING "Has ${class} class been found?")
93
107
        if(Q_WORKS)
94
108
            message(STATUS "Checking for ${class} in ${module} -- found")
95
 
            list(APPEND ${global_sources} ${_cppfile})
 
109
            list(APPEND ${optional_source_files} ${_cppfile})
96
110
        else()
97
111
            message(STATUS "Checking for ${class} in ${module} -- not found")
 
112
            list(APPEND ${dropped_entries} PySide.${module}.${class})
98
113
        endif()
99
114
    endif()
100
115
endmacro()