Skip to content

Commit

Permalink
Resolve #996
Browse files Browse the repository at this point in the history
Usage:

```toml
[lief.build]
cxx-compiler = "/path/to/cxx"
c-compiler = "/path/to/c"
```
  • Loading branch information
romainthomas committed Nov 7, 2023
1 parent d0ed158 commit 23546d4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions api/python/backend/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class BuildConfig(BaseModel):
extra_cmake: Union[List[str], str] = Field(None, alias="extra-cmake-opt")
lief_install_dir: Optional[str] = Field(None, alias="lief-install-dir")
py_api: str = Field("", alias="py-api")
c_compiler: str | None = Field(None, alias="c-compiler")
cxx_compiler: str | None = Field(None, alias="cxx-compiler")

@property
def targets(self) -> List[str]:
Expand Down Expand Up @@ -57,6 +59,16 @@ def cmake_dump(self) -> List[str]:
f"-DLIEF_DIR={lief_dir.as_posix()}"
))

if self.c_compiler is not None:
out.append(
f"-DCMAKE_C_COMPILER={self.c_compiler}"
)

if self.cxx_compiler is not None:
out.append(
f"-DCMAKE_CXX_COMPILER={self.cxx_compiler}"
)

return out

class ThridParty(BaseModel):
Expand Down

0 comments on commit 23546d4

Please sign in to comment.