Skip to content

Commit 3720513

Browse files
committed
🧪 test(PySide): 添加PySide工程
1 parent 0eecf5c commit 3720513

File tree

5 files changed

+70
-1
lines changed

5 files changed

+70
-1
lines changed

‎.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,3 +321,8 @@ CMakeLists.txt.user*
321321
.ionide
322322

323323
# End of https://www.toptal.com/developers/gitignore/api/qt,qtcreator,cmake,c++,visualstudiocode,python
324+
325+
.DS_Store
326+
Release
327+
Debug
328+
build

‎CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,20 @@ cmake_minimum_required(VERSION 3.12)
22

33
project(QLiteHtml)
44

5+
# Enable policy to not use RPATH settings for install_name on macOS.
6+
if(POLICY CMP0068)
7+
cmake_policy(SET CMP0068 NEW)
8+
endif()
9+
10+
# Enable policy to run automoc on generated files.
11+
if(POLICY CMP0071)
12+
cmake_policy(SET CMP0071 NEW)
13+
endif()
14+
515
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/dist")
6-
set(CMAKE_BUILD_TYPE Release)
16+
717
set(QLITEHTML_LIBRARY_TYPE STATIC)
818

919
add_subdirectory(qlitehtml)
1020
add_subdirectory(QLiteHtmlSip)
21+
add_subdirectory(QLiteHtmlShiboken)

‎QLiteHtmlShiboken/CMakeLists.txt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,41 @@
11
cmake_minimum_required(VERSION 3.12)
22

33
project(QLiteHtmlShiboken)
4+
5+
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Gui Widgets)
6+
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Widgets)
7+
8+
if(CMAKE_HOST_WIN32)
9+
set(PYTHON python)
10+
set(VER 1)
11+
else()
12+
set(PYTHON python3)
13+
endif()
14+
15+
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
16+
set(SHIBOKEN shiboken6)
17+
execute_process(
18+
COMMAND
19+
${PYTHON} -c
20+
"import os,PySide6;print(os.path.dirname(PySide6.__file__).replace('\\\\', '/'),end='')"
21+
OUTPUT_VARIABLE PYSIDEPATH)
22+
else()
23+
set(SHIBOKEN shiboken2)
24+
execute_process(
25+
COMMAND
26+
${PYTHON} -c
27+
"import os,PySide2;print(os.path.dirname(PySide2.__file__).replace('\\\\', '/'),end='')"
28+
OUTPUT_VARIABLE PYSIDEPATH)
29+
endif()
30+
31+
message("PYSIDEPATH: ${PYSIDEPATH}")
32+
33+
string(REPLACE ";" ":" QtWidgets_INCLUDE_DIRS
34+
"${Qt${QT_VERSION_MAJOR}Widgets_INCLUDE_DIRS}")
35+
string(REPLACE ";" ":" QtGui_INCLUDE_DIRS
36+
"${Qt${QT_VERSION_MAJOR}Gui_INCLUDE_DIRS}")
37+
string(REPLACE ";" ":" QtCore_INCLUDE_DIRS
38+
"${Qt${QT_VERSION_MAJOR}Core_INCLUDE_DIRS}")
39+
40+
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/project.toml.in"
41+
"${CMAKE_CURRENT_SOURCE_DIR}/project.toml")

‎QLiteHtmlShiboken/project.toml.in

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[generator-project]
2+
debug-level = full
3+
output-directory = out
4+
header-file = ${CMAKE_CURRENT_SOURCE_DIR}/../qlitehtml/src/qlitehtmlwidget.h
5+
typesystem-file = typesystem_QLiteHtmlWidget.xml
6+
include-path = ${CMAKE_CURRENT_SOURCE_DIR}/../qlitehtml/src:${QtCore_INCLUDE_DIRS}:${QtGui_INCLUDE_DIRS}:${QtWidgets_INCLUDE_DIRS}
7+
typesystem-path = ${PYSIDEPATH}/typesystems
8+
9+
enable-parent-ctor-heuristic
10+
enable-return-value-heuristic
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0"?>
2+
<typesystem package="PySide2">
3+
<load-typesystem name="typesystem_widgets.xml" generate="no"/>
4+
<object-type name="QLiteHtmlWidget"/>
5+
</typesystem>

0 commit comments

Comments
 (0)