Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable incremental CMake build #684

Merged
merged 7 commits into from
Mar 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,14 +360,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:
jinzex marked this conversation as resolved.
Show resolved Hide resolved
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(os.path.dirname(os.path.abspath(__file__)))
jinzex marked this conversation as resolved.
Show resolved Hide resolved
build_dir = setup_dir / 'build' / 'cmake'
jinzex marked this conversation as resolved.
Show resolved Hide resolved
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
Loading