-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.py
executable file
·108 lines (95 loc) · 4.64 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
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import multiprocessing
def DisplayGithub():
print("\n")
print(" Welcome to join me http://luotang.me ")
print(" Welcome to join me https://github.com/wypx/libmsf ")
print(" Welcome to join me https://github.com/wypx/mobile ")
print("\n")
def DisplayLogo():
print(" .::::. ")
print(" .::::::::. ")
print(" ::::::::::: ")
print(" ..:::::::::::' ")
print(" '::::::::::::' ")
print(" .:::::::::: ")
print(" '::::::::::::::.. ")
print(" ..::::::::::::. ")
print(" ``:::::::::::::::: ")
print(" ::::``:::::::::' .:::. ")
print(" ::::' ':::::' .::::::::. ")
print(" .::::' :::: .:::::::'::::. ")
print(" .:::' ::::: .:::::::::' ':::::. ")
print(" .::' :::::.:::::::::' ':::::. ")
print(" .::' ::::::::::::::' ``::::. ")
print(" ...::: ::::::::::::' ``::. ")
print(" ```` ':. ':::::::::' ::::.. ")
print(" '.:::::' ':'````.. ")
def MakeBuildDir(buildPath):
if not os.path.exists(buildPath):
os.makedirs(buildPath)
print("-- Dir \'" + buildPath + '\' has been created successfully.')
else:
print("-- Dir \'" + buildPath + '\' has already exist now.')
cpu_core_num = multiprocessing.cpu_count()
def MakeBuildLib(BuildRoot):
os.chdir(BuildRoot + "/build/lib")
os.system("cmake ../../lib")
os.system("make -j" + str(cpu_core_num))
os.system("make install")
def MakeBuildApp(BuildRoot):
os.chdir(BuildRoot + "/build/app")
os.system("cmake ../../app")
os.system("make -j" + str(cpu_core_num))
os.system("make install")
def MakeBuildProto(BuildRoot):
os.chdir(BuildRoot + "/lib/network/frpc")
os.system("protoc -I=./ --cpp_out=./ *.proto")
os.chdir(BuildRoot)
os.chdir(BuildRoot + "/lib/network/fraft/proto")
os.system("protoc -I=./ --cpp_out=./ *.proto")
os.chdir(BuildRoot)
if os.path.exists(BuildRoot + "/app/mobile/src/mobile.proto"):
os.chdir(BuildRoot + "/app/mobile/src")
os.system("protoc -I=./ --cpp_out=./ *.proto")
os.chdir(BuildRoot)
os.chdir(BuildRoot + "/app/watchdog")
os.system("protoc -I=./ --cpp_out=./ *.proto")
os.system("protoc -I=./ --cpp_out=../shell/ *.proto")
def MakeBuildClean(buildPath):
#os.removedirs(buildPath)
os.system("cd ..")
os.system("rm -rvf build")
def InstallDependencies():
# https://github.com/protocolbuffers/protobuf/releases/download/v3.12.2/protobuf-all-3.12.2.tar.gz
dependLibs = []
dependLibs.append("gcc")
dependLibs.append("g++")
dependLibs.append("make")
dependLibs.append("cmake3")
# apt-get install libaio-dev
# apt-get install liburing-dev
dependLibs.append("libnuma-dev")
dependLibs.append("libprotobuf-dev")
dependLibs.append("protobuf-compiler")
# apt-get install libgflags-dev
# apt-get install libuuid-dev
# apt-get install uuid-dev
# apt-get install libssl-dev
# apt-get install libsnappy-dev
# apt-get install libleveldb-dev
# apt-get install liblz4-dev
if __name__ == '__main__':
DisplayGithub()
# DisplayLogo()
print("\n******************* Micro Service Framework Build Starting **************************\n")
BuildRoot = os.getcwd()
MakeBuildDir("build/lib")
MakeBuildDir("build/app")
MakeBuildProto(BuildRoot)
MakeBuildLib(BuildRoot)
MakeBuildApp(BuildRoot)
# MakeBuildClean("build")
print("\n******************* Micro Service Framework Build Ending ****************************\n")