diff --git a/cmake/modules/Utilities.cmake b/cmake/modules/Utilities.cmake index 47d00be25..5e80a67ff 100644 --- a/cmake/modules/Utilities.cmake +++ b/cmake/modules/Utilities.cmake @@ -39,3 +39,27 @@ function(LIST_FILTER) set(${args_OUTPUT} ${${args_OUTPUT}} PARENT_SCOPE) endfunction() + +function(add_to_package) + set(flags) + set(singleValueArgs DESTINATION) + set(multiValueArgs FILES TARGETS) + + cmake_parse_arguments( + args + "${flags}" "${singleValueArgs}" "${multiValueArgs}" + ${ARGN}) + + install(TARGETS ${args_TARGETS} DESTINATION ${args_DESTINATION}) + install(FILES ${args_FILES} DESTINATION ${args_DESTINATION}) + + BLOCK_PRINT( + "Adding to Package: ${args_DESTINATION}" + " " + "TARGETS:" + "${args_TARGETS}" + " " + "FILES:" + "${args_FILES}" + ) +endfunction() diff --git a/fbgemm_gpu/FbgemmGpu.cmake b/fbgemm_gpu/FbgemmGpu.cmake index 174bc0f69..8bc6f6144 100644 --- a/fbgemm_gpu/FbgemmGpu.cmake +++ b/fbgemm_gpu/FbgemmGpu.cmake @@ -712,14 +712,14 @@ target_compile_options(fbgemm_gpu_py PRIVATE # FBGEMM_GPU Install ################################################################################ -install(DESTINATION fbgemm_gpu - TARGETS fbgemm_gpu_py) +install(TARGETS fbgemm_gpu_py + DESTINATION fbgemm_gpu) -install(DESTINATION fbgemm_gpu/split_embedding_codegen_lookup_invokers - FILES ${gen_python_source_files}) +install(FILES ${gen_python_source_files} + DESTINATION fbgemm_gpu/split_embedding_codegen_lookup_invokers) -install(DESTINATION fbgemm_gpu/split_embedding_optimizer_codegen - FILES ${gen_defused_optim_py_files}) +install(FILES ${gen_defused_optim_py_files} + DESTINATION fbgemm_gpu/split_embedding_optimizer_codegen) add_custom_target(fbgemm_gpu_py_clean_rpath ALL WORKING_DIRECTORY ${OUTPUT_DIR} diff --git a/fbgemm_gpu/experimental/example/CMakeLists.txt b/fbgemm_gpu/experimental/example/CMakeLists.txt index 0a56509ef..57866e291 100644 --- a/fbgemm_gpu/experimental/example/CMakeLists.txt +++ b/fbgemm_gpu/experimental/example/CMakeLists.txt @@ -42,9 +42,6 @@ gpu_cpp_library( # Install Shared Library and Python Files ################################################################################ -install(DESTINATION fbgemm_gpu/experimental/example +add_to_package(DESTINATION fbgemm_gpu/experimental/example TARGETS fbgemm_gpu_experimental_example_py FILES ${experimental_example_python_source_files}) - -# install(FILES ${experimental_example_python_source_files} -# DESTINATION fbgemm_gpu/experimental/example) diff --git a/fbgemm_gpu/experimental/gemm/CMakeLists.txt b/fbgemm_gpu/experimental/gemm/CMakeLists.txt index de5f81b01..37f3dc73b 100644 --- a/fbgemm_gpu/experimental/gemm/CMakeLists.txt +++ b/fbgemm_gpu/experimental/gemm/CMakeLists.txt @@ -18,5 +18,5 @@ set(experimental_triton_python_source_files # Install Python Files ################################################################################ -install(DESTINATION fbgemm_gpu/experimental/gemm/triton_gemm - FILES ${experimental_triton_python_source_files}) +install(FILES ${experimental_triton_python_source_files} + DESTINATION fbgemm_gpu/experimental/gemm/triton_gemm) diff --git a/fbgemm_gpu/experimental/gen_ai/CMakeLists.txt b/fbgemm_gpu/experimental/gen_ai/CMakeLists.txt index e2b390ce1..73644b7b2 100644 --- a/fbgemm_gpu/experimental/gen_ai/CMakeLists.txt +++ b/fbgemm_gpu/experimental/gen_ai/CMakeLists.txt @@ -162,7 +162,7 @@ gpu_cpp_library( # Install Shared Library and Python Files ################################################################################ -install(DESTINATION fbgemm_gpu/experimental/gen_ai +add_to_package(DESTINATION fbgemm_gpu/experimental/gen_ai TARGETS fbgemm_gpu_experimental_gen_ai_py FILES ${experimental_gen_ai_python_source_files})