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