junrushao opened a new pull request, #351:
URL: https://github.com/apache/tvm-ffi/pull/351

   Similar to 
[`pybind11-add-module`](https://pybind11.readthedocs.io/en/stable/compiling.html#pybind11-add-module)
 and 
[`nanobind_add_module`](https://nanobind.readthedocs.io/en/latest/api_cmake.html#command:nanobind_add_module),
 this PR introduces two convenient CMake methods to help integrate CMake 
targets with TVM-FFI:
   
   - `tvm_ffi_add`
   
   ```
   # tvm_ffi_add(
   #   target_name
   #   [LINK_SHARED ON|OFF]
   #   [LINK_HEADER ON|OFF]
   #   [DEBUG_SYMBOL ON|OFF] 
   #   [MSVC_FLAGS ON|OFF]
   # )
   #
   # Configure a target to integrate with TVM-FFI CMake utilities:
   #   - Optionally link against tvm_ffi_header and/or tvm_ffi_shared
   #   - Always apply tvm_ffi_add_prefix_map(target_name <current source dir>)
   #   - Optionally enable Apple dSYM generation via 
tvm_ffi_add_apple_dsymutil(target_name)
   #   - Optionally apply MSVC-specific flags via 
tvm_ffi_add_msvc_flags(target_name)
   #
   # Parameters:
   #   target_name: Existing CMake target to modify (positional, required)
   #
   # Keyword parameters (all accept ON/OFF-like values; defaults shown):
   #   LINK_SHARED:  Whether to link tvm_ffi_shared into the target (default: 
ON)
   #   LINK_HEADER:  Whether to link tvm_ffi_header into the target (default: 
ON)
   #   DEBUG_SYMBOL: Whether to enable debug symbol post-processing hooks.
   #                 On Apple this calls 
tvm_ffi_add_apple_dsymutil(target_name) (default: ON)
   #                 On non-Apple platforms this is currently a no-op unless 
you extend it. (default: ON)
   #   MSVC_FLAGS:   Whether to call tvm_ffi_add_msvc_flags(target_name) to 
apply MSVC-specific flags (default: ON)
   #
   # Notes:
   #   - Installation is intentionally split out. Use 
tvm_ffi_install(target_name DESTINATION <dir>) to install artifacts.
   #   - This function requires tvm_ffi_add_prefix_map() to be defined/included.
   #   - If LINK_SHARED/LINK_HEADER are ON, the corresponding targets 
(tvm_ffi_shared/tvm_ffi_header) must exist.
   ```
   
   - `tvm_ffi_install`
   
   ```
   # tvm_ffi_install(target_name [DESTINATION <dir>])
   # Install TVM-FFI related artifacts for a configured target.
   #
   # Parameters:
   #   target_name: Existing CMake target whose artifacts should be installed
   #
   # Keyword parameters:
   #   DESTINATION: Install destination directory relative to 
CMAKE_INSTALL_PREFIX (default: ".")
   #
   # Behavior:
   #   - On Apple, installs the target's dSYM bundle if it exists.
   #     This uses generator expressions and OPTIONAL so it does not fail if 
the dSYM is absent.
   #   - On non-Apple platforms, currently no-op (extend as needed for 
PDB/DWARF packaging).
   #
   # Notes:
   #   - This function does not create dSYMs; it only installs them if present.
   #     Pair it with tvm_ffi_add(... DEBUG_SYMBOL ON) to enable dSYM 
generation hooks.
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to