Merge pull request #1814 from juj/fix_test_static_link
Fix test static link
This commit is contained in:
Коммит
dca9531043
29
emlink.py
29
emlink.py
|
@ -10,21 +10,24 @@ import sys
|
|||
from tools import shared
|
||||
from tools.asm_module import AsmModule
|
||||
|
||||
try:
|
||||
me, main, side, out = sys.argv[:4]
|
||||
except:
|
||||
print >> sys.stderr, 'usage: emlink.py [main module] [side module] [output name]'
|
||||
sys.exit(1)
|
||||
def run():
|
||||
try:
|
||||
me, main, side, out = sys.argv[:4]
|
||||
except:
|
||||
print >> sys.stderr, 'usage: emlink.py [main module] [side module] [output name]'
|
||||
sys.exit(1)
|
||||
|
||||
print 'Main module:', main
|
||||
print 'Side module:', side
|
||||
print 'Output:', out
|
||||
print 'Main module:', main
|
||||
print 'Side module:', side
|
||||
print 'Output:', out
|
||||
|
||||
shared.try_delete(out)
|
||||
shared.try_delete(out)
|
||||
|
||||
main = AsmModule(main)
|
||||
side = AsmModule(side)
|
||||
main = AsmModule(main)
|
||||
side = AsmModule(side)
|
||||
|
||||
side.relocate_into(main)
|
||||
main.write(out)
|
||||
side.relocate_into(main)
|
||||
main.write(out)
|
||||
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
|
|
|
@ -673,6 +673,24 @@ class BrowserCore(RunnerCore):
|
|||
|
||||
###################################################################################################
|
||||
|
||||
# Both test_core and test_other access the Bullet library, share the access here to avoid duplication.
|
||||
def get_bullet_library(runner_core, use_cmake):
|
||||
if use_cmake:
|
||||
configure_commands = ['cmake', '.']
|
||||
configure_args = ['-DBUILD_DEMOS=OFF', '-DBUILD_EXTRAS=OFF']
|
||||
# Depending on whether 'configure' or 'cmake' is used to build, Bullet places output files in different directory structures.
|
||||
generated_libs = [os.path.join('src', 'BulletDynamics', 'libBulletDynamics.a'),
|
||||
os.path.join('src', 'BulletCollision', 'libBulletCollision.a'),
|
||||
os.path.join('src', 'LinearMath', 'libLinearMath.a')]
|
||||
else:
|
||||
configure_commands = ['sh', './configure']
|
||||
configure_args = ['--disable-demos','--disable-dependency-tracking']
|
||||
generated_libs = [os.path.join('src', '.libs', 'libBulletDynamics.a'),
|
||||
os.path.join('src', '.libs', 'libBulletCollision.a'),
|
||||
os.path.join('src', '.libs', 'libLinearMath.a')]
|
||||
|
||||
return runner_core.get_library('bullet', generated_libs, configure=configure_commands, configure_args=configure_args, cache_name_extra=configure_commands[0])
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Sanity checks
|
||||
total_engines = len(JS_ENGINES)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import glob, hashlib, os, re, shutil, subprocess, sys
|
||||
import tools.shared
|
||||
from tools.shared import *
|
||||
from runner import RunnerCore, path_from_root, checked_sanity, test_modes
|
||||
from runner import RunnerCore, path_from_root, checked_sanity, test_modes, get_bullet_library
|
||||
|
||||
class T(RunnerCore): # Short name, to make it more fun to use manually on the commandline
|
||||
def is_le32(self):
|
||||
|
@ -9001,30 +9001,17 @@ def process(filename):
|
|||
Settings.SAFE_HEAP_LINES = ['btVoronoiSimplexSolver.h:40', 'btVoronoiSimplexSolver.h:41',
|
||||
'btVoronoiSimplexSolver.h:42', 'btVoronoiSimplexSolver.h:43']
|
||||
|
||||
configure_commands = [['sh', './configure'], ['cmake', '.']]
|
||||
configure_args = [['--disable-demos','--disable-dependency-tracking'], ['-DBUILD_DEMOS=OFF', '-DBUILD_EXTRAS=OFF']]
|
||||
for c in range(0,2):
|
||||
configure = configure_commands[c]
|
||||
for use_cmake in [False, True]: # If false, use a configure script to configure Bullet build.
|
||||
# Windows cannot run configure sh scripts.
|
||||
if WINDOWS and configure[0] == 'sh':
|
||||
if WINDOWS and not use_cmake:
|
||||
continue
|
||||
|
||||
# Depending on whether 'configure' or 'cmake' is used to build, Bullet places output files in different directory structures.
|
||||
if configure[0] == 'sh':
|
||||
generated_libs = [os.path.join('src', '.libs', 'libBulletDynamics.a'),
|
||||
os.path.join('src', '.libs', 'libBulletCollision.a'),
|
||||
os.path.join('src', '.libs', 'libLinearMath.a')]
|
||||
else:
|
||||
generated_libs = [os.path.join('src', 'BulletDynamics', 'libBulletDynamics.a'),
|
||||
os.path.join('src', 'BulletCollision', 'libBulletCollision.a'),
|
||||
os.path.join('src', 'LinearMath', 'libLinearMath.a')]
|
||||
|
||||
def test():
|
||||
self.do_run(open(path_from_root('tests', 'bullet', 'Demos', 'HelloWorld', 'HelloWorld.cpp'), 'r').read(),
|
||||
[open(path_from_root('tests', 'bullet', 'output.txt'), 'r').read(), # different roundings
|
||||
open(path_from_root('tests', 'bullet', 'output2.txt'), 'r').read(),
|
||||
open(path_from_root('tests', 'bullet', 'output3.txt'), 'r').read()],
|
||||
libraries=self.get_library('bullet', generated_libs, configure=configure, configure_args=configure_args[c], cache_name_extra=configure[0]),
|
||||
libraries=get_bullet_library(self, use_cmake),
|
||||
includes=[path_from_root('tests', 'bullet', 'src')])
|
||||
test()
|
||||
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
import multiprocessing, os, re, shutil, subprocess, sys
|
||||
import tools.shared
|
||||
from tools.shared import *
|
||||
from runner import RunnerCore, path_from_root
|
||||
from runner import RunnerCore, path_from_root, get_bullet_library
|
||||
|
||||
class other(RunnerCore):
|
||||
def get_zlib_library(self):
|
||||
if WINDOWS:
|
||||
return self.get_library('zlib', os.path.join('libz.a'), configure=['emconfigure.bat'], configure_args=['cmake', '.', '-DBUILD_SHARED_LIBS=OFF'], make=['mingw32-make'], make_args=[])
|
||||
else:
|
||||
return self.get_library('zlib', os.path.join('libz.a'), make_args=['libz.a'])
|
||||
|
||||
def test_emcc(self):
|
||||
for compiler in [EMCC, EMXX]:
|
||||
shortcompiler = os.path.basename(compiler)
|
||||
|
@ -740,21 +746,21 @@ f.close()
|
|||
|
||||
# zlib compression library. tests function pointers in initializers and many other things
|
||||
test('zlib', '', open(path_from_root('tests', 'zlib', 'example.c'), 'r').read(),
|
||||
self.get_library('zlib', os.path.join('libz.a'), make_args=['libz.a']),
|
||||
self.get_zlib_library(),
|
||||
open(path_from_root('tests', 'zlib', 'ref.txt'), 'r').read(),
|
||||
args=['-I' + path_from_root('tests', 'zlib')], suffix='c')
|
||||
|
||||
use_cmake = WINDOWS
|
||||
bullet_library = get_bullet_library(self, use_cmake)
|
||||
|
||||
# bullet physics engine. tests all the things
|
||||
test('bullet', '', open(path_from_root('tests', 'bullet', 'Demos', 'HelloWorld', 'HelloWorld.cpp'), 'r').read(),
|
||||
self.get_library('bullet', [os.path.join('src', '.libs', 'libBulletDynamics.a'),
|
||||
os.path.join('src', '.libs', 'libBulletCollision.a'),
|
||||
os.path.join('src', '.libs', 'libLinearMath.a')]),
|
||||
bullet_library,
|
||||
[open(path_from_root('tests', 'bullet', 'output.txt'), 'r').read(), # different roundings
|
||||
open(path_from_root('tests', 'bullet', 'output2.txt'), 'r').read(),
|
||||
open(path_from_root('tests', 'bullet', 'output3.txt'), 'r').read()],
|
||||
args=['-I' + path_from_root('tests', 'bullet', 'src')])
|
||||
|
||||
|
||||
def test_outline(self):
|
||||
def test(name, src, libs, expected, expected_ranges, args=[], suffix='cpp'):
|
||||
print name
|
||||
|
@ -819,12 +825,8 @@ f.close()
|
|||
}),
|
||||
]:
|
||||
Building.COMPILER_TEST_OPTS = test_opts
|
||||
if WINDOWS:
|
||||
zlib_library = self.get_library('zlib', os.path.join('libz.a'), configure=['emconfigure.bat'], configure_args=['cmake', '.', '-DBUILD_SHARED_LIBS=OFF'], make=['mingw32-make'], make_args=[])
|
||||
else:
|
||||
zlib_library = self.get_library('zlib', os.path.join('libz.a'), make_args=['libz.a'])
|
||||
test('zlib', path_from_root('tests', 'zlib', 'example.c'),
|
||||
zlib_library,
|
||||
self.get_zlib_library(),
|
||||
open(path_from_root('tests', 'zlib', 'ref.txt'), 'r').read(),
|
||||
expected_ranges,
|
||||
args=['-I' + path_from_root('tests', 'zlib')], suffix='c')
|
||||
|
|
Загрузка…
Ссылка в новой задаче