forked from eclipsesource/J2V8
-
Notifications
You must be signed in to change notification settings - Fork 5
/
config_macos.py
74 lines (65 loc) · 2.37 KB
/
config_macos.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import os
import constants as c
from build_structures import PlatformConfig
from vagrant_build import VagrantBuildSystem, VagrantBuildStep
import java_build_steps as j
import shared_build_steps as u
import cmake_utils as cmu
macos_config = PlatformConfig(c.target_macos, [c.arch_x86, c.arch_x64])
macos_config.set_cross_configs({
"vagrant": VagrantBuildStep(
platform=c.target_macos,
host_cwd="$CWD/vagrant/$PLATFORM",
build_cwd="/Users/vagrant/j2v8",
pre_build_cmd = u.setEnvVar("VAGRANT_FILE_SHARE_TYPE", "smb" if os.name == "nt" else "virtualbox")[0],
)
})
macos_config.set_cross_compilers({
"vagrant": VagrantBuildSystem
})
macos_config.set_file_abis({
c.arch_x64: "x86_64",
c.arch_x86: "x86_32",
})
#-----------------------------------------------------------------------
def build_node_js(config):
return [
"cd ./node",
"""./configure \
--without-intl \
--without-inspector \
--dest-cpu=$ARCH \
--without-snapshot \
--enable-static""",
"make -j4",
]
macos_config.build_step(c.build_node_js, build_node_js)
#-----------------------------------------------------------------------
def build_j2v8_cmake(config):
cmake_vars = cmu.setAllVars(config)
# NOTE: uses Python string interpolation (see: https://stackoverflow.com/a/4450610)
return \
u.mkdir(u.cmake_out_dir) + \
["cd " + u.cmake_out_dir] + \
u.rm("CMakeCache.txt CMakeFiles/") + \
["""cmake \
-DCMAKE_BUILD_TYPE=Release \
%(cmake_vars)s \
../../ \
"""
% locals()]
macos_config.build_step(c.build_j2v8_cmake, build_j2v8_cmake)
#-----------------------------------------------------------------------
macos_config.build_step(c.build_j2v8_jni, u.build_j2v8_jni)
#-----------------------------------------------------------------------
def build_j2v8_cpp(config):
return [
"cd " + u.cmake_out_dir,
"make -j4",
]
macos_config.build_step(c.build_j2v8_cpp, build_j2v8_cpp)
#-----------------------------------------------------------------------
j.add_java_build_step(macos_config)
#-----------------------------------------------------------------------
j.add_java_test_step(macos_config)
#-----------------------------------------------------------------------