Ceda Project (xcpj) Files

An Xcpp project file typically has extension xcpj, and is the counterpart to a MSVC .vcproj file. It specifies all the compiler and linker command line options and the set of project files to be compiled and linked to build a single target. Unlike a .vcproj file, a .xcpj file is intended to be directly edited by the user. It must conform to a certain grammar. A .vcproj file can be automatically generated from a given .xcpj file.

A lexical scanner similar to the one used for the C programming language is used. It allows the use of //... or /*...*/ comments throughout the file. White space between tokens is not generally significant.

In general paths within .xcpj and .xcws files must use forward slashes (not backslashes). It is an error to include a leading or trailing slash in a path.

Every .xcpj file is comprised of the following three sections:

  1. The definitions of $TARGET_TYPE and $ROOT_TO_PROJDIR
  2. Specification of the configurations, the compiler and linker switches for each configuration across the project, and the sub-projects. The following directives can appear (any number of times and in any order):
    Directive Description
    @import Support for importing files, typically for the default build configurations and compiler and linker switches
    config{...} Build configurations
    +cpp{...}, -cpp{...} Compiler switches
    +rc{...}, -rc{...} Resource compiler switches
    +link{...}, -link{...} Linker switches
    subproj{...} Subprojects
    directories Directories
    prebuildevent{...} Pre-build event
    prelinkevent{...} Pre-link event
    postbuildevent{...} Post-build event
    toolFiles{...} Tool files
    general{...} General settings such as the output directory
  3. The Source Files - i.e. the set of files in the project, in the form of a tree structure using curly braces to represent nested directories.

Using the Xcpp Macro Preprocessor

The Xc++ Macro Preprocessor is applied to the .xcpj file before it is parsed. For example it is possible to declare macros of the form


@def name = substitution-string

The preprocessor also provides @if-@else directives, making it possible to conditionally define configurations, compiler switches etc. Note however that it is not expected that the preprocessor needs to be used very often, if at all.

There is also support for variables of the form $name

Example xcpj file


$TARGET_TYPE = "Library"
$ROOT_TO_PROJDIR = "Ceda/App/cxJigsaw"
xcpp

@import "Ceda/BaseDefaults.xcpjh"
@import "Ceda/link_boost.xcpjh"

subproj
{
    "Ceda/cxUtils"
    "Ceda/cxObject"
    "Ceda/cxLss"
    "Ceda/cxPersistStore"
    "Ceda/cxGeom"
    "Ceda/cxModel"
}


{
    "src"
    {
        "Activity.cpp"
        "ActivityVec.cpp"
        "Arena.cpp"
        "Backdrop.cpp"
        "Chat.cpp"
        "CommonDecorators.cpp"
        "Drawing.cpp"
        "HomePage.cpp"
        "Jigsaw.cpp"
        "Room.cpp"
        "RoomList.cpp"
        "Text.cpp"
        "Users.cpp"
        "UserChatSettings.cpp"
        "UserJigsawSettings.cpp"
        "UserSettings.cpp"
        "cxJigsaw.cpp"
        "StdAfx.cpp" : +cpp { /Yc"StdAfx.h" }
        "StdAfx.h"
    }

    "cxJigsaw.h"
    "Activity.h"
    "ActivityVec.h"
    "Arena.h"
    "Backdrop.h"
    "Chat.h"
    "Drawing.h"
    "CommonDecorators.h"
    "HomePage.h"
    "Jigsaw.h"
    "Room.h"
    "RoomList.h"
    "Text.h"
    "Users.h"
    "UserChatSettings.h"
    "UserJigsawSettings.h"
    "UserSettings.h"

    "Protocol.h"
}

BaseDefaults.xcpjh is an important header file for xcpj files which defines useful defaults for the build configurations, and the compiler and linker switches.

  (root)
    └── Ceda
        ├── BaseCppCompilerDefaults.xcpjh
        ├── BaseDefaults.xcpjh
        ├── BaseLinkerDefaults.xcpjh
        └── BaseResourceCompilerDefaults.xcpjh

xcpjh files for linking against popular third party libraries

  (root)
    └── Ceda
        ├── link_ATK.xcpjh
        ├── link_BerkeleyDB.xcpjh
        ├── link_Cximagecrt.xcpjh
        ├── link_DevIL.xcpjh
        ├── link_FreeImage.xcpjh
        ├── link_FreeType.xcpjh
        ├── link_GDK.xcpjh
        ├── link_GLEW.xcpjh
        ├── link_GLFW.xcpjh
        ├── link_GLM.xcpjh
        ├── link_GLib.xcpjh
        ├── link_GdiPlus.xcpjh
        ├── link_GraphicsMagick.xcpjh
        ├── link_GtkPlus.xcpjh
        ├── link_Jpeg.xcpjh
        ├── link_KyotoCabinet.xcpjh
        ├── link_LMDB.xcpjh
        ├── link_LevelDB.xcpjh
        ├── link_NuoDB.xcpjh
        ├── link_OpenCV.xcpjh
        ├── link_OpenGL.xcpjh
        ├── link_OpenSSL.xcpjh
        ├── link_Pango.xcpjh
        ├── link_Python.xcpjh
        ├── link_RSVG.xcpjh
        ├── link_RocksDB.xcpjh
        ├── link_SOIL.xcpjh
        ├── link_Xercesc.xcpjh
        ├── link_boost.xcpjh
        ├── link_boostpython.xcpjh
        ├── link_cairo.xcpjh
        ├── link_cxImage.xcpjh
        ├── link_libffi.xcpjh
        ├── link_wxWidgets.xcpjh