Skip to content

Commit 5fb06e5

Browse files
committed
Redesign shell to python script for build plugin
1 parent 7b89406 commit 5fb06e5

5 files changed

Lines changed: 54 additions & 56 deletions

File tree

DEVELOPMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Ubuntu/Debian:
5353
```bash
5454
$ cd my_project
5555
$ cd UnigineEditorPlugin_Python3Scripting
56-
$ ./build_plugin_linux.sh
56+
$ python3 build_plugin.py
5757
```
5858

5959
### step 5: run editor

build_plugin.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
4+
import sys
5+
import os
6+
import platform
7+
8+
9+
_platform = platform.platform().lower()
10+
is_linux = False
11+
is_windows = False
12+
if _platform.startswith("linux"):
13+
_platform = "linux"
14+
is_linux = True
15+
elif _platform.startswith("windows"):
16+
_platform = "windows"
17+
is_windows = True
18+
else:
19+
sys.exit("Unknown platform")
20+
21+
22+
23+
build_commands = [
24+
{
25+
"name": "cmake configure release",
26+
"command": "cmake -H. -Bjunk/release -DCMAKE_BUILD_TYPE=Release \
27+
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
28+
-DCMAKE_INSTALL_PREFIX=../bin",
29+
},
30+
{
31+
"name": "cmake build release",
32+
"command": "cmake --build junk/release --parallel 8 --config Release",
33+
},
34+
{
35+
"name": "cmake configure debug",
36+
"command": "cmake -H. -Bjunk/debug -DCMAKE_BUILD_TYPE=Debug \
37+
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
38+
-DCMAKE_INSTALL_PREFIX=../bin",
39+
},
40+
{
41+
"name": "cmake build debug",
42+
"command": "cmake --build junk/debug --parallel 8 --config Debug",
43+
},
44+
]
45+
46+
os.chdir("UnigineEditorPlugin_Python3Scripting")
47+
48+
for _cmd in build_commands:
49+
ret = os.system(_cmd["command"])
50+
if ret != 0:
51+
sys.exit(-1)

build_plugin_linux.sh

Lines changed: 0 additions & 46 deletions
This file was deleted.

build_plugin_windows.bat

Lines changed: 0 additions & 1 deletion
This file was deleted.

pack_plugin.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,7 @@
1919
else:
2020
sys.exit("Unknown platform")
2121

22-
23-
if is_linux:
24-
ret = os.system("./build_plugin_linux.sh")
25-
26-
if is_windows:
27-
ret = os.system("./build_plugin_windows.bat")
28-
22+
ret = os.system("python3 build_plugin.py")
2923
if ret != 0:
3024
sys.exit("Could not build...")
3125

@@ -35,7 +29,7 @@
3529
_version = content.strip()
3630

3731
folder_inside = "UnigineEditorPlugin_Python3Scripting_" + _version
38-
_zip_filename = _platform + "_UnigineEditorPlugin_Python3Scripting_" + _version + ".zip"
32+
_zip_filename = _platform + "_" + folder_inside + ".zip"
3933

4034
if os.path.isfile(_zip_filename):
4135
os.remove(_zip_filename)

0 commit comments

Comments
 (0)