@@ -103,7 +103,12 @@ def _project_dirs(env, project):
103
103
def _build_project (env , project , cmake_extra , build_tests = False , args_transformer = None , coverage = False ):
104
104
sh = env .shell
105
105
config = project .get_config (env .spec )
106
+ build_env = []
106
107
toolchain = env .toolchain
108
+ if toolchain .cross_compile and env .variables ['go_path' ] is not None :
109
+ # We need to set the envrionment variable of GO_PATH for cross compile
110
+ build_env = ["GO_PATH={}\n " .format (env .variables ['go_path' ])]
111
+
107
112
# build dependencies first, let cmake decide what needs doing
108
113
for dep in project .get_dependencies (env .spec ):
109
114
_build_project (env , dep , cmake_extra )
@@ -178,13 +183,11 @@ def _build_project(env, project, cmake_extra, build_tests=False, args_transforme
178
183
cmake_args = args_transformer (env , project , cmake_args )
179
184
180
185
# When cross compiling, we must inject the build_env into the cross compile container
181
- build_env = []
182
186
if toolchain .cross_compile :
183
- build_env = ['{}={}\n ' .format (key , val )
187
+ build_env = build_env + ['{}={}\n ' .format (key , val )
184
188
for key , val in config .get ('build_env' , {}).items ()]
185
189
with open (toolchain .env_file , 'a' ) as f :
186
190
f .writelines (build_env )
187
-
188
191
# set parallism via env var (cmake's --parallel CLI option doesn't exist until 3.12)
189
192
if os .environ .get ('CMAKE_BUILD_PARALLEL_LEVEL' ) is None :
190
193
sh .setenv ('CMAKE_BUILD_PARALLEL_LEVEL' , str (os .cpu_count ()))
0 commit comments