http://ice.sf.net |
|
Version 0.5.7
2009-05-22 |
Contents
iCompile is a zero-configuration build system for C++ projects on Linux, FreeBSD, and OS X that automates the creation of executables, static and shared libraries, and HTML documentation for source code. iCompile is easy to use. Unlike a Makefile or other build system, it requires no per-project configuration. It finds your C++ source code, computes dependencies, and infers the correct options for the compiler and linker.
# Optionally set your custom INCLUDE and LIBRARY directories
setenv INCLUDE ~/morgan/libraries/libfun/include
setenv LIBRARY /u/morgan/libraries/libfun/lib
cd homework/assign4
# Run iCompile to build (and document, and run) your program
icompile --doc --run
If iCompile is not already installed on your system, download the latest version from http://ice.sf.net and put it in a directory (like/usr/bin
) that is in yourPATH
environment variable.If you use any libraries that are not installed in
/usr/lib
and/usr/include
, set theLIBRARY
andINCLUDE
variables as shown in the example at the top of this manual or edit your~/.icompile
file to contain those paths.iCompile is a Python script and requires at least Python 2.0 to run. You can check the version of your Python version using the command "
python -V
". If you are running an old version of Python, iCompile will print the error "Illegal syntax
" for the "-=
" operator.
To start a new project, create an empty directory and run iCompile inside it with no arguments. You will be prompted to confirm the creation of the default main.cpp and directories during project creation. You can also run iCompile on an existing project that previously used a different build system. In that case, iCompile will not create any new directories or source files. iCompile determines how to build your project by examining the directory structure. The name of the binary executable produced by the build is the same as the name of the project directory. If the project directory name has the extension.dll
or.so
, a shared library is created instead of an executable. The extensions.lib
and.a
create a static library.All source files (
.cpp
,.c
,.cxx
, etc.) in the project directory and its subdirectories are considered part of the project and will be compiled during the build. There are exceptions for temp directories and the like discussed later.When it is first run, iCompile generates an
ice.txt
file telling the build system that this is the root of a project and aDoxygen
file for the documentation generator. All other generated files are written to thebuild
directory, which can safely be deleted at any time by hand or using the command'icompile --clean'
.Because the build directory could be deleted, keep any data files that are part of your program's installation in the special directory named
data-files
. These will be copied into the distribution directory during the build. A sample directory tree for an executable project is shown below.
Gray files and directories are automatically generated.hello/ |-- main.cpp CPP and H files may be at the top level | or in subdirectories. |--
data-files/ Files needed at runtime (Optional) | `-- config.txt Copied to build/install during compilation. | |-- Doxyfile |-- ice.txt `--
build/ |--
doc/ Generated documentation for programmers. | |-- main.html | `-- index.html | `--
osx-i386-g++4.0/ Files to distribute to users. |-- config.txt |-- hello.a Optimized executable. `-- hellod.a Debug executable.
A project that builds a static library is in a directory ending with '.lib' or '.a'. Dynamic (shared) library projects are configured in exactly the same manner except the root directory name ends with '.dll' or '.so'.Gray files and directories are automatically generated.format.lib/ |-- format.cpp CPP and H files may be at the top level |-- stringhelper.h or in subdirectories. | |--
include/ Headers to be distributed with the library (Optional). | `-- format.h | |-- Doxyfile |-- ice.txt `--
build/ `--
osx-i386-g++4.0/ Distribute to library users. |--
doc/ Generated documentation for library users. | |-- format.html | `-- index.html | |--
include/ Headers for library users. | `-- format.h | `--
lib/ |-- libformat.a Optimized library. `-- libformatd.a Debug library.
iCompile is controlled through the following special directory names. Using these is optional-- you can use these directory names to take advantages of the full feature set, but iCompile will compile a library or executable in any directory structure.
data-files
Data files needed at runtime by an executable project. Copied to build/install
during build.doc-files
Resources needed by the generated documentation; usually images and hand coded html files. Copied to build/doc
during build.include
Header files needed by the library user for a library project. Copied to build/include
during build. The library itself may use these files when building as#include "include/..."
.build
Contains all generated files (except ice.txt
andDoxyfile
). Deleted by'icompile --clean'
..ice-temp
Used internally by iCompile to store cached dependency information and object files. Deleted by 'icompile --clean'
..svn, CVS, graveyard, temp, tmp, test, build, Debug, Release, old, data-files, doc-files, .icee-temp
Ignored when looking for source files during compilation.
The first time you build a projectice.txt
is generated. This file tells iCompile where the root of your project is (which also allows it give you a warning if you try to build from the wrong directory!).ice.txt
also contains setting information, like include paths. The default settings are fine for most projects and you do not need to edit this file.However, you may want to set per-project paths, compiler options, and link libraries. To do this, open
ice.txt
in any text editor. The comments in the file explain what each of the settings is for and how to modify them. If you corrupt the file you can delete it and iCompile will generate a new one for you.
The first time you run iCompile, the file~/.icompile
is generated. This file specifies the default compiler, paths, and some optional behavior like beeping after compilation succeeds. The file contains comments explaining each option. Settings in~/.icompile
can be overridden by individual projectice.txt
files.The default files will work correctly for most projects and changing
~/.icompile
andice.txt
is not recommended. It can be hard to debug the compiler and linker errors that result from an improperly configured system.
icompile [--doc] [--opt|--debug] [--clean] [--version] [--config] [--verbosity n] [--help] [--noprompt [--template ]] [--info] [--run|--gdb ...] iCompile can build most C++ projects without options or manual configuration. Just type 'icompile' with no arguments. Run in an empty directory to generate a set of starter files. Options: --doc Generate documentation before building. --debug (Default) Create a debug executable (define _DEBUG, disable optimizations). --opt or -O Generate an optimized executable. --run Run the program if compilation succeeds, passing all further arguments (...) to the program. --config Use instead of ~/.icompile as the user configuration file. This allows you to build certain projects with a different compiler or include paths without changing the project ice.txt file, e.g., when installing a 3rd party library --gdb Run the program under gdb if compilation succeeds, passing all further arguments (...) to the program. You can also just run gdb yourself after using iCompile. --verbosity n Change the amount of information printed by icompile n | Result ----|--------------------------------------------------- 0 | Quiet: Only errors and prompts are displayed. | 1 | Normal (Default): Filenames and progress information | are also displayed 2 | Verbose: Executed commands are also displayed | 3 | Trace: Additional debugging information is also | displayed. --noprompt Run even if there is no ice.txt file, don't prompt the user for input. This is handy for launching iCompile from automated build shell scripts. If --template is specified as well, a default set of files will be built. The only legal templates are 'hello', 'G3D', and 'empty' (default). --info Read configuration files and command line options, but instead of building, print out information about where the generated file will go. Exclusive options: --help Print this information. --clean Delete all generated files (but not library generated files). --version Print the version number of iCompile. Special directory names: build Output directory data-files Files that will be needed at runtime doc-files Files needed by your documentation (Doxygen output) iCompile will not look for source files in directories matching: ['^\\.', '^#', '~$', '^\\.svn$', '^CVS$', '^Debug$', '^Release$', '^graveyard$', '^tmp$', '^temp$', '^doc-files$', '^data-files$', '^\\.icompile-temp$', '^\\.ice-tmp$', '^build$'] You may edit ice.txt and ~/.icompile if your project has unusual configuration needs. See manual.html or http://ice.sf.net for full information.
iCompile prefers static linking because it leaves you with an executable that is more likely to work on a different computer. The G3D library are statically linked for this reason. Some libraries, like SDL and OpenGL, can't be statically linked so they are dynamically linked. The standard library is dynamically linked. This is necessary so that other dynamically linked libraries will allocate memory in the same memory space. Your program will only work if the user has installed these libraries and set their LD_LIBRARY_PATH to point to them or updated /etc/ld.so.conf. You can see what dynamic libraries an executable needs with the Linux command "ldd".