Skip to content

Commit b58af82

Browse files
lins05killing
authored andcommitted
Speed up windows build.
1 parent 99cf670 commit b58af82

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

scripts/build/build-msi.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
print 'Python 2.6 or above is required. Quit now.'
2626
sys.exit(1)
2727

28+
import multiprocessing
2829
import os
2930
import glob
3031
import shutil
@@ -260,14 +261,17 @@ def build(self):
260261
def get_make_path():
261262
return find_in_path('make.exe')
262263

264+
def concurrent_make():
265+
return '%s -j%s' % (get_make_path(), multiprocessing.cpu_count())
266+
263267
class Libsearpc(Project):
264268
name = 'libsearpc'
265269

266270
def __init__(self):
267271
Project.__init__(self)
268272
self.build_commands = [
269273
'sh ./configure --prefix=%s --disable-compile-demo' % to_mingw_path(self.prefix),
270-
get_make_path(),
274+
concurrent_make(),
271275
'%s install' % get_make_path(),
272276
]
273277

@@ -281,7 +285,7 @@ def __init__(self):
281285
Project.__init__(self)
282286
self.build_commands = [
283287
'sh ./configure --prefix=%s --disable-compile-demo' % to_mingw_path(self.prefix),
284-
get_make_path(),
288+
concurrent_make(),
285289
'%s install' % get_make_path(),
286290
]
287291

@@ -305,7 +309,7 @@ def __init__(self):
305309
enable_breakpad = ''
306310
self.build_commands = [
307311
'sh ./configure %s --prefix=%s' % (enable_breakpad, to_mingw_path(self.prefix)),
308-
get_make_path(),
312+
concurrent_make(),
309313
'%s install' % get_make_path(),
310314
]
311315

@@ -334,7 +338,7 @@ def __init__(self):
334338
'CMAKE_EXE_LINKER_FLAGS_RELEASE': '-L%s' % (os.path.join(seafile_prefix, 'lib') if ninja else to_mingw_path(os.path.join(seafile_prefix, 'lib'))),
335339
}
336340
flags = ' '.join(['-D%s=%s' % (k, v) for k, v in flags.iteritems()])
337-
make = ninja or get_make_path()
341+
make = ninja or concurrent_make()
338342
self.build_commands = [
339343
'cmake -G "%s" %s -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%s .' % (generator, flags, to_mingw_path(self.prefix)),
340344
make,

0 commit comments

Comments
 (0)