Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/tools/ports/bullet.py
4130 views
1
# Copyright 2015 The Emscripten Authors. All rights reserved.
2
# Emscripten is available under two separate licenses, the MIT license and the
3
# University of Illinois/NCSA Open Source License. Both these licenses can be
4
# found in the LICENSE file.
5
6
import os
7
import shutil
8
9
TAG = 'version_1'
10
HASH = '3922486816cf7d99ee02c3c1ef63d94290e8ed304016dd9927137d04206e7674d9df8773a4abb7bb57783d0a5107ad0f893aa87acfb34f7b316eec22ca55a536'
11
12
13
def needed(settings):
14
return settings.USE_BULLET == 1
15
16
17
def get(ports, settings, shared):
18
ports.fetch_project('bullet', f'https://github.com/emscripten-ports/bullet/archive/{TAG}.zip', sha512hash=HASH)
19
20
def create(final):
21
source_path = ports.get_dir('bullet', 'Bullet-' + TAG)
22
src_path = os.path.join(source_path, 'bullet', 'src')
23
24
dest_include_path = ports.get_include_dir('bullet')
25
for base, _, files in os.walk(src_path):
26
for f in files:
27
if shared.suffix(f) != '.h':
28
continue
29
fullpath = os.path.join(base, f)
30
relpath = os.path.relpath(fullpath, src_path)
31
target = os.path.join(dest_include_path, relpath)
32
shared.safe_ensure_dirs(os.path.dirname(target))
33
shutil.copyfile(fullpath, target)
34
35
includes = []
36
for base, dirs, _ in os.walk(src_path, topdown=False):
37
for dir in dirs:
38
includes.append(os.path.join(base, dir))
39
40
flags = [
41
'-Wno-single-bit-bitfield-constant-conversion',
42
'-Wno-int-to-void-pointer-cast',
43
'-std=gnu++14',
44
]
45
ports.make_pkg_config('bullet', TAG, '-sUSE_BULLET')
46
ports.build_port(src_path, final, 'bullet', includes=includes, flags=flags, exclude_dirs=['MiniCL'])
47
48
return [shared.cache.get_lib('libbullet.a', create)]
49
50
51
def clear(ports, settings, shared):
52
shared.cache.erase_lib('libbullet.a')
53
54
55
def process_args(ports):
56
return ['-isystem', ports.get_include_dir('bullet')]
57
58
59
def show():
60
return 'bullet (-sUSE_BULLET or --use-port=bullet; zlib license)'
61
62