summaryrefslogtreecommitdiffstats
path: root/sources/pyside2/tests/pysidetest/CMakeLists.txt
blob: 821b6f8195c999a6d5baaa6953a8be0139c07a8e (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
project(pysidetest)
project(testbinding)

cmake_minimum_required(VERSION 2.6)

# On Windows, don't link to qtmain.lib for executables automatically.
cmake_policy(SET CMP0020 OLD)

set(QT_USE_QTCORE 1)
# no more supported: include(${QT_USE_FILE})
add_definitions(${Qt5Core_DEFINITIONS})
add_definitions(-DQT_SHARED)
add_definitions(-DRXX_ALLOCATOR_INIT_0)

find_package(Qt5Widgets)

set(pysidetest_SRC
testobject.cpp
testview.cpp
hiddenobject.cpp
)

set(pysidetest_MOC_HEADERS
testobject.h
testview.h
hiddenobject.h
)

qt5_wrap_cpp(pysidetest_MOC_SRC ${pysidetest_MOC_HEADERS})

set(testbinding_SRC
${CMAKE_CURRENT_BINARY_DIR}/testbinding/testobject_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/testbinding/intvalue_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/testbinding/pysidecpp_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/testbinding/pysidecpp_testobjectwithnamespace_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/testbinding/pysidecpp2_testobjectwithoutnamespace_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/testbinding/testview_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/testbinding/testbinding_module_wrapper.cpp
)

make_path(testbinding_include_dirs  ${pyside2_BINARY_DIR}
                                    ${CMAKE_CURRENT_SOURCE_DIR}
                                    ${CMAKE_CURRENT_SOURCE_DIR}/../../PySide2
                                    ${CMAKE_CURRENT_SOURCE_DIR}/../../libpyside
                                    ${QT_INCLUDE_DIR}
                                    ${QT_INCLUDE_DIR}/QtCore
                                    ${QT_INCLUDE_DIR}/QtGui
                                    ${QT_INCLUDE_DIR}/QtWidgets
                                    )

make_path(testbinding_typesystem_path ${CMAKE_CURRENT_SOURCE_DIR}
                                      ${pyside2_SOURCE_DIR}
                                      ${QtCore_SOURCE_DIR} ${QtGui_SOURCE_DIR} ${QtWidgets_SOURCE_DIR}
                                      ${QtCore_BINARY_DIR} ${QtGui_BINARY_DIR} ${QtWidgets_BINARY_DIR}
                                      )

add_custom_command(OUTPUT ${testbinding_SRC}
COMMAND ${SHIBOKEN_BINARY} ${GENERATOR_EXTRA_FLAGS}
        ${CMAKE_CURRENT_SOURCE_DIR}/pysidetest_global.h
        --include-paths=${testbinding_include_dirs}
        --typesystem-paths=${testbinding_typesystem_path}
        --output-directory=${CMAKE_CURRENT_BINARY_DIR}
        ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_pysidetest.xml
        --api-version=${SUPPORTED_QT_VERSION}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Running generator for test binding..."
)

include_directories(${CMAKE_CURRENT_SOURCE_DIR}
                    ${CMAKE_CURRENT_BINARY_DIR}
                    ${Qt5Core_INCLUDE_DIRS}
                    ${Qt5Gui_INCLUDE_DIRS}
                    ${Qt5Widgets_INCLUDE_DIRS}
                    ${SHIBOKEN_INCLUDE_DIR}
                    ${pyside2_SOURCE_DIR}
                    ${QtCore_GEN_DIR}
                    ${QtGui_GEN_DIR}
                    ${QtWidgets_GEN_DIR}
                    ${libpyside_SOURCE_DIR}
                    ${SHIBOKEN_PYTHON_INCLUDE_DIR})

add_library(pysidetest SHARED ${pysidetest_SRC} ${pysidetest_MOC_SRC})
target_link_libraries(pysidetest
                      ${Qt5Core_LIBRARIES}
                      ${Qt5Gui_LIBRARIES}
                      ${Qt5Widgets_LIBRARIES}
                      )

add_library(testbinding MODULE ${testbinding_SRC})
set_property(TARGET testbinding PROPERTY PREFIX "")
set_property(TARGET testbinding PROPERTY OUTPUT_NAME "testbinding${PYTHON_EXTENSION_SUFFIX}")
if(WIN32)
    set_property(TARGET testbinding PROPERTY SUFFIX ".pyd")
endif()
target_link_libraries(testbinding
                      pysidetest
                      pyside2
                      ${PYTHON_LIBRARIES}
                      ${SHIBOKEN_LIBRARY}
                      ${Qt5Core_LIBRARIES}
                      ${Qt5Gui_LIBRARIES}
                      ${Qt5Widgets_LIBRARIES}
                      ${SBK_PYTHON_LIBRARIES})

add_dependencies(testbinding pyside2 QtCore QtGui QtWidgets pysidetest)

PYSIDE_TEST(decoratedslot_test.py)
PYSIDE_TEST(delegatecreateseditor_test.py)
PYSIDE_TEST(enum_test.py)
PYSIDE_TEST(homonymoussignalandmethod_test.py)
PYSIDE_TEST(list_signal_test.py)
PYSIDE_TEST(modelview_test.py)
PYSIDE_TEST(new_inherited_functions_test.py)
PYSIDE_TEST(notify_id.py)
PYSIDE_TEST(qvariant_test.py)
PYSIDE_TEST(signalandnamespace_test.py)
PYSIDE_TEST(signalwithdefaultvalue_test.py)
PYSIDE_TEST(signalemissionfrompython_test.py)
PYSIDE_TEST(version_test.py)
PYSIDE_TEST(typedef_signal_test.py)
PYSIDE_TEST(bug_1016.py)
PYSIDE_TEST(utils_test.py)
PYSIDE_TEST(mixin_signal_slots_test.py)
PYSIDE_TEST(signal_slot_warning.py)
PYSIDE_TEST(all_modules_load_test.py)
PYSIDE_TEST(signature_test.py)
PYSIDE_TEST(qapp_like_a_macro_test.py)