I have a multi-unit project that involves 1) compiling multiple .c, .cpp and .cu (CUDA) source code units and 2) linking those into a single executable. To show the overall building tasks, the cmake file of the project can be found at
https://github.com/fangq/mcx/blob/master/src/CMakeLists.txt
which is also exemplified in the below snippet:
# Add dependency folderlink_directories(zmat)# Create mcx librarycuda_add_library(mcx STATIC mcx_core.cu mcx_core.h mcx_utils.c mcx_utils.h mcx_shapes.c mcx_shapes.h tictoc.c tictoc.h cjson/cJSON.c cjson/cJSON.h ubj/ubj.h ubj/ubjw.c )# add main unitcuda_add_executable( mcx-exe mcextreme.c )# Link executabletarget_link_libraries( mcx-exe mcx -fopenmp zmat ZLIB::ZLIB )
I would like to set up a similar project using VS Code. I found some sample tasks.json
files online, but nearly all of them are designed to compile a single code to generate an executable.
I am wondering if anyone can share, or provide me a link to, examples of tasks.json
files that can
- compile multiple units of different suffixes using corresponding compilers (gcc for .c, g++ for .cpp, nvcc for .cu, for example), and
- link the object files of multiple units into a final executable?
is this possible with vs code?