Thread: [Maya2osg-users] Problem with source groups in CMakeLists.txt for VC9
Status: Alpha
Brought to you by:
jtaibo
From: Jean-Sébastien G. <jea...@cm...> - 2011-05-13 13:31:50
Attachments:
CMakeLists.txt
|
Hello Javier, Your recent change to put the GLSL/* files inside Source Files and Header Files makes the generated .vcproj file unreadable in VC9 (2008). I think it's actually a bug in CMake, but perhaps we could make a temp fix to work around the problem? In case you're interested, the problem seems to be that CMake generates a vcproj with two "Source Files" and two "Header Files" filters: <Filter Name="Source Files"> <!-- ... the .cpp files directly in src/ --> </Filter> <Filter Name="Header Files"> <!-- ... the .h files directly in src/ --> </Filter> <Filter Name="Source files"> <Filter Name="GLSL"> <!-- ... the .cpp files in src/GLSL --> </Filter> </Filter> <Filter Name="Header files"> <Filter Name="GLSL"> <!-- ... the .h files in src/GLSL --> </Filter> </Filter> First I thought the problem was the case of the second "files" in both cases (it's lowercase in the second filter), but changing it to uppercase in CMakeLists.txt simply makes all files fall in Source Files or Header Files (no GLSL sub-filters). So I think the problem is the two similarly-named filters, and that VC9 doesn't like that. If I move the GLSL sub-filter inside the first "Source Files" / "Header Files" filters in the vcproj file, it loads. So I think that's what CMake should generate... I even tried with the latest CMake (2.8.4, I was on 2.8.3 before) and the same problem still occurs. So I think I'll raise the issue with CMake, as it seems to be a bug in the VC9 (and under) generators. In the mean time, if I make a filter for GLSL (both headers and source) when the generator is for VC9 or under that would work. I assume you're using VC10 and it's working for you obviously? Try the attached file, if for you on VC10 it gives the same result, it works for me on VC9 so I think it would be a good workaround for now. What do you think? Thanks in advance, J-S -- ______________________________________________________ Jean-Sebastien Guay jea...@cm... http://www.cm-labs.com/ http://whitestar02.dyndns-web.com/ |
From: Javier T. <jav...@gm...> - 2011-05-13 15:33:30
|
Hi J-S, Yes, I tested it in Visual Studio 2010 Express, and it worked there. But I have to tweak a bit the filter option to make it work. It's a bit tricky. Right now I am in Ubuntu, so I cannot test it. But as soon as I get to a Windows machine, I'll test the file you sent and let you know how it behaves in VS 2010. And abusing of your generous CMake wisdom, there is one question I would like to ask you (I expect the list administrator don't get angry with me because of the off-topic, nor do the list members): I know how to make the debug targets link with debug libraries and release targets with release libraries. But, when I am using RelWithDebInfo, it considers it "optimized" and links it with the Release version (not the RelWithDebInfo). Is there any easy way (not populating the script with lots of conditionals and manually adding suffixes that are already defined) to make each target link with the corresponding ones? Thanks in advance. On Fri, May 13, 2011 at 3:31 PM, Jean-Sébastien Guay <jea...@cm...> wrote: > Hello Javier, > > Your recent change to put the GLSL/* files inside Source Files and Header > Files makes the generated .vcproj file unreadable in VC9 (2008). I think > it's actually a bug in CMake, but perhaps we could make a temp fix to work > around the problem? > > In case you're interested, the problem seems to be that CMake generates a > vcproj with two "Source Files" and two "Header Files" filters: > > <Filter Name="Source Files"> > <!-- ... the .cpp files directly in src/ --> > </Filter> > <Filter Name="Header Files"> > <!-- ... the .h files directly in src/ --> > </Filter> > <Filter Name="Source files"> > <Filter Name="GLSL"> > <!-- ... the .cpp files in src/GLSL --> > </Filter> > </Filter> > <Filter Name="Header files"> > <Filter Name="GLSL"> > <!-- ... the .h files in src/GLSL --> > </Filter> > </Filter> > > First I thought the problem was the case of the second "files" in both cases > (it's lowercase in the second filter), but changing it to uppercase in > CMakeLists.txt simply makes all files fall in Source Files or Header Files > (no GLSL sub-filters). > > So I think the problem is the two similarly-named filters, and that VC9 > doesn't like that. If I move the GLSL sub-filter inside the first "Source > Files" / "Header Files" filters in the vcproj file, it loads. So I think > that's what CMake should generate... > > I even tried with the latest CMake (2.8.4, I was on 2.8.3 before) and the > same problem still occurs. So I think I'll raise the issue with CMake, as it > seems to be a bug in the VC9 (and under) generators. > > In the mean time, if I make a filter for GLSL (both headers and source) when > the generator is for VC9 or under that would work. I assume you're using > VC10 and it's working for you obviously? > > Try the attached file, if for you on VC10 it gives the same result, it works > for me on VC9 so I think it would be a good workaround for now. > > What do you think? Thanks in advance, > > J-S > -- > ______________________________________________________ > Jean-Sebastien Guay jea...@cm... > http://www.cm-labs.com/ > http://whitestar02.dyndns-web.com/ > > ------------------------------------------------------------------------------ > Achieve unprecedented app performance and reliability > What every C/C++ and Fortran developer should know. > Learn how Intel has extended the reach of its next-generation tools > to help boost performance applications - inlcuding clusters. > http://p.sf.net/sfu/intel-dev2devmay > _______________________________________________ > Maya2osg-users mailing list > May...@li... > https://lists.sourceforge.net/lists/listinfo/maya2osg-users > > -- Javier Taibo |
From: Jean-Sébastien G. <jea...@cm...> - 2011-05-13 16:04:56
|
Hi Javier, > Yes, I tested it in Visual Studio 2010 Express, and it worked there. > But I have to tweak a bit the filter option to make it work. It's a > bit tricky. What do you mean when you say "tweak the filter option"? > Right now I am in Ubuntu, so I cannot test it. But as soon as I get > to a Windows machine, I'll test the file you sent and let you know how > it behaves in VS 2010. No problem. > I know how to make the debug targets link with debug libraries and > release targets with release libraries. But, when I am using > RelWithDebInfo, it considers it "optimized" and links it with the > Release version (not the RelWithDebInfo). Is there any easy way (not > populating the script with lots of conditionals and manually adding > suffixes that are already defined) to make each target link with the > corresponding ones? I have no idea, honestly... I admit it's weird that the LINK_LIBRARIES command has 2 hard-coded modes, debug and optimized, when there are 4 configurations possible, debug, release, release with debug info and min size release. Theoretically, if what you want is to be able to debug into OSG with your RelWithDebInfo build of the plugin, you could build OSG in RelWithDebInfo, setting the suffix to empty for that configuration (in advanced settings in OSG's CMake), then your RelWithDebInfo DLLs will have the same filenames as the Release ones. Then you just have to replace the Release DLL files with the RelWithDebInfo ones, and they'll be picked up when the plugin is loaded. Since RelWithDebInfo is binary-compatible with Release, you can use either interchangeably. Sure, it's a workaround and not a fix, but it might get you where you want to go. Hope this helps, J-S -- ______________________________________________________ Jean-Sebastien Guay jea...@cm... http://www.cm-labs.com/ http://whitestar02.dyndns-web.com/ |
From: Javier T. <jav...@gm...> - 2011-05-13 16:28:45
|
Hi, On Fri, May 13, 2011 at 6:05 PM, Jean-Sébastien Guay <jea...@cm...> wrote: >> Yes, I tested it in Visual Studio 2010 Express, and it worked there. >> But I have to tweak a bit the filter option to make it work. It's a >> bit tricky. > > What do you mean when you say "tweak the filter option"? Well, that I have to try several times until I get it working. But the problem was probably between the keyboard and the chair :) However, I have the feeling that the regex matching order when defining several lines does not work as described in the documentation. Anyway, it is just a cosmetic issue, it is really not a big issue if we have to put them all in the same VS project folder. Just thought that separating them in sections would help to locate the source files in the project. >> I know how to make the debug targets link with debug libraries and >> release targets with release libraries. But, when I am using >> RelWithDebInfo, it considers it "optimized" and links it with the >> Release version (not the RelWithDebInfo). Is there any easy way (not >> populating the script with lots of conditionals and manually adding >> suffixes that are already defined) to make each target link with the >> corresponding ones? > > I have no idea, honestly... I admit it's weird that the LINK_LIBRARIES > command has 2 hard-coded modes, debug and optimized, when there are 4 > configurations possible, debug, release, release with debug info and min > size release. OK. That's what I thought. I had to ask just in case there was an evident way I were missing. > Theoretically, if what you want is to be able to debug into OSG with > your RelWithDebInfo build of the plugin, you could build OSG in Actually, it is not for the Maya2OSG plug-in, it is for other project I am working on, where I have several libraries in different CMake trees and most of them linking to OSG. I have to test it running in high performance (so Debug is not an option), and I need to remotely debug it when there is a problem, so RelWithDebInfo (and activating core dumping) is perfect for that. > RelWithDebInfo, setting the suffix to empty for that configuration (in > advanced settings in OSG's CMake), then your RelWithDebInfo DLLs will > have the same filenames as the Release ones. Then you just have to > replace the Release DLL files with the RelWithDebInfo ones, and they'll > be picked up when the plugin is loaded. Since RelWithDebInfo is > binary-compatible with Release, you can use either interchangeably. > > Sure, it's a workaround and not a fix, but it might get you where you > want to go. Thanks for the tip. I would prefer all of them to coexist, but this seems to be the best option then. Thank you again for your CMake support. -- Javier Taibo |
From: Javier T. <jav...@gm...> - 2011-05-13 17:57:49
|
Hi J-S, On Fri, May 13, 2011 at 3:31 PM, Jean-Sébastien Guay <jea...@cm...> wrote: > In the mean time, if I make a filter for GLSL (both headers and source) when > the generator is for VC9 or under that would work. I assume you're using > VC10 and it's working for you obviously? > > Try the attached file, if for you on VC10 it gives the same result, it works > for me on VC9 so I think it would be a good workaround for now. It is working OK in VC10. Thanks for the update. It is committed to svn trunk. Cheers! -- Javier Taibo |
From: Jean-Sébastien G. <jea...@cm...> - 2011-05-13 18:48:37
|
Hi Javier, > It is working OK in VC10. Thanks for the update. It is committed to svn trunk. Great, thanks a lot! J-S -- ______________________________________________________ Jean-Sebastien Guay jea...@cm... http://www.cm-labs.com/ http://whitestar02.dyndns-web.com/ |