-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.py
executable file
·55 lines (42 loc) · 1.73 KB
/
build.py
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
#!/usr/bin/python
# Important: import panda3d as the very first library - otherwise it crashes
import panda3d.core # noqa
import sys
import os
import argparse
from os.path import join, realpath, dirname
# Change into the current directory
os.chdir(dirname(realpath(__file__)))
from scripts.common import get_ini_conf, write_ini_conf # noqa
from scripts.setup import make_output_dir, run_cmake, run_cmake_build
if __name__ == "__main__":
# Arguments
parser = argparse.ArgumentParser(description="P3DModuleBuilder")
parser.add_argument(
'--optimize', type=int, default=None,
help="Optimize level, should match the one used for the Panda3D build",)
parser.add_argument(
"--clean", action="store_true", help="Forces a clean rebuild")
args = parser.parse_args()
# Python 2 compatibility
if sys.version_info.major > 2:
raw_input = input
config_file = join(dirname(realpath(__file__)), "config.ini")
config = get_ini_conf(config_file)
# Find cached module name
if "module_name" not in config or not config["module_name"]:
module_name = str(raw_input("Enter a module name: "))
config["module_name"] = module_name.strip()
# Check for outdated parameters
for outdated_param in ["vc_version", "use_lib_eigen", "use_lib_bullet", "use_lib_freetype"]:
if outdated_param in config:
print("WARNING: Removing obsolete parameter '" + outdated_param + "', is now auto-detected.")
del config[outdated_param]
# Write back config
write_ini_conf(config, config_file)
# Just execute the build script
make_output_dir(clean=args.clean)
run_cmake(config, args)
run_cmake_build(config, args)
print("Success!")
sys.exit(0)