From: Jack D. <ja...@ge...> - 2009-09-23 15:31:45
|
After much hacking I have succeeded in compiling and running the wxPLplotDemo on my Eclipse/CDT/MingW & MSYS system. I'm posting this in case others want to try the same. I do not pretend to understand all of this. The Eclipse/CDT/MingW & MSYS system is installed roughly as described in http://wiki.wxwidgets.org/Eclipse,_CDT_&_MingW_&_MSYS_Setup_Guide This document contains the caution: "If you plan to use other libraries which depend on wxWidgets (e.g. PLplot), be aware that although this method which uses ./configure to create the makefiles will result in Windows libraries, it will not place them in the same paths as if you were to use mingw32-make directly with the pre-existing makefiles. The location of build.cfg may also be a significant factor. CMake, for example, can search for wxWidgets via two independent methods labeled 'unix' and 'win32'. This ./configure method is not compatible with the 'win32' search method." The above described issue was a problem (cmake did not find wxWidgets) when I installed PLplot according to the procedure described in the PLplot wiki at http://www.miscdebris.net/plplot_wiki/index.php?title=Configure_PLplot_for_M inGW/CLI I was able to solve it by running the PLplot build in an MSYS window and changing the cmake options. Specifically, by setting the option MSYS=1, cmake uses the "unix" method which calls wx-config to locate wxWidgets. The build must be run in an MSYS window instead of a Windows Command Prompt window because wx-config is a shell script and Windows can't execute it. I also found that I had to explicitly turn set wxwidgets=ON and PLD_wxwidgets=ON or else the wxWidgets driver for PLplot would not be built. The modified procedure is (from the root of the unzipped PLplot directory): mkdir buildmingw cd buildmingw cmake -G "MinGW Makefiles" -DMSYS=1 -DCMAKE_INSTALL_PREFIX=install -DBUILD_TEST=ON -DwxWidgets_CONFIGURATION=msw -DENABLE_wxwidgets=ON -DPLD_wxwidgets=ON .. mingw32-make mingw32-make install (Everything from cmake to .. is one line, even though the email may wrap it.) This is probably doing it the hard way since the libraries and include files end up in buildmingw\install and have to be manually copied to the \MinGW directory. Specifically, I copied all the *.dll.a files from buildmingw\install\lib to \MinGW\lib and all the .dll files from buildmingw\install\bin to \MinGW\bin. This step could probably be eliminated by changing CMAKE_INSTALL_PREFIX=install to CMAKE_INSTALL_PREFIX=/c/MinGW but I have not tested that. To build wxPLplotDemo I created a project in Eclipse using as a guide the wxWidgets sampleMinimal project created according to the procedure in Eclipse,_CDT_&_MingW_&_MSYS_Setup_Guide. The source files wxPLplotDemo.cpp, wxPLplotstream.cpp, and wxPLplotwindow.cpp were put into this project and it was built (using shared wxWidgets libraries). It was necessary to explicitly list the full path of buildmingw\install\include\plplot in Eclipse Project-Properties-C/C++ Build-Settings-GCC C++ Compiler-Directories; and the full paths (MSYS style, e.g. /c/ ... /buildmingw/ /install/lib/libcsirocsa.dll.a) of all the dll.a files in Eclipse Project-Properties-C/C++ Build-Settings-GCC C++ Linker-Miscellaneous-Linker flags. Strangely, the project would build if wxPLplotstream.cpp and wxPLplotwindow.cpp were not put in the project (presumably they were linked from the dlls) but the resulting program would crash without displaying a window. The Windows error report contained the information: AppName: plplotdemo.exe AppVer: 0.0.0.0 ModName: libplplotwxwidgetsd.dll ModVer: 0.0.0.0 Offset: 001620f0. This is obviously a kludgy mess and I may encounter problems yet. I hope this is useful to someone, and I would welcome and suggestions about how to make it cleaner. Jack Dodds |