ataranto / CefSharp

.Net binding for the Chromium Embedded Framework
Other
62 stars 34 forks source link

vs2012 #53

Closed perlun closed 11 years ago

perlun commented 11 years ago

Changed to build with Visual Studio 2012 (VS2008 and inherently .NET 3.5 support is entirely dropped in this).

perlun commented 11 years ago

@ataranto: Continuing the discussion from https://github.com/ataranto/CefSharp/pull/55 here instead...

On popular demand, I've started making some preparations so we can have this buildable on both VS2010 and VS2012. This should be optimal in some aspects (but a bit negative in others, since stuff like adding/renaming files gets more complex when you have two sets of .vcxproj files that need to be maintained etc etc).

Nonetheless. The VS2012 .sln still builds; the vs2010 does not even though I've copied in a libcef_dll_wrapper.lib file compiled by mysel tonight using VS2010. I get a bunch of errors like this:

Error   11  error LNK2005: "public: class std::locale::facet * __thiscall std::locale::facet::_Decref(void)" (?_Decref@facet@locale@std@@QAEPAV123@XZ) already defined in libcef_dll_wrapper.lib(cef_xml_object.obj)    Y:\git\perlun.CefSharp\CefSharp\msvcprtd.lib(MSVCP100D.dll) CefSharp.2010
Error   12  error LNK2005: "private: static void __cdecl std::ios_base::_Ios_base_dtor(class std::ios_base *)" (?_Ios_base_dtor@ios_base@std@@CAXPAV12@@Z) already defined in msvcprtd.lib(MSVCP100D.dll)   Y:\git\perlun.CefSharp\CefSharp\libcpmtd.lib(ios.obj)   CefSharp.2010
Error   13  error LNK2005: "public: static void __cdecl std::ios_base::_Addstd(class std::ios_base *)" (?_Addstd@ios_base@std@@SAXPAV12@@Z) already defined in msvcprtd.lib(MSVCP100D.dll)  Y:\git\perlun.CefSharp\CefSharp\libcpmtd.lib(ios.obj)   CefSharp.2010

I presumed that it would be a matter of changing which version of the C++ runtime we link towards, but unfortunately things seem a bit more complex than that... The libcef_dll_wrapper is set to link statically towards the C++RT, and if I change it to dynamic it won't compile (with my VS2010).

Funny thing is that the libcef_dll_wrapper I've compiled up with VS2012 works. So there must be something with the C++ runtime that is fundamentally different between these versions...

Any ideas? Feel free to poke around and see if you can get it working yourself. All I've done thus far is included in this pull request.

perlun commented 11 years ago

Hi,

Managed to find and fix! I had to split out so we use separate .csproj files also (for 2010 and 2012 respectively). Please review and if possible, merge as soon as possible so we have a common ground to build on.

Since both the VS2010 and 2012 solutions build towards the Debug/ and Release/ folders, it may be a good idea to run the clean.sh script when switching between them to get rid of intermediate files that may otherwise interfere with the building.

mwisnicki commented 11 years ago

This split is not necessary - see perlun/CefSharp#2.

perlun commented 11 years ago

Hi @ataranto,

I've now merged in ome great work from @mwisnicki; he was more skilled than me and did it in a much more elegant way (one single solution which uses conditional elements to act differently between VS2010 and VS2012). Thanks! :)

The pull request should now be in an adequate shape for merging in to ataranto/CefSharp/master, if you ask me.

avlee commented 11 years ago

The link error still here when build with VS2010 release:

Error 2 error LNK2001: unresolved external symbol "declspec(dllimport) void cdecl std::_Throw(class stdext::exception const &)" (_imp?_Throw@std@@YAXABVexception@stdext@@@Z) D:\CefSharp\CefSharp\libcef_dll_wrapper.lib(render_handler_cpptoc.obj) CefSharp

.......

perlun commented 11 years ago

Hi @avlee, I can reproduce this error also. Strange, since I think I tested before I pushed that commit, but obviously I must not have been testing carefully enough...

I tried to recompile libcef_dll_wrapper with the right setting (/MD, e.g. use multi-threaded DLL version of C/C++ runtime). All seems to be OK, but I just cannot get that .lib file to work with CefSharp no matter what... cefclient (the C++ client from CEF) works fine. If you want to give it a try yourself, check out https://github.com/perlun/libcef-dll-wrapper - it's basically just the file from http://www.magpcss.net/cef_downloads/ updated with /MD.

I'm more than open for suggestions in this regard...

avlee commented 11 years ago

@perlun thanks for your hard works.

perlun commented 11 years ago

I managed to find the problem! Stupidly enough, I was still compiling the libcef_dll_wrapper using the vs90 toolset (i.e. Visual Studio 2008). .lib files compiled using this version of VS cannot be use with VS2010 from my experience.

Changing the toolset to vs100 worked. I updated this branch, and made a new release of my own CefSharp fork (https://github.com/perlun/cefsharp); use whichever one you prefer. (My own fork contains some other additional stuff which I've found useful.)

avlee commented 11 years ago

@perlun Thanks again for your great work, but may be somebody really do not want to drop the support of .net framework 2.0 and 3.5 @ataranto Maybe we can create an organization account to continue to move forward CefSharp

perlun commented 11 years ago

@avlee: I think we can drop .NET 2.0 for now. It's too hard to support with recent tools (Visual Studio 2010/2012, they cannot compile C++/CLR projects for .NET 2.0). C# is a different matter; it wouldn't be hard to support .NET 2.0 for a C# only project, but C++/CLR is a different beast.

People who must (for whatever reason) use .NET 2.0 can still use older releases of CefSharp. They could even make a fork of their own if they feel so inclined, to support .NET 2.0/VS2008. For me, this is not interesting at all; it's not a use case for me, neither at work nor privately.

The organization account is a good idea, though. I believe it should be done. What do you feel @ataranto?

oconnor663 commented 11 years ago

What's the state of .NET 3.5 on windows xp? Is that all SP3 systems have it, but not necessarily all unpatched systems? On Jul 2, 2013 9:44 PM, "Per Lundberg" notifications@github.com wrote:

@avlee https://github.com/avlee: I think we can drop .NET 2.0 for now. It's too hard to support with recent tools (Visual Studio 2010/2012, they cannot compile C++/CLR projects for .NET 2.0). C# is a different matter; it wouldn't be hard to support .NET 2.0 for a C# only project, but C++/CLR is a different beast.

People who must (for whatever reason) use .NET 2.0 can still use older releases of CefSharp. They could even make a fork of their own if they feel so inclined, to support .NET 2.0/VS2008. For me, this is not interesting at all; it's not a use case for me, neither at work nor privately.

The organization account is a good idea, though. I believe it should be done. What do you feel @ataranto https://github.com/ataranto?

— Reply to this email directly or view it on GitHubhttps://github.com/ataranto/CefSharp/pull/53#issuecomment-20395436 .

perlun commented 11 years ago

@oconnor663: Don't know.

perlun commented 11 years ago

Closing now, since this is merged into the master branch at https://github.com/cefsharp/CefSharp.