Difference between revisions of "Developing in Eclipse on Win32"
m (→Change config.mak and pro files to support CMD builds) |
m (Typo) |
||
Line 5: | Line 5: | ||
There are a few issues that need working around | There are a few issues that need working around | ||
# CMD and SH - Eclipse issues all commands under CMD, not SH. Therefore some modification need to be made, mainly to the build process. I am trying to get these into svn, but until then they are manual steps | # CMD and SH - Eclipse issues all commands under CMD, not SH. Therefore some modification need to be made, mainly to the build process. I am trying to get these into svn, but until then they are manual steps | ||
− | # Eclipse support for PRO - for unknown reason, Eclipse | + | # Eclipse support for PRO - for unknown reason, Eclipse can't import the three mythtv projects. A few workarounds are in place |
==CMD and SH== | ==CMD and SH== |
Revision as of 20:46, 12 July 2008
Introduction
With the release of QT Eclipse integration and the move to QT 4.4, it is now possible to have a fully working environment on Eclipse on Windows.
Important Note:
There are a few issues that need working around
- CMD and SH - Eclipse issues all commands under CMD, not SH. Therefore some modification need to be made, mainly to the build process. I am trying to get these into svn, but until then they are manual steps
- Eclipse support for PRO - for unknown reason, Eclipse can't import the three mythtv projects. A few workarounds are in place
CMD and SH
QMAKE supports compilation under windows both in CMD and SH environments. Both environments match the win32 directive in pro files. To distinguish between CMD and SH, QMAKE checks if sh.exe is in the PATH. If it is found in the path, then QMAKE_SH is set to "path to sh.exe", otherwise it is left empty. The default gmake.conf (mkspecs\win32-g++\gmake.conf) uses this value to set some CMD or SH defaults, and sets the value MINGW_IN_SHELL if SH.exe is used. Some parts of the mythtv pro files need to also use this value to provide an alternative for CMD build.
Overview of the process(Draft)
- Install the required Software packages: Eclipse for Windows, Perl support for Eclipse, SVN Plugin for Eclipse and TrollTech's QT integration
- Setup Win32 Environment by running win32-packager.pl
- Creating Eclipse Project Files
- Create the Eclipse project files for mythtv, mythplugins and myththemes
- Edit the Eclipse Startup file
- Make some changes in mythtv\config.mak, and pro files to support CMD build as well as SH
- Start up Eclipse
- Tweak some Eclipse settings
- Start working :)
Install Software Packages
Install:
Qt Eclipse Integration for C++ 1.4.0- [[1]] EPIC (Eclipse Perl Integration) 0.6.24 - [[2]] Subclipse 1.2.4 - [[3]]
Setup Win32 Environment
Run win32-packager.pl and build a completed mythtv,plugins and themes. For this example, we'll assume it was installed in c:\mythtv INSTALL_ROOT If you are starting completely from scratch, all you need is to download and run the win32-packager.bat http://svn.mythtv.org/svn/trunk/mythtv/contrib/Win32/build/MythInstaller.bat. Also see Windows_Port
Creating Eclipse Project Files
The final objective is to get win32-packager.pl to create this by request. For now, this script generates the required Eclipse files: Eclipse_setup.pl To run it, open a CMD window and type
perl c:\temp\Eclipse_setup.pl (assumes c:\mythtv as the root directory) perl c:\temp\Eclipse_setup.pl -p c:\temp (sets root directory to c:\temp)
You must have the environment variable QTDIR defined
Edit the Eclipse Startup file
Edit the QT Eclipse Startup file: C:\Program Files\Trolltech\Eclipse\start.bat so c:\msys\1.0\bin is not part of the path. For example:
set path=c:\mingw\bin;c:\perl\site\bin;c:\perl\bin;c:\windows\system32;c:\windows
Change config.mak and pro files to support CMD builds
The final objective is to get these changes into SVN by default. Until that happens, they are summarized below
mythtv\config.mak and myththemes\mythconfig.mak from:
PREFIX=/c/mythtv/build LIBDIRNAME=lib LIBDIR=/c/mythtv/build/lib
to:
PREFIX=/c/mythtv/build LIBDIRNAME=lib LIBDIR=/c/mythtv/build/lib isEmpty(MINGW_IN_SHELL) { PREFIX=C:\mythtv\build MSYS=c:\msys\1.0 LIBDIRNAME=lib LIBDIR=C:\mythtv\build\lib }
Change mythtv\version.pro from:
SVNTREEDIR = $$system(pwd)
to
win32:isEmpty(MINGW_IN_SHELL){ SVNTREEDIR = $$system($$MSYS\bin\pwd.exe) } else { SVNTREEDIR = $$system(pwd) }
AND from:
version.commands = \"$$SVNTREEDIR/version.sh \ $$SVNTREEDIR \ $$SVNREPOPATH\"
to:
win32:isEmpty(MINGW_IN_SHELL) { version.commands = c:\msys\1.0\bin\sh.exe -C \"$$SVNTREEDIR/version.sh \ $$SVNTREEDIR \ $$SVNREPOPATH\" } else { version.commands = \"$$SVNTREEDIR/version.sh \ $$SVNTREEDIR \ $$SVNREPOPATH\" }
Change mythtv\themes\themes.pro and myththemes\myththemes.pro from:
QMAKE_COPY_DIR = sh ./cpsvndir
to:
win32:isEmpty(MINGW_IN_SHELL){ QMAKE_COPY_DIR = xcopy /E /I /Y } else { QMAKE_COPY_DIR = sh ./cpsvndir }
Start up Eclipse
- Startup Eclipse: Start -> Programs -> Qt Eclipse Integration v1.4.0 -> Start Eclipse with MinGW
- Define c:\mythtv as your default workspace
- In Eclipse, select Window -> Preferences. Select the QT Section. Press the Add button and define a new QT version:
Name: QT 4.4.0 Bin Path: <QTDIR>\bin Include Path: <QTDIR>\include Note that if you define more that one QT version, you will have to edit the Project Properties to indicate which one to use. If you only define one version, it will be picked up automatically
- Select Open WorkBench
- Select Project and unselect Build authomatically
- Select File -> Import. Select General section and select "Existing Projects into Workspace"
- Press Next and select Browse
- The c:\mythtv directory should be selected. Press OK
- All three projects should appear, select all three
- When the "Add Files to QT Project dialog" appears, hit Cancel for each
Eclipse Hints
To add specific builds, for example programs\mythfrontend:
- Select the programs\mythfrontend directory in the Project Explorer window
- Right-click and select Make Targets -> Create
- Enter mythfrontend as the name
- Leave Make Target blank
- Verify that Build Command is mingw32-make
- Uncheck Run all project builders
To add a clean build for programs\mythfrontend, repeat the process above and:
- Enter "clean" for the Make Target
By default .pro files are opened with the Pro Editor. To open a pro file in text, right-click it and select Open with Text Editor. It will be remembered for next time
To Update the source to latest HEAD:
- Select Project -> Clean
- Select the project in the Project Explorer, right-click and select "Relace with Latest from Repository"
- Answer no to the following files: .project, .cproject, .metadata, .settings and .externaltoolbuilders
- Answer no to config.mak, version.pro if you have made the above changes (and they are not in SVN)
Caveats
For some reason, the lines for version.cpp is created twice. This causes some make warnings.
Eclipse doesn't like the empty "config" directory. Comment out "SUBDIRS += config" in myth.pro to solve it.