Skip to content

Commit

Permalink
Add support for user-provided flags
Browse files Browse the repository at this point in the history
  • Loading branch information
romainthomas committed Dec 8, 2024
1 parent 28552b5 commit 68fa889
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions api/python/backend/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class BuildConfig(BaseModel):
ninja: bool = False
default_target: str = Field("pyLIEF", alias="default-target")
parallel_jobs: int = Field(0, alias="parallel-jobs")
compilation_flags: List[str] = Field([], alias="compilation-flags")
build_dir: Optional[EnvString] = Field(None, alias="build-dir")
extra_targets: Union[List[EnvString], EnvString] = Field(None, alias="extra-targets")
extra_cmake: Union[List[EnvString], EnvString] = Field(None, alias="extra-cmake-opt")
Expand Down Expand Up @@ -90,6 +91,13 @@ def cmake_dump(self) -> List[str]:
f"-DCMAKE_CXX_COMPILER={self.cxx_compiler}"
)

if len(self.compilation_flags) > 0:
flags = " ".join(self.compilation_flags)
out.extend((
f'-DCMAKE_CXX_FLAGS={flags}',
f'-DCMAKE_C_FLAGS={flags}',
))

return out

class ThridParty(BaseModel):
Expand Down

0 comments on commit 68fa889

Please sign in to comment.