Skip to content

Commit c101986

Browse files
authored
chore: add option to install py module into scalellm folder (#438)
1 parent 4357525 commit c101986

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ option(USE_CCACHE "Attempt using CCache to wrap the compilation" ON)
55
option(USE_MANYLINUX "Build for manylinux" OFF)
66

77
option(BUILD_NVBENCH "Build the nvbench binary" OFF)
8+
option(INSTALL_PY_MODULE "Install python module to scalellm directory" OFF)
89

910
set(CMAKE_CXX_STANDARD 17)
1011
set(CMAKE_CXX_STANDARD_REQUIRED ON)

scalellm/CMakeLists.txt

+10-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pybind_extension(
1111
csrc/llm_handler.cpp
1212
csrc/module.cpp
1313
csrc/kernels.cu
14-
DEFINES
14+
DEFINES
1515
PYBIND11_DETAILED_ERROR_MESSAGES=1
1616
LINKDIRS
1717
${TORCH_INSTALL_PREFIX}/lib
@@ -25,3 +25,12 @@ pybind_extension(
2525
glog::glog
2626
Python::Module
2727
)
28+
29+
if (INSTALL_PY_MODULE)
30+
add_custom_command(TARGET _C POST_BUILD
31+
COMMENT "Copying $<TARGET_FILE_NAME:_C> to scalellm directory"
32+
COMMAND ${CMAKE_COMMAND} -E create_symlink
33+
$<TARGET_FILE:_C>
34+
${CMAKE_SOURCE_DIR}/scalellm/$<TARGET_FILE_NAME:_C>
35+
)
36+
endif()

0 commit comments

Comments
 (0)