http://ice.sf.net |
|
Version 0.4.0
2004-10-17 |
Contents
iCompile is a build system for C++ projects on Linux 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.
# Set your custom INCLUDE and LIBRARY directories
setenv INCLUDE /u/morgan/libraries/g3d-6_04/include:/usr/include/SDL
setenv LIBRARY /u/morgan/libraries/g3d-6_04/linux-lib
cd homework/assign4
# Run iCompile to build (and document, and run) your program
icompile --doc --run
Download the latest version of iCompile 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. You may want to add those commands to your.cshrc
file so they execute every time you log in.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.
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 the_build
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
datafiles
. 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. |--
datafiles/ Files needed at runtime (Optional) | `-- config.txt Copied to _build/distrib during compilation. | |-- Doxyfile |-- ice.txt `--
_build/ |--
doc/ Generated documentation for programmers. | |-- main.html | `-- index.html | `--
distrib/ 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/ |--
doc/ Generated documentation for library users. | |-- format.html | `-- index.html | `--
include/ Headers for library users. | `-- format.h | `--
lib/ |-- format.a Optimized library. `-- formatd.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.
datafiles
Data files needed at runtime by an executable project. Copied to _build/distrib
during build.docfiles
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'
..icompile-temp
Used internally by iCompile to store cached dependency information and object files. Deleted by 'icompile --clean'
.CVS, graveyard, temp, tmp, test, _build, Debug, Release, old, datafiles, docfiles, .icompile-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.
icompile [--doc] [--opt|--debug] [--verbose] [--clean] [--version] [--help] [--run|--gdb ...] --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. --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. --verbose Print script variables and other output. Exclusive options: --help Print this information. --clean Delete all generated files. --version Print the version number of iCompile. Special directory names: _build Output directory datafiles Files that will be needed at runtime docfiles Files needed by your Doxygen output iCompile will not look for source files in directories matching: ['^old$', '^CVS$', '^Debug$', '^Release$', '^graveyard$', '^tmp$', '^temp$', '^res$', '^docres$', '^.icompile-temp$', '^doxygen$', '^distrib$'] Environment variables: INCLUDE Places to look for headers LIBRARY Places to look for static and dynamic libs (Separate individual paths with colons) 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".