@@ -12,46 +12,7 @@ def log(msg):
12
12
class LibraryBuilder :
13
13
def __init__ (self ):
14
14
self .triple = os .environ .get ('TRIPLE' )
15
-
16
- # All of this is only valid for ubuntu-20.04 and windows-2022
17
- if self .triple == "linux-x64-gcc9" :
18
- self .cc_compiler = "gcc"
19
- self .cxx_compiler = "g++"
20
- self .cc_compiler_package = "gcc"
21
- self .cxx_compiler_package = "g++"
22
- self .toolchain_file = ""
23
- elif self .triple == "linux-x64-clang10" :
24
- self .cc_compiler = "clang"
25
- self .cxx_compiler = "clang++"
26
- self .cc_compiler_package = "clang"
27
- self .cxx_compiler_package = "clang++"
28
- self .toolchain_file = ""
29
- elif self .triple == "linux-armv7-gcc9" :
30
- self .cc_compiler = ""
31
- self .cxx_compiler = ""
32
- self .cc_compiler_package = "gcc-9-arm-linux-gnueabi"
33
- self .cxx_compiler_package = "g++-9-arm-linux-gnueabi"
34
- self .toolchain_file = "toolchains/gcc-armv7.cmake"
35
- elif self .triple == "linux-aarch64-gcc9" :
36
- self .cc_compiler = ""
37
- self .cxx_compiler = ""
38
- self .cc_compiler_package = "gcc-9-aarch64-linux-gnu"
39
- self .cxx_compiler_package = "g++-9-aarch64-linux-gnu"
40
- self .toolchain_file = "toolchains/gcc-aarch64.cmake"
41
- elif self .triple == "windows-x64-mingw64" :
42
- self .cc_compiler = "cc"
43
- self .cxx_compiler = "c++"
44
- self .cc_compiler_package = ""
45
- self .cxx_compiler_package = ""
46
- self .toolchain_file = ""
47
- elif self .triple == "windows-x64-msvc" :
48
- self .cc_compiler = "msvc"
49
- self .cxx_compiler = "msvc"
50
- self .cc_compiler_package = ""
51
- self .cxx_compiler_package = ""
52
- self .toolchain_file = ""
53
- else :
54
- raise LookupError (f"Triple { self .triple } is not known to the system" )
15
+ self .toolchain_file = f"toolchains/{ self .triple } .cmake"
55
16
56
17
self .repo_dir = os .getcwd ()
57
18
self .working_dir = os .path .join (self .repo_dir , 'temp' , self .name )
@@ -107,19 +68,6 @@ def source_git_repo(self, git_repository, git_tag):
107
68
self .cmd (f'git clone { git_repository } { self .source_dir } --depth=1 --single-branch --branch={ git_tag } ' )
108
69
log (f"Sourcing git repository { git_repository } :{ git_tag } ... Done" )
109
70
110
- def install_build_dependencies (self , extra_unix_dependencies = []):
111
- if platform .system () == 'Linux' :
112
- if self .cc_compiler_package != "" :
113
- extra_unix_dependencies .append (self .cc_compiler_package )
114
- if self .cxx_compiler_package != "" :
115
- extra_unix_dependencies .append (self .cxx_compiler_package )
116
-
117
- deps = ' ' .join (extra_unix_dependencies )
118
- log (f"Installing extra unix dependencies ..." )
119
- if os .system (f'apt-get update && apt-get install -y { deps } ' ) != 0 :
120
- self .cmd (f'sudo apt-get update && sudo apt-get install -y { deps } ' )
121
- log (f"Installing extra unix dependencies ... Done" )
122
-
123
71
def pull_of_dependency (self , package , version ):
124
72
depsdir = self .get_dependency_dir (package )
125
73
log (f'Fetching package { package } /{ version } ...' )
@@ -141,13 +89,7 @@ def build_generic_cmake_project(self,
141
89
cmake_args_debug = [],
142
90
cmake_args_release = []):
143
91
144
- if self .toolchain_file != None and self .toolchain_file != "" :
145
- cmake_args .append (f'-DCMAKE_TOOLCHAIN_FILE={ os .path .join (self .repo_dir , self .toolchain_file )} ' )
146
- else :
147
- if self .cc_compiler != 'msvc' :
148
- cmake_args .append (f'-DCMAKE_C_COMPILER={ self .cc_compiler } ' )
149
- cmake_args .append (f'-DCMAKE_CXX_COMPILER={ self .cxx_compiler } ' )
150
-
92
+ cmake_args .append (f'-DCMAKE_TOOLCHAIN_FILE={ os .path .join (self .repo_dir , self .toolchain_file )} ' )
151
93
cmake_args .append (f'-DBUILD_SHARED_LIBS=OFF' )
152
94
cmake_args .append (f'-DPython_ROOT_DIR={ os .path .dirname (sys .executable )} ' )
153
95
cmake_args .append (f'-DPython3_ROOT_DIR={ os .path .dirname (sys .executable )} ' )
@@ -172,7 +114,7 @@ def build_generic_cmake_project(self,
172
114
args_release .append (' ' .join (cmake_args_release ))
173
115
174
116
cmake_build_args = []
175
- if self .cc_compiler != 'msvc' :
117
+ if self .triple . find ( 'msvc' ) == - 1 :
176
118
cmake_build_args .append (f'-j{ os .cpu_count ()} ' )
177
119
178
120
log (f'Building Debug configuration ...' )
0 commit comments