torch / cutorch

A CUDA backend for Torch7
Other
336 stars 208 forks source link

Why do we need ADD_TORCH_PACKAGE and ADD_TORCH_WRAP? #667

Open archenroot opened 7 years ago

archenroot commented 7 years ago

What is this for, could someone explain what is it doing in CMakeLists.txt and what is it good for?

ADD_TORCH_WRAP(cudatensormathwrap TensorMath.lua) ADD_TORCH_PACKAGE(cutorch "${src}" "${luasrc}")

Thanks for any hints.

Ladislav

archenroot commented 7 years ago

In general, why I cannot replace whole bottom of cmake file with:

# Install LUA source files
INSTALL(FILES ${luasrc} DESTINATION ${LUADIR}/cutorch)

# Install compiled C libraries
INSTALL(TARGETS cutorch LIBRARY DESTINATION ${LUA_LIBDIR} )
TARGET_LINK_LIBRARIES(cutorch luaT THC)

IF(LUALIB)
  TARGET_LINK_LIBRARIES(cutorch ${LUALIB})
ENDIF()
soumith commented 7 years ago

@archenroot this is because TensorMath.lua has to be autogenerated (these are autogenerated bindings), and that's done with ADD_TORCH_WRAP. ADD_TORCH_PACKAGE can indeed be replaced with what you suggested i think.