Skip to content

Commit

Permalink
Enable incremental CMake build (#684)
Browse files Browse the repository at this point in the history
* Enable incremental CMake build

Signed-off-by: Jinze Xue <[email protected]>

* Update setup.py

Co-authored-by: Tim Moon <[email protected]>
Signed-off-by: Jinze Xue <[email protected]>

* Update setup.py

Co-authored-by: Tim Moon <[email protected]>
Signed-off-by: Jinze Xue <[email protected]>

* remove tempfile import

Signed-off-by: Jinze Xue <[email protected]>

---------

Signed-off-by: Jinze Xue <[email protected]>
Signed-off-by: Jinze Xue <[email protected]>
Co-authored-by: Jinze Xue <[email protected]>
Co-authored-by: Tim Moon <[email protected]>
Co-authored-by: Kirthi Shankar Sivamani <[email protected]>
  • Loading branch information
4 people authored Mar 4, 2024
1 parent 4e2ce51 commit 509ab0b
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from subprocess import CalledProcessError
import sys
import sysconfig
import tempfile
from typing import List, Optional, Tuple, Union

import setuptools
Expand Down Expand Up @@ -360,14 +359,16 @@ def run(self) -> None:
for ext in self.extensions:
if isinstance(ext, CMakeExtension):
print(f"Building CMake extension {ext.name}")
with tempfile.TemporaryDirectory() as build_dir:
build_dir = Path(build_dir)
package_path = Path(self.get_ext_fullpath(ext.name))
install_dir = package_path.resolve().parent
ext._build_cmake(
build_dir=build_dir,
install_dir=install_dir,
)
# Set up incremental builds for CMake extensions
setup_dir = Path(__file__).resolve().parent
build_dir = setup_dir / "build" / "cmake"
build_dir.mkdir(parents=True, exist_ok=True) # Ensure the directory exists
package_path = Path(self.get_ext_fullpath(ext.name))
install_dir = package_path.resolve().parent
ext._build_cmake(
build_dir=build_dir,
install_dir=install_dir,
)

# Paddle requires linker search path for libtransformer_engine.so
paddle_ext = None
Expand Down

0 comments on commit 509ab0b

Please sign in to comment.