none
How to split VCXPROJ into two projects using notepad or whatever to avoid a build mis-behavior. RRS feed

  • Question

  • Due to a problem described here I suspect I need to edit my project file and make one for CUDA compiles and another for regular C++ "CL" compiles.  I do not see a way to use the IDE so looks like notepad is the tool.

    The existing solution has two projects:  "app_cu.vcxproj" for a static library and "app_cpp.vcproj" for the executable  The problem project is the cpp one.  The files all end in .cpp (unlike the app_cu) but some of the files needs to be compiled with NVCC, not just CL.

    This is not my project, I am just porting.  All the code compiles just fine in Linux with NVCC for the CU and g++ for the cpp files.  Unaccountably, the VS2013 compiler CL cannot handle some of the cpp files as they include headers used in the .cu files.  I can compile them using NVCC and it seems I must split off those using CLcompile from the CUDAcompile and want to know how to do this.

    I can copy and past the app_cpp.vcproj and then edit so there is no mix of CUDA and CL.  In the XML, I  can change the name of the project but what do I do with the GUIDs and other identifiers?  Can I leave them the same or change a couple of characters so they are different.  

    I assume this will work.  Maybe there is an IDE switch to force the compilations.  They all compile OK, I just have to manually click on each on to compile.  Have not gotten to the part where the link occurs so maybe a problem there.



    Sunday, January 5, 2020 3:37 PM

Answers

  • I left them in the same folder as I didn't want to change the location of the headers.  I did not change any of the GUID variables when I split of vcxproj into 2 projects. 

    I renamed the file and changed the <RootNameSpace>  to match the filename app_cuda_2013 and used "app_cuda" for the <ProjectName>.   I did not edit any of the GUJDs.

    The "only" problem I had was VS did not like sharing intermediate and target folders so I had to specify new locations. I tried adding a prefix to the object code such as "cu_ and "app_" but the complaint was the folders were being used for multiple projects.  I am guessing that a "clean" does a an expedient "del *.*" in the object folder.   If I had moved the sources to a different folder like you suggested then mixing would not have occurred but I would then have to change the Linux makefile and I had no interest in that.

    I discovered something when compiling a .cpp that did not have any cuda includes.  VS2013's CL did not recognize "register" as it was depreciated but NVCC had no problem with it.  I may have to use NVCC for all compiles.

    Monday, January 6, 2020 3:45 PM

All replies

  • Hi JosephStateson,

    Welcome to MSDN forum.

    The faster method I think, you could copy all the file of app_cpp project to new path, then remove all cuda components in it. After that, you could include it in the same solution in solution explorer.

    Hope it could help you.c

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Monday, January 6, 2020 6:57 AM
  • I left them in the same folder as I didn't want to change the location of the headers.  I did not change any of the GUID variables when I split of vcxproj into 2 projects. 

    I renamed the file and changed the <RootNameSpace>  to match the filename app_cuda_2013 and used "app_cuda" for the <ProjectName>.   I did not edit any of the GUJDs.

    The "only" problem I had was VS did not like sharing intermediate and target folders so I had to specify new locations. I tried adding a prefix to the object code such as "cu_ and "app_" but the complaint was the folders were being used for multiple projects.  I am guessing that a "clean" does a an expedient "del *.*" in the object folder.   If I had moved the sources to a different folder like you suggested then mixing would not have occurred but I would then have to change the Linux makefile and I had no interest in that.

    I discovered something when compiling a .cpp that did not have any cuda includes.  VS2013's CL did not recognize "register" as it was depreciated but NVCC had no problem with it.  I may have to use NVCC for all compiles.

    Monday, January 6, 2020 3:45 PM