-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsetup.py
92 lines (84 loc) · 2.8 KB
/
setup.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
"""
Setup script for CommProtocol.
Copyright (C) 2016 Mario Garcia, Michael Wallace, Alex Craig.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(At your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
# Still figuring out the tools to work with.
import os
import time
import sys
import scripts.editor as editor
def InstallCMake():
"""
Install CMake on this machine.
:return:
"""
return
def CheckCMake():
"""
Check if Cmake is on this machine.
:return:
"""
return
def CheckOS(cmake_cmd):
"""
Check the operating system that this script is setting up on.
:return:
"""
editor.VersionEdit("cat")
platform = sys.platform
if platform.startswith('linux'):
print("Running on Linux")
# nothing to do...
elif platform.startswith('win32'):
print("Running on Windows")
usr = input("*\n*\n*\nDo you wish to build the C# module as well? (Y/n): ")
if usr.lower() == "y" or usr.lower() == "yes":
print("Building with the C# module...")
cmake_cmd = cmake_cmd + " -Dcsharp=ON"
else:
print("Skipping C# build")
cmake_cmd = cmake_cmd + " -Dcsharp=OFF"
return cmake_cmd
def main():
"""
Sets up the build folder for the user.
:return:
"""
build_dir = "build"
cmake_cmd = "cmake"
print("Setting up Git Repository.")
path = os.path.dirname(os.path.realpath(__file__))
os.chdir(path)
if os.path.isdir(build_dir):
print("build folder already exists!")
print("Overwriting old build folder.")
else:
print("Creating build folder...")
os.mkdir(build_dir)
usr = input("*\n*\n*\nDo you wish to add in tests? (Y/n): ")
if usr.lower() == "y" or usr.lower() == "yes":
print("Adding test cases...")
cmake_cmd = cmake_cmd + " -Dtest=ON"
else:
cmake_cmd = cmake_cmd + " -Dtest=OFF"
cmake_cmd = CheckOS(cmake_cmd)
start = time.monotonic()
os.chdir(build_dir)
print("Executing cmake...")
os.system(cmake_cmd + " -Dversion_release=ON -Dshared=ON" + " ../")
print("CMake finished.")
end = time.monotonic()
print("Build successfully finished. Took " + str((end - start)) + " sec")
return 0
if __name__ == '__main__':
main()