Wasm support! And optional definitive names
This commit is contained in:
@@ -39,14 +39,22 @@ class CppBuilder:
|
||||
os.makedirs(self._build_dir, exist_ok=True)
|
||||
|
||||
for build in self._builds:
|
||||
output_filename = (
|
||||
build.definitive_name
|
||||
if build.definitive_name
|
||||
else f"{build.name}_{build.platform.value}"
|
||||
)
|
||||
|
||||
instruction = [
|
||||
build.platform.value.compiler,
|
||||
"-o", os.path.join(self._build_dir, f"{build.name}_{build.platform.value}"),
|
||||
f"-march={build.platform.value.architecture}",
|
||||
"-o", self._build_dir + output_filename,
|
||||
"-I", self._include_dir,
|
||||
*self.find_source_files(self._source_dir)
|
||||
]
|
||||
|
||||
if build.platform.value.architecture:
|
||||
instruction.append(f"-march={build.platform.value.architecture}")
|
||||
|
||||
instruction.append(build.platform.value.code_specification)
|
||||
|
||||
instruction.extend(build.type.value)
|
||||
@@ -91,6 +99,12 @@ class CppBuilder:
|
||||
|
||||
for i in configurations:
|
||||
build_name = i["name"]
|
||||
|
||||
try:
|
||||
build_definitive_name = i["definitive_name"]
|
||||
except KeyError:
|
||||
build_definitive_name = None
|
||||
|
||||
build_type_str = i["build_type"]
|
||||
platform_str = i["platform"]
|
||||
|
||||
@@ -115,6 +129,7 @@ class CppBuilder:
|
||||
build_name,
|
||||
build_type,
|
||||
platform,
|
||||
build_definitive_name,
|
||||
i["args"] + global_build_args
|
||||
))
|
||||
self.logger.log(Log.Level.DEBUG, f"'{build_name}' config loaded from file.")
|
||||
|
||||
@@ -26,11 +26,13 @@ class Platform(Enum):
|
||||
LINUX_x86 = PlatformInfo("linux", "clang", "x86", "", "-DSPEC_LINUX")
|
||||
LINUX_x86_64_V4 = PlatformInfo("linux", "clang", "x86-64-v4", "", "-DSPEC_LINUX")
|
||||
MACOS = PlatformInfo("macos", "gcc", "arm", "", "-DSPEC_DARWIN")
|
||||
WASM = PlatformInfo("wasm", "emcc", "", "", "-DSPEC_WASM")
|
||||
|
||||
@dataclass
|
||||
class Build:
|
||||
name: str
|
||||
type: BuildType
|
||||
platform: PlatformInfo
|
||||
definitive_name: str = field(default_factory=str)
|
||||
additional_instructions: List[str] = field(default_factory=list)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user