|
|
(32 intermediate revisions by 11 users not shown) |
Line 1: |
Line 1: |
| ==Makefile generators==
| | {{CMake/Template/Moved}} |
|
| |
|
| The following targets are available:
| | This page has moved [https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/Generator-Specific-Information here]. |
| | |
| * all
| |
| * install
| |
| * install/fast
| |
| * edit_cache
| |
| * <target>
| |
| * <target>/fast
| |
| * file.o
| |
| * file.i
| |
| * file.s
| |
| | |
| ; "Unix Makefiles" : This generator generates Makefiles for make under Unix and also for '''cygwin''' (i.e. with Unix paths)
| |
| ; "MinGW Makefiles" : Windows only, generates Makefiles for GNU make from the [http://www.mingw.org MinGW project], the makefiles work also with other "native" GNU make versions for Windows. You can get this e.g. from http://unxutils.sourceforge.net, the download location is http://sourceforge.net/project/showfiles.php?group_id=9328&package_id=9393 . From that zip file only /usr/wbin/make.exe is needed.
| |
| ;
| |
| ;The GNU make from www.steve.org.uk is version 3.75, this version has a bug, it does '''not''' work.
| |
| ;
| |
| ; The generated Makefiles use DOS/Windows paths and use cmd.exe as shell. GNU make supports parallel builds and can also be used with cl.exe as compiler. This can be done by setting the environment variables CC and CXX to cl.exe before running CMake.
| |
| ; "MSYS Makefiles" : Windows only, generates Makefiles to be used under [http://www.mingw.org/msys.shtml MSYS]. It uses Unix-like paths and sh.exe from MSYS as shell.
| |
| ; "NMake Makefiles": Windows only, generates Makefiles for MS nmake. The makefiles use DOS/Windows paths and care for nmake specific issues. The environment has to be setp correctly, e.g. by running vcvars32.bat. This can be done by running from the "Visual Studio Command prompt".
| |
| ; "Borland Makefiles": Windows only, generates Makefiles for Borland make. The makefiles use DOS/Windows paths and care for Borland make specific issues.
| |
| ; "Watcom WMake": Windows only, generates Makefiles for Borland make. The makefiles use DOS/Windows paths and care for Watcom wmake specific issues.
| |
| | |
| ==How to generate NMake Makefiles using Visual C++ Express Edition (free Visual Studio 8)==
| |
| | |
| ===Goal===
| |
| To compile your project on the command line using the one-year free Visual C++ 2005 Express Edition,
| |
| you can generate NMake Makefiles with CMake, and then use nmake.
| |
| | |
| ===Rationale===
| |
| To use the free compiler, 'Visual C++ Express Edition' and 'Microsoft Platform Software development Kit (SDK)' have to be downloaded and installed separately.
| |
| The batch file for the 'Visual Studio 2005 Command Prompt' must be update to include the path, the include directory, and the libraries for Microsoft Platform SDK.
| |
| | |
| ===Instructions===
| |
| Download VC Express *and* Platform SDK from [http://www.microsoft.com http://www.microsoft.com].
| |
| Install them in C:\Program Files.
| |
| The license expires one year after your start using it.
| |
| | |
| Create a batch file called 'VS8_Command_Prompt.bat' in your home directory (for example in C:\cygwin\home\my_username\Bin). Edit this file and type:
| |
| | |
| <pre><nowiki>
| |
| @echo off
| |
| | |
| if not exist "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat" goto missing
| |
| echo call "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat"
| |
| call "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat"
| |
| | |
| @set PATH=C:\Program Files\Microsoft Platform SDK\Bin;%PATH%
| |
| @set INCLUDE=C:\Program Files\Microsoft Platform SDK\Include;%INCLUDE%
| |
| @set LIB=C:\Program Files\Microsoft Platform SDK\Lib;%LIB%
| |
| goto :eof
| |
| | |
| :missing
| |
| echo Missing file
| |
| echo "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat"
| |
| goto :eof
| |
| </nowiki></pre>
| |
| | |
| Create a Windows shortcut called "VS8_Command_Prompt" in your Desktop.
| |
| Right click and go to Properties.
| |
| Edit the shortcut tab (replace x86 with amd64, x64, ia64, x86_amd64, or x86_ia64
| |
| depending on your processor type):
| |
| Target: %comspec% /k ""C:\cygwin\home\Sylvain\Bin\VS8_Command_Prompt.bat"" x86
| |
| Start in: C:\cygwin\home\my_username\Bin
| |
| | |
| Double-click on your VS8_Command_Prompt shortcut.
| |
| Go to your build directory.
| |
| cd my_build_directory
| |
| | |
| Use CMakeSetup.exe (replace 2.2 with your CMake version number)
| |
| \Program Files\CMake 2.2\bin\CMakeSetup.exe <my_source_directory>
| |
| | |
| Click 'Configure' in the CMake Window
| |
| Select 'Build for: NMake Makefiles'
| |
| Set the CMake variables, click 'Configure', and then 'Ok'.
| |
| | |
| Check you have a Makefile in your build directory.
| |
| In the VS8_Command_Prompt, and type:
| |
| nmake
| |
| | |
| Your project should compile now.
| |
| | |
| ==Combining the $99 "Standard Edition" of Microsoft Visual C++ .NET 2003 with the free Visual C++ Toolkit 2003==
| |
| | |
| '''NOTE: This information is mostly obsolete in light of the release of Visual Studio Express C++ by Microsoft'''
| |
| | |
| ===Goals===
| |
| *1: To build fully debuggable executables with the Standard Edition of Visual C++ .NET 2003
| |
| *2: To build optimized release mode executables with the free Visual C++ Toolkit without spending the extra money on Visual Studio or C++, Pro or Enterprise editions.
| |
| | |
| ===Rationale===
| |
| The debugger and libraries that come with the $99 Standard Edition of Microsoft Visual C++ .NET 2003 are sufficient for most C++ developers' day-to-day work. Their primary goal is to build their stuff with debug info for their own consumption only. Sometimes, though, a developer needs to build an optimized version, for example, in order to reproduce a bug that only occurs in optimized builds.
| |
| | |
| However, the Standard Edition has the annoying limitation of not allowing optimized builds even though Microsoft includes their optimizing compiler in their '''free''' Visual C++ Toolkit. On the other hand, the free toolkit has the annoying limitation of not including nmake and not having full support for debug builds.
| |
| | |
| So... the combination of the two gives the best of both worlds, still at the reasonably low price of approximately $99 USD. (The debugger and its UI elements alone are well worth this price.) Check the license agreements to make sure that your use of the Standard Edition and the free Toolkit are both valid within the scope of their respective licenses.
| |
| | |
| ===Solution 1: Optimizing Visual Studio===
| |
| | |
| Visual Studio itself can be fixed so that optimizations work from right within the IDE. Then it will work just like the "Professional Edition", which means you can use the normal Visual Studio generator. You won't get any warnings about ''This edition of Visual C++ does not support the optimizing compiler'' or anything like that.
| |
| | |
| # Seach google for "free optimizing compiler". You will find a page on xona.com that tells you how to make the IDE use the optimizing compiler.
| |
| # Search google for "free optimizing compiler". You will find a page on hellewell.homeip.net that describes how to modify VCProjectEngine.dll so that it doesn't call the function that filters the command-line.
| |
| | |
| (Note to wiki admins: I wanted to place the direct links here, but the dumb spam filter wouldn't let me)
| |
| | |
| ===Solution 2: Use NMAKE===
| |
| Both Visual Studio and the Visual C++ Toolkit come with their own "Command Prompt" shortcuts. The trick to combining them is to make your own command prompt shortcut that simply configures itself using a batch file which calls each of the other batch files. If you look at the vsvars32.bat and vcvars32.bat files referenced below, you'll see that they simply set up some environment variables. Most importantly, they '''prepend''' their own relevant choices to the PATH, INCLUDE and LIB environment variables. Since they both '''prepend''', the last one called "wins."
| |
| | |
| Create your own batch file "CombinedVSCmdPrompt.bat" and add the following commands to it:
| |
| <pre>
| |
| @rem
| |
| @rem Change the following path names if you have installed Visual Studio or the
| |
| @rem Visual C++ Toolkit in non-default locations...
| |
| @rem
| |
| | |
| @if exist "%PROGRAMFILES%\Microsoft Visual Studio .NET 2003\Common7\Tools\vsvars32.bat" (
| |
| @call "%PROGRAMFILES%\Microsoft Visual Studio .NET 2003\Common7\Tools\vsvars32.bat"
| |
| @echo.
| |
| | |
| @if exist "%PROGRAMFILES%\Microsoft Visual C++ Toolkit 2003\vcvars32.bat" (
| |
| @call "%PROGRAMFILES%\Microsoft Visual C++ Toolkit 2003\vcvars32.bat"
| |
| @echo.
| |
| @echo INFO: Visual C++ Toolkit 2003 also found.
| |
| @echo. Called the toolkit's vcvars32.bat *AFTER* Visual Studio's vsvars32.bat...
| |
| @echo.
| |
| )
| |
| | |
| @echo INFO: Build environment successfully set...
| |
| @echo.
| |
| ) else (
| |
| @echo WARNING: vsvars32.bat not found in "%PROGRAMFILES%\Microsoft Visual Studio .NET 2003\Common7\Tools"...
| |
| @echo.
| |
| @echo. Install Visual Studio .NET 2003 in its default location or
| |
| @echo. modify "%~f0" to find vsvars32.bat where it is...
| |
| @echo.
| |
| )
| |
| </pre>
| |
| | |
| Now, create a "Combined Edition Visual C++" command prompt shortcut that has the following properties:<br/>
| |
| <pre>
| |
| Target: %SystemRoot%\system32\cmd.exe /K call "C:\Full\Path\To\CombinedVSCmdPrompt.bat"
| |
| | |
| Start in: C:\Binary\Directory\Of\Your\Favorite\Project
| |
| </pre>
| |
| | |
| When you double click this shortcut, you should be all set to invoke CMakeSetup.exe from it (to use CMake's GUI) or to invoke cmake.exe directly (to use the command line tool) to configure and generate your make files. This technique works when using the "NMake Makefiles" generator for either Debug or Release build flavors when cmake or CMakeSetup is invoked from this special hybrid command prompt that you've created.
| |
| | |
| Always invoke CMakeSetup, cmake and nmake from this hybrid command prompt when using this technique. If you invoke CMakeSetup through a shortcut, it will not have the special environment that you've carefully set up here and it will not use the optimizing compiler in the generated make files.
| |
| | |
| You can use either "NMake Makefiles" or "Visual Studio 7 .NET 2003" generators for Debug builds.
| |
| | |
| ==KDevelop3 Generator==
| |
| | |
| [[Image:CMakeKDevelop3GeneratorScreendump.png|thumb|right|350px|KDevelop opens CMake project file]]
| |
| | |
| Available in CMake since version 2.2.0, works with KDevelop 3.1.1 and newer, out-of-source builds are supported.
| |
| | |
| Beside creating all the same files as UNIX Makefile generator, it creates in the toplevel binary directory files:
| |
| | |
| Project.kdevelop
| |
| Project.kdevelop.filelist
| |
| | |
| The first one is XML describing the project, while the second one is a list of relative paths to the source files. The source files are grouped based on globbing expression in the XML file.
| |
| | |
| | |
| ==Eclipse CDT 4.0 Generator==
| |
| | |
| There is a new Eclipse CDT 4.0 Generator in development. There will be information here after it is released. However, if you are interested in helping or following the development please watch the discussion at the [[Eclipse CDT4 Generator Development]] site. Note that you can help by simply testing the generator, so please do chime in!
| |
| | |
| {{CMake/Template/Footer}}
| |