aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/plugins/designer/CMakeLists.txt
blob: c86d328cfc6cd44053c43ac74e29fa0653d61b2c (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
# Copyright (C) 2023 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause

project(PySidePlugin)

# Note: At runtime, the dependency to the shiboken library is resolved
# by the pyside_tool.py wrapper

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOMOC ON)

find_package(Qt6 COMPONENTS Core Gui Widgets UiPlugin)

qt_add_plugin(PySidePlugin)

target_sources(PySidePlugin PRIVATE
    designercustomwidgets.cpp designercustomwidgets.h
)

# See libshiboken/CMakeLists.txt
if(PYTHON_LIMITED_API)
    target_compile_definitions(PySidePlugin PRIVATE "-DPy_LIMITED_API=0x03050000")
endif()

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
    if(PYTHON_WITH_DEBUG)
        target_compile_definitions(PySidePlugin PRIVATE "-DPy_DEBUG")
    endif()
    if (PYTHON_WITH_COUNT_ALLOCS)
        target_compile_definitions(PySidePlugin PRIVATE "-DCOUNT_ALLOCS")
    endif()
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
    target_compile_definitions(PySidePlugin PRIVATE "-DNDEBUG")
endif()

target_include_directories(PySidePlugin PRIVATE ../uitools)

set_target_properties(PySidePlugin PROPERTIES
    WIN32_EXECUTABLE TRUE
    MACOSX_BUNDLE TRUE
)

get_property(SHIBOKEN_PYTHON_LIBRARIES GLOBAL PROPERTY shiboken_python_libraries)
get_property(SHIBOKEN_PYTHON_INCLUDE_DIRS GLOBAL PROPERTY shiboken_python_include_dirs)

target_include_directories(PySidePlugin PRIVATE ${SHIBOKEN_PYTHON_INCLUDE_DIRS})

target_link_libraries(PySidePlugin PRIVATE
                      Qt::Core
                      Qt::Gui
                      Qt::UiPlugin
                      Qt::Widgets
                      ${SHIBOKEN_PYTHON_LIBRARIES})

install(TARGETS PySidePlugin LIBRARY DESTINATION "${QT6_INSTALL_PLUGINS}/designer")