I have two sets of implementations in C++CUDA. Both implementations require include files with clashing definitions.
In CMake, I can do the following (please ignore minor mistake – making a case):
# first object
add_library(FirstObject OBJECT src/file1.cpp src/file2.cu)
target_include_directories(FirstObject PRIVATE include_dir1)
target_set_properties(FirstObject PROPERTY POSITION_INDEPENDENT_CODE ON)
target_compile_options(FirstObject PRIVATE custom_options1)
# second object
add_library(SecondObject OBJECT src/file3.cpp src/file4.cu)
target_include_directories(SecondObject PRIVATE include_dir2)
target_set_properties(SecondObject PROPERTY POSITION_INDEPENDENT_CODE ON)
target_compile_options(SecondObject PRIVATE custom_options2)
# final shared lib
add_library(FinalSharedLib SHARED $<TARGET_OBJECTS:FirstObject> $<TARGET_OBJECTS:SecondObject> shared_library.cpp)
...
I want to do the same in Setup tools. The best solution I came across was writing custom build class, based on build_ext
, but could not extend it to use CudaExtension.
An existing example will be helpful.