Menu

#7 Add support for Visual Studio 2010

closed-fixed
None
5
2013-03-11
2011-07-06
arietto
No

New sln-files and project files are need. Besides, Visual Studio 2010 already contains u16string in xstring file (conflict).

Discussion

1 2 > >> (Page 1 of 2)
  • HiredIceSpecter

    HiredIceSpecter - 2012-05-08

    The u16string issue can be solved by changing every occurrence of u16string to std::u16string. Not pretty I know.
    Another issue: The include paths get broken after importing the MSVS2008 sln file in MSVS2010. Changing the paths in the files works, but is dirty.
    On top of that there appears to be a project missing: the createDLL
    The path to it in the 2008 sln refers to a project somewhere outside the xlslib folder: "..\..\..\OpenEXR\IlmBase\vc\vc9\IlmBase\createDLL\createDLL.vcproj".
    Create DLL sounds kinda important.^^
    Is the creator of the 2008 sln file still around and could add this project to the svn if it is necessary?

     
  • HiredIceSpecter

    HiredIceSpecter - 2012-05-08

    Further investigation revealed that the createDLL project is responsible for creating the actual DLL file, who'd guessed?
    At least that is what I gather from the "xlslib_dll.vcproj" file. It explains why MSVS2010 gives me this error when I try to build "xlslib_dll": LINK : fatal error LNK1181: cannot open input file %SOMEPATH%\xlslib\build\msvc2008\xlslib_dll_Win32_MSVC2008.Debug\xlslib_dll.lib'

    At least I managed to build "xlslib_lib". I'll check later whether I can use the lib in another solution or not.

    line from "xlslib_dll.vcproj":
    echo $(SolutionDir)bin\Win32_MSVC2008.$(ConfigurationName)\createDLL -M$(PlatformName) -n$(OutDir)\$(ProjectName).map -l$(IntDir) -i$(OutDir)\$(ProjectName).lib
$(SolutionDir)bin\Win32_MSVC2008.$(ConfigurationName)\createDLL -M$(PlatformName) -n$(OutDir)\$(ProjectName).map -l$(IntDir) -i$(OutDir)\$(ProjectName).lib

if not exist "$(SolutionDir)bin\$(PlatformName)_MSVC2008.$(ConfigurationName)" mkdir "$(SolutionDir)bin\$(PlatformName)_MSVC2008.$(ConfigurationName)"
copy "$(TargetPath)" "$(SolutionDir)bin\$(PlatformName)_MSVC2008.$(ConfigurationName)\$(TargetFileName)

     
  • David Hoerl

    David Hoerl - 2012-05-08

    I'm a bit unsure of what you want relative the the u16string. I'm willing to change those to xlslib::u16string - which is what I think you are asking for (as MS has added u16string to std ??). Pls clarify.

    Unfortunately the person who did the MS project work fell ill and no longer assists with this project (Ger). I'm an Apple guy with no experience in MS at all, so nothing I can do to help with the project file issue(s).

     
  • David Hoerl

    David Hoerl - 2012-05-08
    • assigned_to: nobody --> dhoerl
    • status: open --> open-accepted
     
  • HiredIceSpecter

    HiredIceSpecter - 2012-05-08

    @u16string: I changed every "u16string" to "std::u16string" in the files. It will compile then at least. I couldn't test wheter it works afterwards or not. I will report back here when I know wheter it works or not.

    @createDLL: I just checked out the SVN. CreateDLL is there, although not in the correct path for visual studio. I'll see if I can fix up the project file for 2010 later.

     
  • arietto

    arietto - 2012-05-08

    typedef basic_string<char16_t, char_traits<char16_t>,
    allocator<char16_t> > u16string;
    Please, visit this page:
    http://msdn.microsoft.com/ru-ru/library/ee404784.aspx

     
  • arietto

    arietto - 2012-05-08
    • status: open-accepted --> open
     
  • HiredIceSpecter

    HiredIceSpecter - 2012-05-08

    Good point, shouldn't use "std::u16string". But using "xlslib::u16string" doesn't work as it is not a namespace. If you could move u16string to that namespace or anyone at all, it would be great.

     
  • HiredIceSpecter

    HiredIceSpecter - 2012-05-08

    Another solution would be to rename u16string in "xlstypes.h".

    typedef std::basic_string<unsigned16_t> u16string;

    to

    typedef std::basic_string<unsigned16_t> _u16string;

    Of couse this involves a substitution of all "u16string" with "_u16string".
    This solves the ambiguity problem in MSMS2010 while keeping the code cross platform.
    Although the massive renaming is not elegant, but this solution is simple and works.

    Now the problems with createDLL and the include paths have to be solved. I'm on it.

     
  • HiredIceSpecter

    HiredIceSpecter - 2012-05-08

    I figured out how to solve the include path issue:

    For the projects xlslib_dll & xlslib_lib you have to "..\..\src" to their respective
    "Project Properties->Configuration Properties->VC ++ Directories->Include Directories"

    This leaves the createDLL problem. If I solve that I will upload the files for MSVS2010.

     
  • David Hoerl

    David Hoerl - 2012-05-08

    Regarding u16string; can't I just undefined it for MSVC2010? Or just not define it in that case? Can you give me a #if statement that would do this?

     
  • arietto

    arietto - 2012-05-08

    In Visual Studio 2010, _MSC_VER is defined as 1600
    #ifndef _MSC_VER
    // not VC++
    #elif _MSC_VER < 1400
    // older than VC++ 2005
    #elif _MSC_VER < 1500
    // VC++ 2005
    #elif _MSC_VER < 1600
    // VC++ 2008
    #elif _MSC_VER < 1700
    // VC++ 2010
    #else
    // Future versions
    #endif

     
  • David Hoerl

    David Hoerl - 2012-05-08

    Right, I understand. But I'm not the guy to code this - I have no MSVC setup to test it. You send me the proper way to code the test and I'll add it to the source. Its already special cased for Microsoft if I recall (don't have the code handy).

     
  • HiredIceSpecter

    HiredIceSpecter - 2012-05-09

    I came up with a macro that apparently solves the u16string issue. Apparently, because there is one other issue preventing me from generating the dll.

    ----------------------------
    For the macro, old version in common/xlstypes.h:
    ----------------------------

    #if defined(__cplusplus) // ALL C++ users

    #if defined(_MSC_VER) && defined(WIN32) // Windows

    typedef wchar_t unichar_t;
    #define ustring wstring
    //typedef wstring ustring;
    typedef std::basic_string<unsigned16_t> u16string;

    #elif defined(__FRAMEWORK__) // MAC Framework

    ---------------------------
    New version:
    ---------------------------

    #if defined(__cplusplus) // ALL C++ users

    #if defined(_MSC_VER) && defined(WIN32) // Windows

    typedef wchar_t unichar_t;
    #define ustring wstring
    //typedef wstring ustring;

    // every Visual Studio version before 2010 needs this, as 2010 introduced its own version of u16string
    #if _MSC_VER < 1600
    typedef std::basic_string<unsigned16_t> u16string;
    #else
    using std::u16string;
    #endif

    #elif defined(__FRAMEWORK__) // MAC Framework

    ----------------------------

    This makes MSV2010 and later use its own u16string instead of std::basic_string<unsigned16_t>.
    Not defining u16string for MSVS2010 doesn't work, although I'm not certain why.
    I would have prefered to use std::basic_string<unsigned16_t> instead of std::u16string so that all versions of xlslib use the same class.

    ----------------------------
    IMPORTANT: NEXT ISSUES

    The issue of the missing createDLL project/tool can be solved by placing the OpenEXR folder in the same folder als the xlslib folder, like in the svn.
    In other words, please include the OpenEXR folder in the archives that will be released, as OpenEXR is needed. Even the MSVS2008 files need that folder.
    After that I had to replace "..\..\..\installCreateDLL.cmd" with "..\..\..\..\..\installCreateDLL.cmd" in the "createDLL.vcxproj" & "createDLL.vcproj" files in OpenEXR to make it work.
    Arietto, can you confirm this? The original settings of OpenEXR should have been fine, but for some reason they weren't for me.

    ----------------------------
    ----------------------------

    What I have done so far:

    1. Opened and updated "build\msvc2008\xlslib.sln" with MSVS2010.
    2. Used the above macro to solve the u16string ambiguity.
    3. Solved the include path problem by adding "..\..\src" to "Project Properties->Configuration Properties->VC ++ Directories->Include Directories" for the every project except createDLL.
    4. Copied the OpenEXR folder from the SVN trunk into the same folder as my working copy of the xlslib folder. Reopend the solution with MSVS2010.
    5. Had the VS10 solution file (build\msvc2008\xlslib.sln) point to "vc10\IlmBase\createDLL\createDLL.vcxproj" for the createDLL tool, not "vc9\IlmBase\createDLL\createDLL.vcxproj".
    6. Replaced "..\..\..\installCreateDLL.cmd" with "..\..\..\..\..\installCreateDLL.cmd" in all "createDLL.vcxproj" & "createDLL.vcproj" files in OpenEXR folder.
    7. Rebuild createDLL with MSVS2010.

    Now I am able to build the project xlslib_lib, but the project xlslib_dll fails after all source files are processed with the error:
    LINK : fatal error LNK1181: cannot open input file 'C:\%myworkingfolder%\xlslib\build\msvc2008\xlslib_dll_Win32_MSVC2008.Debug\xlslib_dll.lib'

    There is no xlslib_dll.lib of course, just two copies of xlslib_lib.lib in two different folders (it got copied by a post build event).
    The first folder is the source folder, the second the destination one:
    C:\%myworkingfolder%\xlslib\build\msvc2008\xlslib_lib_Win32_MSVC2008.Debug
    C:\%myworkingfolder%\xlslib\build\msvc2008\bin\Win32_MSVC2008.Debug

    Copying xlslib_lib.lib to C:\%myworkingfolder%\xlslib\build\msvc2008\xlslib_dll_Win32_MSVC2008.Debug
    and renaming it to xlslib_dll.lib, doesn't work either.
    c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(3051,5): error MSB4006: There is a circular dependency in the target dependency graph involving target "GetCopyToOutputDirectoryItems".
    Nevertheless a xlslib_dll.dll is generated. I couldn't get that one to work though.

    As I can't figure out more than that xlslib_dll.lib is not generated but needed, Arietto, can you give this a shoot? You appear to know more about MSVS than I do.

     
  • arietto

    arietto - 2012-05-14

    Hello, Mr. hiredicespecter!
    So, where are you stuck?

     
  • HiredIceSpecter

    HiredIceSpecter - 2012-05-14

    I can't compile the dll project. although I am able to build the project xlslib_lib,

    The dll project fails after all source files are processed with the error:
    LINK : fatal error LNK1181: cannot open input file
    'C:\%myworkingfolder%\xlslib\build\msvc2008\xlslib_dll_Win32_MSVC2008.Debug\xlslib_dll.lib'.

    Everything I fixed so far is listed in my previous comment.

    I would ask you to reproduce what I did, confirm these steps behave for you as they did for me and try to figure out the error message of the dll project.

    I know it's quite a lot.

     
  • arietto

    arietto - 2012-05-18

    Well, at least we should test solution 2008 for the 1st time.
    I've tried to build solution in Visual Studio 2008.
    I've got plenty of errors:
    Error 9 fatal error C1083: Cannot open include file: 'xlslib/record.h': No such file or directory d:\aries\xlslib-2.3.4\xlslib\src\xlslib\summinfo.cpp 33

     
  • arietto

    arietto - 2012-05-18

    I think that VS solutions must be more well tested in comparison to RadStudio, CodeBlocks and BDS projects for Windows. Visual Studio is a mainstream C++ IDE for Windows and the lack of high-quality solutions which work out of the box does not allow to work with xlslib in a comfortable way.

     
  • HiredIceSpecter

    HiredIceSpecter - 2012-05-23

    I managed to correct the settings for Visual Studio 2008. It created a dll.

    The steps are the same as for 2010, but some settings have slightly different names.

    Sorry for my late reply, work is keeping me busy.

     
  • HiredIceSpecter

    HiredIceSpecter - 2012-05-31

    Following are the detailed steps I took to generate the dll with Visual Studio 2008. Can you confirm those, Arietto? Aka follow them and see if you can make the 2008 solution work on your end, too?
    @David: Could you add the folder OpenEXR to all following releases of xlslib, as it is essential for VS 2008 and 2010?

    What I did you make VS 2008 to build a DLL:
    1. Opened "build\msvc2008\xlslib.sln" with MSVS2008.
    2. Unloaded (right-click) and reloaded every project. Otherwise VS will show an error message when trying to access the properties of a project. This is only needed once.
    3. Solved the include path problem by adding "..\..\src" to "Project
    Properties->Configuration Properties->C/C++->Additional Include Directories" for the every project EXCEPT createDLL.
    4. Copied the OpenEXR folder from the SVN trunk into the same folder as my
    working copy of the xlslib folder. Reopend the solution with MSVS2008.
    6. Replaced "..\..\..\installCreateDLL.cmd" with
    "echo ..\..\..\installCreateDLL.cmd" in “createDLL-Properties -> Configuration Properties -> Build Events -> Post Build Event->Command Line”.
    7. Rebuild createDLL , rebuild xlslib_lin, rebuild xls_libdll and a xlslib_dll.dll is built. Haven’t tested the dll though.

     
  • David Hoerl

    David Hoerl - 2012-05-31

    I'll be glad to add the folder, just want to be 100% sure of WHERE you want it to be. I believe you want it in the top-level xlslib directory..correct?

    David

     
  • HiredIceSpecter

    HiredIceSpecter - 2012-05-31

    Not in the top-level xlslib directory. Next to the xlslib top-level directory, like it is in the SVN directory trunk.

    Like this (think directory tree):

    xlslib.zip
    |
    +-OpenEXR
    +-xlslib
    |
    -build
    -config
    -contrib
    -m4
    -src
    -targets

     
  • HiredIceSpecter

    HiredIceSpecter - 2012-05-31

    Argh, the white space got removed.

    Well, got to use a bunch of sentences:

    OpenEXR is a subdirectory of xlslib.zip.
    xlslib is a subdirectory of xlslib.zip.
    build, config, etc are subdirectories of xlslib.

    Sounds stupid, but should clarify what I mean. ;-)

     
  • HiredIceSpecter

    HiredIceSpecter - 2012-06-12

    I figured out which files have to been updated for Visual Studio 2008:

    xlslib.sln
    xlslib_dll.vcproj
    xlslib_lib.vcproj
    xlslib-PR2859188.vcproj
    xlslib-PR3076678.vcproj
    xlslib-testC.vcproj
    xlslib-testCPP.vcproj

    I placed fixed versions in a zip file. How do I get that to you or on sourceforge?

     
  • arietto

    arietto - 2012-06-13

    hiredicespecter, do have you asked me?
    If so, then please send it to my email
    lutaries (at) rambler (dot) ru

     
1 2 > >> (Page 1 of 2)

Log in to post a comment.