Skip to content

Commit 8504e55

Browse files
committed
Fixing compilation for windows (release only)
1 parent 4d8364c commit 8504e55

16 files changed

Lines changed: 204 additions & 47 deletions

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
UnigineEditorPlugin_Python3Scripting/python-bin
1+
UnigineEditorPlugin_Python3Scripting/python-bin*
22
linux_UnigineEditorPlugin_Python3Scripting*
3+
lib/
34

45
# Prerequisites
56
*.d

DEVELOPMENT.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $ sudo apt install qt5-default cmake gcc git-core
1818

1919
Windows:
2020
- install cmake >= 3.20
21-
- install visual studio
21+
- install Visual Studio 2017
2222
- install qt 5.12.x (And set system environment variable `QTDIR=C:\Qt\Qt5.12.3\5.12.3\`)
2323
- install python3 (for command scripts)
2424

@@ -47,6 +47,13 @@ $ cd UnigineEditorPlugin_Python3Scripting
4747
$ ./build_python.sh
4848
```
4949

50+
Windows (Visual Studio 2017):
51+
```
52+
> cd my_project
53+
> cd UnigineEditorPlugin_Python3Scripting
54+
> PCBuild\build.bat
55+
```
56+
5057
### step 4: build plugin
5158

5259
Ubuntu/Debian:

UnigineEditorPlugin_Python3Scripting/CMakeLists.txt

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ add_subdirectory(QCodeEditor)
1313

1414
include(${PROJECT_SOURCE_DIR}/cmake/Unigine.cmake)
1515

16-
if (EXISTS ${PROJECT_SOURCE_DIR}/${proj_name}.json.in)
16+
if (EXISTS ${PROJECT_SOURCE_DIR}/UnigineEditorPlugin_Python3Scripting.json.in)
1717
set(PLUGIN_VERSION ${UNIGINE_VERSION})
1818
set(PLUGIN_COMPAT_VERSION ${PYTHON3SCRIPTING_VERSION})
1919
configure_file(
20-
${PROJECT_SOURCE_DIR}/${proj_name}.json.in
20+
${PROJECT_SOURCE_DIR}/UnigineEditorPlugin_Python3Scripting.json.in
2121
${CMAKE_CURRENT_BINARY_DIR}/Plugin.json
2222
)
2323
endif()
@@ -63,14 +63,26 @@ add_library(${proj_name} SHARED
6363
${PROJECT_SOURCE_DIR}/src/python3_wrapper/pytypesobjects/python3_unigine_node.cpp
6464
)
6565

66+
IF (WIN32)
67+
# windows
68+
set(PYTHON3_INCLUDES "")
69+
list (APPEND PYTHON3_INCLUDES "${CMAKE_SOURCE_DIR}/Python-3.10.1/Include")
70+
list (APPEND PYTHON3_INCLUDES "${CMAKE_SOURCE_DIR}/Python-3.10.1/PC")
71+
set(PYTHON3_LIB "${CMAKE_SOURCE_DIR}/python-bin-windows/python310.lib")
72+
ELSE()
73+
# linux
74+
set(PYTHON3_INCLUDES "${PROJECT_SOURCE_DIR}/python-bin-linux/include/python3.10")
75+
set(PYTHON3_LIB "${CMAKE_SOURCE_DIR}/python-bin-linux/lib/libpython3.10.a")
76+
ENDIF()
77+
6678
target_include_directories(${proj_name} SYSTEM
6779
PRIVATE
6880
${PROJECT_SOURCE_DIR}/QCodeEditor/include
6981
${PROJECT_SOURCE_DIR}/include
7082
${PROJECT_SOURCE_DIR}/src/
7183
${PROJECT_SOURCE_DIR}/src/python3_wrapper
7284
${PROJECT_SOURCE_DIR}/src/python3_wrapper/pytypesobjects/
73-
${PROJECT_SOURCE_DIR}/python-bin/include/python3.10
85+
${PYTHON3_INCLUDES}
7486
${CMAKE_CURRENT_BINARY_DIR}
7587
)
7688

@@ -113,7 +125,7 @@ target_link_libraries(${proj_name}
113125
Qt5::Gui
114126
Qt5::Widgets
115127
QCodeEditor
116-
${CMAKE_SOURCE_DIR}/python-bin/lib/libpython3.10.a
128+
${PYTHON3_LIB}
117129
)
118130

119131

UnigineEditorPlugin_Python3Scripting/Python-3.10.1/PCbuild/_asyncio.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<Import Project="python.props" />
7575
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
7676
<PropertyGroup Label="Configuration">
77-
<ConfigurationType>DynamicLibrary</ConfigurationType>
77+
<ConfigurationType>StaticLibrary</ConfigurationType>
7878
<CharacterSet>NotSet</CharacterSet>
7979
</PropertyGroup>
8080
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />

UnigineEditorPlugin_Python3Scripting/Python-3.10.1/PCbuild/python3dll.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
<Import Project="python.props" />
7777
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
7878
<PropertyGroup Label="Configuration">
79-
<ConfigurationType>DynamicLibrary</ConfigurationType>
79+
<ConfigurationType>StaticLibrary</ConfigurationType>
8080
</PropertyGroup>
8181
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
8282
<ImportGroup Label="ExtensionSettings">

UnigineEditorPlugin_Python3Scripting/Python-3.10.1/PCbuild/regen.targets

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@
2222
<_OpcodeSources Include="$(PySourcePath)Tools\scripts\generate_opcode_h.py;$(PySourcePath)Lib\opcode.py" />
2323
<_OpcodeOutputs Include="$(PySourcePath)Include\opcode.h;$(PySourcePath)Python\opcode_targets.h" />
2424
<_TokenSources Include="$(PySourcePath)Grammar\Tokens" />
25-
<_TokenOutputs Include="$(PySourcePath)Doc\library\token-list.inc">
26-
<Format>rst</Format>
27-
</_TokenOutputs>
2825
<_TokenOutputs Include="$(PySourcePath)Include\token.h">
2926
<Format>h</Format>
3027
</_TokenOutputs>

UnigineEditorPlugin_Python3Scripting/Python-3.10.1/PCbuild/winsound.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
<Import Project="python.props" />
7676
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
7777
<PropertyGroup Label="Configuration">
78-
<ConfigurationType>DynamicLibrary</ConfigurationType>
78+
<ConfigurationType>StaticLibrary</ConfigurationType>
7979
<CharacterSet>NotSet</CharacterSet>
8080
</PropertyGroup>
8181
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />

UnigineEditorPlugin_Python3Scripting/Python-3.10.1/PCbuild/xxlimited.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<Import Project="python.props" />
7575
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
7676
<PropertyGroup Label="Configuration">
77-
<ConfigurationType>DynamicLibrary</ConfigurationType>
77+
<ConfigurationType>StaticLibrary</ConfigurationType>
7878
<CharacterSet>NotSet</CharacterSet>
7979
<SupportPGO>false</SupportPGO>
8080
</PropertyGroup>

UnigineEditorPlugin_Python3Scripting/Python-3.10.1/PCbuild/xxlimited_35.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<Import Project="python.props" />
7575
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
7676
<PropertyGroup Label="Configuration">
77-
<ConfigurationType>DynamicLibrary</ConfigurationType>
77+
<ConfigurationType>StaticLibrary</ConfigurationType>
7878
<CharacterSet>NotSet</CharacterSet>
7979
<SupportPGO>false</SupportPGO>
8080
</PropertyGroup>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
@echo off
2+
3+
endlocal
4+
setlocal
5+
6+
cd Python-3.10.1
7+
8+
9+
10+
call PCbuild\build.bat
11+
if %ERRORLEVEL% GEQ 1 (
12+
echo "Problem with prepare configuration"
13+
EXIT /B 1
14+
)
15+
16+
XCOPY /F PCbuild\amd64\* ../python-bin-windows
17+
18+
IF EXIST ..\python-bin-windows\ RMDIR /S /Q ..\python-bin-windows\
19+
20+
MKDIR ..\python-bin-windows\
21+
22+
XCOPY /K /D /Y /H PCbuild\amd64\* ..\python-bin-windows\

0 commit comments

Comments
 (0)