Add FullSkeleton example

This commit is contained in:
flithm 2007-08-29 11:24:39 +00:00
parent 51095a9d7d
commit c315c3f0d3
75 changed files with 4452 additions and 0 deletions

View file

@ -0,0 +1,115 @@
#################################
# Preamble
##############
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/
# is checked
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
# Using Phobos OR Tango (can be specified from cmake command line)
if (NOT CMAKE_D_USE_PHOBOS AND NOT CMAKE_D_USE_TANGO)
# default to phobos
message(STATUS "This application can be built with either Phobos or Tango!")
message(STATUS "You did not specify a standard library -- defaulting to Phobos.")
message(STATUS "If you wish to use Tango add -DCMAKE_D_USE_TANGO=True to cmake command line.")
set(CMAKE_D_USE_PHOBOS True)
endif (NOT CMAKE_D_USE_PHOBOS AND NOT CMAKE_D_USE_TANGO)
# check for DDoc usage
include(UseDDoc)
#################################
# Project
##############
project(FullSkeleton D C)
#################################
# Defines
##############
# global needed variables
set(APPLICATION_NAME ${PROJECT_NAME})
set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "1")
set(CPACK_PACKAGE_VERSION_PATCH "0")
set(APPLICATION_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
#################################
# Configure Includes / Settings
##############
# set default build type to release
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif (NOT CMAKE_BUILD_TYPE)
# add definitions
include(DefineProjectDefaults)
include(DefineProjectOptions)
include(DefineCompilerFlags)
include(DefineInstallationPaths)
# add macros
include(MacroAddPlugin)
include(MacroEnsureOutOfSourceBuild)
include(ConfigureChecks.cmake)
# config.d
configure_file(config.d.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.d)
#################################
# Sub-directories
##############
subdirs(libraryA libraryB programClient programServer)
#################################
# Information
##############
message(STATUS "Installation Variables:
Build Type (CMAKE_BUILD_TYPE): ${CMAKE_BUILD_TYPE}
Install Prefix (CMAKE_INSTALL_PREFIX): ${CMAKE_INSTALL_PREFIX}
Data Dir (DATA_INSTALL_DIR): ${DATA_INSTALL_DIR}
Lib Dir (LIB_INSTALL_DIR): ${LIB_INSTALL_DIR}
Plugin Dir (PLUGIN_INSTALL_DIR): ${PLUGIN_INSTALL_DIR}
Config Dir (SYSCONF_INSTALL_DIR): ${SYSCONF_INSTALL_DIR}
Build Client (BUILD_CLIENT): ${BUILD_CLIENT}
Build Server (BUILD_SERVER): ${BUILD_SERVER}
Build X11 Renderer (BUILD_RENDERER_X11): ${BUILD_RENDERER_X11}
Build Windows Renderer (BUILD_RENDERER_WIN): ${BUILD_RENDERER_WIN}
Build Documentation (CMAKE_D_BUILD_DOCS): ${CMAKE_D_BUILD_DOCS}
DDoc Files (CMAKE_D_DDOC_FILES): ${CMAKE_D_DDOC_FILES}"
)
#################################
# Packing
##############
include(InstallRequiredSystemLibraries)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_NAME}")
set(CPACK_PACKAGE_VENDOR "${PROJECT_NAME}")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}-linux-i686")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
set(CPACK_GENERATOR "TGZ;TBZ2;ZIP")
set(CPACK_SOURCE_GENERATOR "TGZ;TBZ2")
set(CPACK_SOURCE_IGNORE_FILES "\\\\.svn/;/debug/;/optimized/;/documentation/;[a-z]*\\\\.kdev*;[a-z]*\\\\.tag;[a-z]*\\\\.pyc")
if (WIN32 AND NOT UNIX)
# There is a bug in NSI that does not handle full unix paths properly. Make
# sure there is at least one set of four (4) backlasshes.
SET(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp")
SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\MyExecutable.exe")
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} My Famous Project")
SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.my-project-home-page.org")
SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.my-personal-home-page.com")
SET(CPACK_NSIS_CONTACT "me@my-personal-home-page.com")
SET(CPACK_NSIS_MODIFY_PATH ON)
else (WIN32 AND NOT UNIX)
set(CPACK_STRIP_FILES "${PROJECT_NAME}/${PROJECT_NAME}")
set(CPACK_SOURCE_STRIP_FILES "")
endif (WIN32 AND NOT UNIX)
set(CPACK_PACKAGE_EXECUTABLES "${PROJECT_NAME}" "${PROJECT_NAME}")
include(CPack)

View file

@ -0,0 +1 @@
Required by CPack!

View file

@ -0,0 +1,71 @@
#################################
# Includes
##############
INCLUDE(CheckIncludeFile)
INCLUDE(CheckSymbolExists)
INCLUDE(CheckFunctionExists)
INCLUDE(CheckLibraryExists)
INCLUDE(CheckTypeSize)
INCLUDE(CheckCXXSourceCompiles)
#################################
# Defines
##############
SET(PACKAGE ${APPLICATION_NAME})
SET(VERSION ${APPLICATION_VERSION})
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(DATADIR ${DATA_INSTALL_DIR})
SET(LIBDIR ${LIB_INSTALL_DIR})
SET(PLUGINDIR ${PLUGIN_INSTALL_DIR})
SET(SYSCONFDIR ${SYSCONF_INSTALL_DIR})
#################################
# Check for desired renderer plugins
##############
# x11 renderer
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(BUILD_RENDERER_X11 False CACHE BOOLEAN TRUE FORCE)
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
if (NOT BUILD_RENDERER_X11)
set(BUILD_RENDERER_X11 True CACHE BOOLEAN TRUE FORCE)
endif (NOT BUILD_RENDERER_X11)
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
# windows renderer
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
if (NOT BUILD_RENDERER_WIN)
set(BUILD_RENDERER_WIN True CACHE BOOLEAN TRUE FORCE)
endif (NOT BUILD_RENDERER_WIN)
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(BUILD_RENDERER_WIN False CACHE BOOLEAN TRUE FORCE)
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
# client
if (NOT BUILD_CLIENT)
set(BUILD_CLIENT True CACHE BOOLEAN TRUE FORCE)
endif (NOT BUILD_CLIENT)
# server
if (NOT BUILD_SERVER)
set(BUILD_SERVER True CACHE BOOLEAN TRUE FORCE)
endif (NOT BUILD_SERVER)
#################################
# openpty / forkpty
##############
IF(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
check_function_exists(openpty HAVE_OPENPTY) # openpty
if (NOT HAVE_OPENPTY)
check_library_exists(util openpty "" HAVE_LIBUTIL)
if (HAVE_LIBUTIL)
set(HAVE_OPENPTY True)
set(LIBUTIL_LIBRARIES "util")
else (HAVE_LIBUTIL)
message(FATAL_ERROR "You must have openpty in libutil!")
endif (HAVE_LIBUTIL)
endif (NOT HAVE_OPENPTY)
ENDIF(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")

View file

@ -0,0 +1,14 @@
This is a CMakeD project skeleton for a complicated application that
includes:
- configure support
- config.d support
- conditional build directories
- conditionally built source files (based on platform)
- automatic documentation generation
- builds with both tango and phobos
In order to build this project:
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_D_BUILD_DOCS=True ..
make

View file

@ -0,0 +1,48 @@
DDOC =
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta content="text/javascript" http-equiv="content-script-type">
<title>$(TITLE)</title>
<link rel="stylesheet" type="text/css" href="candydoc/style.css">
<!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="candydoc/ie56hack.css"><![endif]-->
<script language="JavaScript" src="candydoc/util.js" type="text/javascript"></script>
<script language="JavaScript" src="candydoc/tree.js" type="text/javascript"></script>
<script language="JavaScript" src="candydoc/explorer.js" type="text/javascript"></script>
</head><body>
<div id="tabarea"></div><div id="explorerclient"></div>
<div id="content"><script>explorer.initialize("$(TITLE)");</script>
<table class="content" width="99%">
<tr><td id="docbody"><h1>$(TITLE)</h1>$(BODY)</td></tr>
<tr><td id="docfooter">
Page was generated with CandyDoc on $(DATETIME)
</td></tr>
</table>
</div>
$(ADD_MODULES)
</body></html>
DDOC_DECL =
<script>explorer.outline.writeEnabled = true;</script>
$(DT <span class="decl">$0</span>)
<script>explorer.outline.writeEnabled = false;</script>
DDOC_PSYMBOL =
<span class="currsymbol">$0</span>
<script>explorer.outline.addDecl('$0');</script>
DDOC_MEMBERS =
<script>explorer.outline.incSymbolLevel();</script>
$(DL $0)
<script>explorer.outline.decSymbolLevel();</script>
DDOC_PARAM_ID =
<td nowrap valign="top" style="padding-right: 8px">$0</td>
DDOC_PARAM =<span class="funcparam">$0</span>
ADD_MODULES =<script>$(MODULES)</script>
MODULE =explorer.packageExplorer.addModule("$0");

View file

@ -0,0 +1,305 @@
/* This file is a part of CanDyDOC fileset.
File is written by Victor Nakoryakov and placed into the public domain.
This file is javascript with classes that represents explorer window.
And things related to navigation. */
var explorer = new Explorer();
///////////////////////////////////////////////////////////////////////////////
// Current symbol marker class constructor
///////////////////////////////////////////////////////////////////////////////
function Marker()
{
this.top = document.createElement("div");
this.middle = document.createElement("div");
this.bottom = document.createElement("div");
this.container = document.createElement("div");
this.setTo = function(term)
{
// find definition related to `term`
var def = term.nextSibling;
while (def && def.nodeName != "DD")
def = def.nextSibling;
var defHeight = 0;
var childrenHeight = 0; // children of current declaration
if (def)
{
defHeight = def.offsetHeight;
var child = def.firstChild;
// traverse until DL tag, until children definition
while (child && child.nodeName != "DL")
child = child.nextSibling;
if (child)
childrenHeight = child.offsetHeight;
}
this.top.style.height = term.offsetHeight;
this.middle.style.height = defHeight - childrenHeight;
this.bottom.style.height = childrenHeight;
if (childrenHeight == 0)
this.bottom.style.display = "none";
else
this.bottom.style.display = "";
this.container.style.left = getLeft(term) - 8;
this.container.style.top = getTop(term);
this.container.style.display = "";
}
///////////////////////////////////////////////////////////////////////////
this.container.style.position = "absolute";
this.container.style.display = "none";
this.top.className = "markertop";
this.middle.className = "markermiddle";
this.bottom.className = "markerbottom";
this.container.appendChild(this.top);
this.container.appendChild(this.middle);
this.container.appendChild(this.bottom);
//document.body.appendChild( this.container );
// Workaround bug in IE 5/6. We can not append anything to document body until
// full page load.
window.marker = this;
if (window.addEventListener)
window.addEventListener("load", new Function("document.body.appendChild( window.marker.container );"), false);
else if (window.attachEvent)
window.attachEvent("onload", new Function("document.body.appendChild( window.marker.container );"));
}
///////////////////////////////////////////////////////////////////////////////
// Outline class constructor
///////////////////////////////////////////////////////////////////////////////
function Outline()
{
this.tree = new TreeView();
this.mountPoint = null;
this.writeEnabled = false;
this.marker = new Marker();
this.classRegExp = new RegExp;
this.structRegExp = new RegExp;
this.enumRegExp = new RegExp;
this.templateRegExp = new RegExp;
this.aliasRegExp = new RegExp;
this.funcRegExp = new RegExp;
this.incSymbolLevel = function()
{
if (this.mountPoint == null)
this.mountPoint = this.tree.children[ 0 ];
else
this.mountPoint = this.mountPoint.lastChild();
}
this.decSymbolLevel = function()
{
// place icons near items according to extracted below type
for (var i = 0; i < this.mountPoint.children.length; ++i)
{
child = this.mountPoint.children[i];
var term = child.termRef;
// find first span node
var n = term.firstChild;
while (n && n.nodeName != "SPAN")
n = n.nextSibling;
if (!n) // shouldn't happen
continue;
var iconSrc;
if (n.firstChild.nodeName == "#text")
{
var text = n.firstChild.data; // text before declaration
if ( this.classRegExp.test(text) )
iconSrc = "candydoc/img/outline/class.gif";
else if ( this.structRegExp.test(text) )
iconSrc = "candydoc/img/outline/struct.gif";
else if ( this.enumRegExp.test(text) )
iconSrc = "candydoc/img/outline/enum.gif";
else if ( this.templateRegExp.test(text) )
iconSrc = "candydoc/img/outline/template.gif";
else if ( this.aliasRegExp.test(text) )
iconSrc = "candydoc/img/outline/alias.gif";
else // function or variable? check whether '(' ')' exists on the right
{
var np = n.firstChild;
while (np && np.nodeName != "SCRIPT") // find our script "onDecl"
np = np.nextSibling;
if (np && np.nextSibling && np.nextSibling.nodeName == "#text" &&
this.funcRegExp.test(np.nextSibling.data))
{
iconSrc = "candydoc/img/outline/func.gif";
}
else
iconSrc = "candydoc/img/outline/var.gif";
}
}
else // enum member ?
iconSrc = "candydoc/img/outline/var.gif";
child.icon.src = iconSrc;
child.icon.width = 16;
child.icon.height = 16;
}
this.mountPoint = this.mountPoint.parentNode;
}
this.addDecl = function(decl)
{
function getLastLeaf(elem)
{
if (elem.childNodes.length > 0)
return getLastLeaf(elem.lastChild);
else
return elem;
}
function getCurrentTerm()
{
var ret = getLastLeaf( document.getElementById("content") );
while (ret && ret.nodeName != "DT")
ret = ret.parentNode;
return ret;
}
if (this.writeEnabled)
{
var node = this.mountPoint.createChild(decl);
node.termRef = getCurrentTerm();
node.setOnclick( new Function("explorer.outline.mark(this.termRef);") );
}
}
this.mark = function(term)
{
this.marker.setTo(term);
window.scrollTo(0, getTop(term) - getWindowHeight() / 6);
}
this.classRegExp.compile("(.*\b)?class(\b.*)?");
this.structRegExp.compile("(.*\b)?struct(\b.*)?");
this.enumRegExp.compile("(.*\b)?enum(\b.*)?");
this.templateRegExp.compile("(.*\b)?template(\b.*)?");
this.aliasRegExp.compile("(.*\b)?alias(\b.*)?");
this.funcRegExp.compile(/.*\(.*/);
}
///////////////////////////////////////////////////////////////////////////////
// Package explorer class constructor
///////////////////////////////////////////////////////////////////////////////
function PackageExplorer()
{
this.tree = new TreeView(true);
this.addModule = function(mod)
{
var moduleIco = "candydoc/img/outline/module.gif";
var packageIco = "candydoc/img/outline/package.gif";
var path = mod.split("\.");
var node = this.tree.branch(path[0]);
if ( !node )
node = this.tree.createBranch(path[0], (path.length == 1) ? moduleIco : packageIco);
for (var i = 1; i < path.length; ++i)
{
var prev = node;
node = node.child(path[i]);
if (!node)
node = prev.createChild(path[i], (path.length == i + 1) ? moduleIco : packageIco);
if (path.length == i + 1)
node.setRef(path[i] + ".html");
}
}
}
///////////////////////////////////////////////////////////////////////////////
// Explorer class constructor
///////////////////////////////////////////////////////////////////////////////
function Explorer()
{
this.outline = new Outline();
this.packageExplorer = new PackageExplorer();
this.tabs = new Array();
this.tabCount = 0;
this.initialize = function(moduleName)
{
this.tabArea = document.getElementById("tabarea");
this.clientArea = document.getElementById("explorerclient");
// prevent text selection
this.tabArea.onmousedown = new Function("return false;");
this.tabArea.onclick = new Function("return true;");
this.tabArea.onselectstart = new Function("return false;");
this.clientArea.onmousedown = new Function("return false;");
this.clientArea.onclick = new Function("return true;");
this.clientArea.onselectstart = new Function("return false;");
this.outline.tree.createBranch( moduleName, "candydoc/img/outline/module.gif" );
// create tabs
this.createTab("Outline", this.outline.tree.domEntry);
this.createTab("Package", this.packageExplorer.tree.domEntry);
}
this.createTab = function(name, domEntry)
{
var tab = new Object();
this.tabs[name] = tab;
this.tabCount++;
tab.domEntry = domEntry;
tab.labelSpan = document.createElement("span");
if (this.tabCount > 1)
{
tab.labelSpan.className = "inactivetab";
tab.domEntry.style.display = "none";
}
else
{
tab.labelSpan.className = "activetab";
tab.domEntry.style.display = "";
}
tab.labelSpan.appendChild( document.createTextNode(name) );
tab.labelSpan.owner = this;
tab.labelSpan.onclick = new Function("this.owner.setSelection('" + name + "');");
this.tabArea.appendChild( tab.labelSpan );
this.clientArea.appendChild( domEntry );
}
this.setSelection = function(tabName)
{
for (name in this.tabs)
{
this.tabs[name].labelSpan.className = "inactivetab";
this.tabs[name].domEntry.style.display = "none";
}
this.tabs[tabName].labelSpan.className = "activetab";
this.tabs[tabName].domEntry.style.display = "";
}
}

View file

@ -0,0 +1,21 @@
/* This file is a part of CanDyDOC fileset.
File is written by Victor Nakoryakov and placed into the public domain.
This file is CSS to work around IE6 and earlier bugs. It's included just
in these browsers. */
/* Some magic to emulate unsupported "position: fixed" style. */
#tabarea
{
_position: absolute;
_top: expression(eval(document.body.scrollTop+8));
}
/* ditto */
#explorerclient
{
_position: absolute;
_top: expression(eval(document.body.scrollTop+24));
_height: expression(eval(document.body.clientHeight-48));
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 706 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

View file

@ -0,0 +1,4 @@
MODULES =
$(MODULE founDation)
$(MODULE enCurseD)
$(MODULE mmorlg)

View file

@ -0,0 +1,169 @@
/* This file is a part of CanDyDOC fileset.
File is written by Victor Nakoryakov and placed into the public domain.
This file is main CSS file of CanDyDOC. You may adjust some part of
parameters to control how result documentation would looks like. See
further documentation for details. */
/* This controls how background would looks like and
sets some document-scope defaults. */
body
{
/* These parameters control default font. */
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10pt;
color: #666666;
/* These control look of background. Note that you have to use
fixed background to keep documentation good-looking in
IE6 and earlier. Otherwise whole *explorer* will jerk while
scrolling. If you do not want to use background at all use
some invalid url, e.g. url(foo). */
background-color: #e6fcea;
background: url(img/bg.gif) fixed;
/* Don't touch. Necessary for IE6 and earlier. */
height: 100%;
}
/* Style applied to all tables. Actualy there are two: one table is
that contains contant and footer with CanDyDOC logo, and others
are that contains functions' parameters description. */
table
{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10pt;
color: #666666;
text-align: justify;
}
/* Style used for all hyperlinks. */
a:link { color: #009900; text-decoration: none }
a:visited { color: #009999; text-decoration: none }
a:hover { color: #0033cc; text-decoration: none }
a:active { color: #0033cc; text-decoration: none }
/*
table.matrix
{
border-left: double 3px #666666;
border-right: double 3px #666666;
margin-left: 3em;
}
*/
/* Style appled to declarations. E.g. 'void foo(int a, float b);' */
span.decl { font-size: 10pt; font-weight: bold; color: #000000; text-align: left }
/* Style appled to current declaration's symbol. E.g. 'foo' in 'void foo(int a, float b);' */
span.currsymbol { font-size: 12pt; color: #009900 }
/* Style appled to function's parameters. E.g. 'a' and 'b' in 'void foo(int a, float b);' */
span.funcparam { font-style: italic; font-weight: normal; color: #331200 }
/* Style for div that actualy contains documenation. */
#content
{
padding-right: 8px;
position: absolute;
left: 245px;
top: 8px;
text-align: justify;
}
/* Style for table that is inside div considered above. Contains documentaton
itself and footer with CanDyDOC logo. */
table.content
{
margin-bottom: 8px;
border-spacing: 0px;
border-collapse: collapse;
background-color: #ffffff;
}
/* Style for cell of above considered table that contains documentation itself. */
#docbody
{
padding: 8px 20px 8px 20px;
border: solid 1px #009900;
}
/* Style for cell that contains CanDyDOC logo. */
#docfooter
{
height: 16px;
background-color: #ddeedd;
padding: 0px 8px 0px 8px;
border: solid 1px #009900;
}
/* Style applied to currently active tab of explorer window. */
span.activetab
{
background-color: #0033cc;
border-top: solid 2px #009900;
color: #ffffff;
font-weight: bold;
padding-left: 4px;
padding-right: 4px;
padding-top: 1px;
margin-right: 1px;
}
/* Style applied to currently inactive tab of explorer window. */
span.inactivetab
{
background-color: #000066;
color: #cccccc;
font-weight: normal;
padding-left: 4px;
padding-right: 4px;
padding-top: 0px;
margin-right: 1px;
}
/* Style applied to div that contains tabs of explorer. Note that if
you want to change it's position you have to change position of
#explorerclient, #content and corresponding values in ie56hack.css */
#tabarea
{
position: fixed;
top: 8px;
width: 205px;
height: 16px;
cursor: default;
}
/* Style applied to div that contains tree in explorer. Note that if
you want to change it's position you have to change position of
#tabarea, #content and corresponding values in ie56hack.css */
#explorerclient
{
position: fixed;
top: 24px;
bottom: 8px;
width: 205px;
overflow: auto;
background-color: #fcfffc;
border: solid 2px #0033cc;
padding: 4px;
cursor: default;
color: Black;
}
/* Following 3 styles control appearance of marker that appears
if you click some entity in outline window. */
div.markertop { border-left: solid 2px #0033cc;}
div.markermiddle{ border-left: dotted 2px #0033cc;}
div.markerbottom{ border-left: dotted 2px #66cc66;}
/* Style applied to preformated text used to show examples. */
pre.d_code
{
border: dotted 1px #9c9;
background-color: #eeffee;
}

View file

@ -0,0 +1,374 @@
/* This file is a part of CanDyDOC fileset.
File is written by Victor Nakoryakov and placed into the public domain.
This file is javascript with classes that represents native style tree control. */
var pmNone = 0;
var pmPlus = 1;
var pmMinus = 2;
var hlNone = 0;
var hlGrey = 1;
var hlSelected = 2;
function TreeView(hrefMode)
{
this.domEntry = document.createElement("div");
this.children = new Array();
this.selection = null;
this.hrefMode = hrefMode;
this.createBranch = function(text, iconSrc)
{
var root = new TreeNode(text, iconSrc, this.hrefMode);
root.owner = this;
this.children[ this.children.length ] = root;
this.domEntry.appendChild( root.domEntry );
return root;
}
this.branch = function(text)
{
var ret = null;
for (var i = 0; i < this.children.length; ++i)
if (this.children[i].textElement.data == text)
{
ret = this.children[i];
break;
}
return ret;
}
this.domEntry.style.fontSize = "10px";
this.domEntry.style.cursor = "default";
this.domEntry.style.whiteSpace = "nowrap";
}
var idCounter = 0;
function TreeNode(text, iconSrc, hrefMode)
{
this.id = idCounter++;
this.parentNode = null;
this.children = new Array();
this.domEntry = document.createElement("div");
this.icon = document.createElement("img");
this.textElement = document.createTextNode(text);
this.textSpan = document.createElement("span");
this.lineDiv = document.createElement("div");
this.hierarchyImgs = new Array();
this.onclick = null;
function createIcon()
{
var img = document.createElement("img");
img.style.verticalAlign = "middle";
img.style.position = "relative";
img.style.top = "-1px";
img.width = 16;
img.height = 16;
return img;
}
function createHierarchyImage()
{
var img = createIcon();
img.pointsTop = false;
img.pointsBottom = false;
img.pointsRight = false;
img.pmState = pmNone;
return img;
}
function genHierarchyImageSrc(hierarchyImg)
{
var name = "";
if (hierarchyImg.pointsTop)
name += "t";
if (hierarchyImg.pointsBottom)
name += "b";
if (hierarchyImg.pointsRight)
name += "r";
if (hierarchyImg.pmState == pmPlus)
name += "p";
else if (hierarchyImg.pmState == pmMinus)
name += "m";
if (name == "")
name = "shim";
return "candydoc/img/tree/" + name + ".gif";
}
function setSrc(icon, src)
{
icon.src = src;
// After src change width and height are reseted in IE.
// Bug workaround:
icon.width = 16;
icon.height = 16;
}
this.createChild = function(text, iconSrc)
{
var child = new TreeNode(text, iconSrc, this.owner.hrefMode);
this.children[ this.children.length ] = child;
this.domEntry.appendChild( child.domEntry );
child.parentNode = this;
child.owner = this.owner;
// insert hierarchy images according to deepness level
// of created child.
if (this.children.length > 1)
{
// there were already added child before. So copy `level-1`
// hierarchy images from it.
var prevAddedChild = this.children[ this.children.length - 2 ];
for (var i = 0; i < prevAddedChild.hierarchyImgs.length - 1; ++i)
{
var prevAddedChildImg = prevAddedChild.hierarchyImgs[i];
var img = createHierarchyImage();
setSrc(img, prevAddedChildImg.src);
img.pointsTop = prevAddedChildImg.pointsTop;
img.pointsBottom = prevAddedChildImg.pointsBottom;
img.pointsRight = prevAddedChildImg.pointsRight;
img.pmState = prevAddedChildImg.pmState;
child.hierarchyImgs[ child.hierarchyImgs.length ] = img;
child.lineDiv.insertBefore(img, child.icon);
}
// change last hierarchy image of prevAddedChild from |_ to |-
var lastHierarchyImg = prevAddedChild.hierarchyImgs[ prevAddedChild.hierarchyImgs.length - 1 ];
lastHierarchyImg.pointsBottom = true;
setSrc(lastHierarchyImg, genHierarchyImageSrc(lastHierarchyImg));
// change hierarchy images of prevAddedChild's children on it's last
// level to |
prevAddedChild.addHierarchyTBLine(prevAddedChild.hierarchyImgs.length - 1);
}
else
{
// this is a first child. So copy `level-2`
// hierarchy images from parent, i.e. this.
for (var i = 0; i < this.hierarchyImgs.length - 1; ++i)
{
var parentImg = this.hierarchyImgs[i];
var img = createHierarchyImage();
setSrc(img, parentImg.src);
img.pointsTop = parentImg.pointsTop;
img.pointsBottom = parentImg.pointsBottom;
img.pointsRight = parentImg.pointsRight;
img.pmState = parentImg.pmState;
child.hierarchyImgs[ child.hierarchyImgs.length ] = img;
child.lineDiv.insertBefore(img, child.icon);
}
if (this.hierarchyImgs.length > 0) // we are not root
{
// change last hierarchy image of parent (i.e. this): add minus to it
var lastHierarchyImg = this.hierarchyImgs[ this.hierarchyImgs.length - 1];
lastHierarchyImg.pmState = pmMinus;
setSrc(lastHierarchyImg, genHierarchyImageSrc(lastHierarchyImg));
lastHierarchyImg.owner = this;
lastHierarchyImg.onclick = new Function("e", "this.owner.processPMClick(e);");
// make decision on image on `level-1`. It depends on parent's (ie this)
// image on same level.
var parentL1HierarchyImg = lastHierarchyImg;
var l1HierarchyImg = createHierarchyImage();
if (parentL1HierarchyImg.pointsBottom)
{
l1HierarchyImg.pointsTop = true;
l1HierarchyImg.pointsBottom = true;
}
setSrc(l1HierarchyImg, genHierarchyImageSrc(l1HierarchyImg));
child.hierarchyImgs[ child.hierarchyImgs.length ] = l1HierarchyImg;
child.lineDiv.insertBefore(l1HierarchyImg, child.icon);
}
}
// in any case on last level our child will have icon |_
var img = createHierarchyImage();
img.pointsTop = true;
img.pointsRight = true;
setSrc(img, genHierarchyImageSrc(img));
child.hierarchyImgs[ child.hierarchyImgs.length ] = img;
child.lineDiv.insertBefore(img, child.icon);
return child;
}
this.lastChild = function()
{
return this.children[ this.children.length - 1 ];
}
this.child = function(text)
{
var ret = null;
for (var i = 0; i < this.children.length; ++i)
if (this.children[i].textElement.data == text)
{
ret = this.children[i];
break;
}
return ret;
}
this.addHierarchyTBLine = function(level)
{
for (var i = 0; i < this.children.length; ++i)
{
var img = this.children[i].hierarchyImgs[level];
img.pointsTop = true;
img.pointsBottom = true;
setSrc(img, genHierarchyImageSrc(img));
this.children[i].addHierarchyTBLine(level);
}
}
this.expand = function()
{
var img = this.hierarchyImgs[ this.hierarchyImgs.length - 1 ];
if (img.pmState == pmPlus)
{
img.pmState = pmMinus;
setSrc(img, genHierarchyImageSrc(img));
for (var i = 0; i < this.children.length; ++i)
this.children[i].domEntry.style.display = "";
}
}
this.collapse = function()
{
var img = this.hierarchyImgs[ this.hierarchyImgs.length - 1 ];
if (img.pmState == pmMinus)
{
img.pmState = pmPlus;
setSrc(img, genHierarchyImageSrc(img));
for (var i = 0; i < this.children.length; ++i)
this.children[i].domEntry.style.display = "none";
}
}
this.toggle = function()
{
var img = this.hierarchyImgs[ this.hierarchyImgs.length - 1 ];
if (img.pmState == pmMinus)
this.collapse();
else
this.expand();
}
this.select = function()
{
if (this.owner.selection != this)
{
if (this.owner.selection)
this.owner.selection.setHighlight(hlNone);
this.owner.selection = this;
this.setHighlight(hlSelected);
}
}
this.setHighlight = function(mode)
{
if (mode == hlNone)
{
this.textSpan.style.backgroundColor = "";
this.textSpan.style.color = "";
this.textSpan.style.border = "";
}
else if (mode == hlGrey)
{
this.textSpan.style.backgroundColor = "#aaaaaa";
this.textSpan.style.color = "";
this.textSpan.style.border = "";
}
else if (mode == hlSelected)
{
this.textSpan.style.backgroundColor = "3399cc";
this.textSpan.style.color = "white";
this.textSpan.style.border = "dotted 1px red";
}
}
this.setOnclick = function(proc)
{
this.onclick = proc;
}
this.setRef = function(url)
{
if (this.anchor)
this.anchor.href = url;
}
this.processPMClick = function(e)
{
this.toggle();
// prevent this line selection, stop bubbling
if (e)
e.stopPropagation(); // Mozilla way
if (window.event)
window.event.cancelBubble = true; // IE way
}
this.processOnclick = function()
{
this.select();
if (this.onclick instanceof Function)
this.onclick();
}
///////////////////////////////////////////////////////////////////////////
if (iconSrc)
this.icon.src = iconSrc;
else
{
this.icon.width = 0;
this.icon.height = 0;
}
this.icon.style.verticalAlign = "middle";
this.icon.style.position = "relative";
this.icon.style.top = "-1px";
this.icon.style.paddingRight = "2px";
if (!hrefMode)
{
this.textSpan.appendChild( this.textElement );
}
else
{
this.anchor = document.createElement("a");
this.anchor.appendChild( this.textElement );
this.textSpan.appendChild( this.anchor );
}
this.lineDiv.appendChild( this.icon );
this.lineDiv.appendChild( this.textSpan );
this.domEntry.appendChild( this.lineDiv );
this.lineDiv.owner = this;
if (!hrefMode)
this.lineDiv.onclick = new Function("this.owner.processOnclick();");
}

View file

@ -0,0 +1,41 @@
/* This file is a part of CanDyDOC fileset.
File is written by Victor Nakoryakov and placed into the public domain.
This file is javascript with cross-browser utility functions. */
function getLeft(elem)
{
var ret = 0;
while (elem.offsetParent)
{
ret += elem.offsetLeft;
elem = elem.offsetParent;
}
return ret;
}
function getTop(elem)
{
var ret = 0;
while (elem.offsetParent)
{
ret += elem.offsetTop;
elem = elem.offsetParent;
}
return ret;
}
function getWindowHeight()
{
var ret = 0;
if (typeof(window.innerHeight) == "number")
ret = window.innerHeight;
else if (document.documentElement && document.documentElement.clientHeight)
ret = document.documentElement.clientHeight;
else if (document.body && document.body.clientHeight)
ret = document.body.clientHeight;
return ret;
}

View file

@ -0,0 +1,45 @@
#
# CMakeD - CMake module for D Language
#
# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>
# Tim Burrell <tim.burrell@gmail.com>
#
# All rights reserved.
#
# See Copyright.txt for details.
#
# Modified from CMake 2.6.5 CMakeCCompiler.cmake.in
# See http://www.cmake.org/HTML/Copyright.html for details
#
SET(CMAKE_D_COMPILER "@CMAKE_D_COMPILER@")
SET(CMAKE_D_COMPILER_ARG1 "@CMAKE_D_COMPILER_ARG1@")
SET(CMAKE_AR "@CMAKE_AR@")
SET(CMAKE_RANLIB "@CMAKE_RANLIB@")
SET(CMAKE_COMPILER_IS_GDC @CMAKE_COMPILER_IS_GDC@)
SET(CMAKE_COMPILER_IS_DMD @CMAKE_COMPILER_IS_DMD@)
SET(CMAKE_D_COMPILER_LOADED 1)
SET(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@)
SET(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@)
IF(CMAKE_COMPILER_IS_CYGWIN)
SET(CYGWIN 1)
SET(UNIX 1)
ENDIF(CMAKE_COMPILER_IS_CYGWIN)
SET(CMAKE_D_COMPILER_ENV_VAR "DC")
IF(CMAKE_COMPILER_IS_MINGW)
SET(MINGW 1)
ENDIF(CMAKE_COMPILER_IS_MINGW)
SET(CMAKE_COMPILER_IS_GDC_RUN 1)
SET(CMAKE_D_SOURCE_FILE_EXTENSIONS d)
SET(CMAKE_D_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
SET(CMAKE_D_LINKER_PREFERENCE None)
IF(UNIX)
SET(CMAKE_D_OUTPUT_EXTENSION .o)
ELSE(UNIX)
SET(CMAKE_D_OUTPUT_EXTENSION .obj)
ENDIF(UNIX)
# save the size of void* in case where cache is removed
# and the this file is still around
#SET(CMAKE_SIZEOF_VOID_P @CMAKE_SIZEOF_VOID_P@)

View file

@ -0,0 +1,237 @@
#
# CMakeD - CMake module for D Language
#
# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>
# Tim Burrell <tim.burrell@gmail.com>
#
# All rights reserved.
#
# See Copyright.txt for details.
#
# Modified from CMake 2.6.5 CMakeCInformation.cmake
# See http://www.cmake.org/HTML/Copyright.html for details
#
# This file sets the basic flags for the D language in CMake.
# It also loads the available platform file for the system-compiler
# if it exists.
GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_D_COMPILER} NAME_WE)
IF(CMAKE_COMPILER_IS_GDC)
SET(CMAKE_BASE_NAME gdc)
ELSE(CMAKE_COMPILER_IS_GDC)
SET(CMAKE_BASE_NAME dmd)
ENDIF(CMAKE_COMPILER_IS_GDC)
SET(CMAKE_SYSTEM_AND_D_COMPILER_INFO_FILE
${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)
INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)
# This should be included before the _INIT variables are
# used to initialize the cache. Since the rule variables
# have if blocks on them, users can still define them here.
# But, it should still be after the platform file so changes can
# be made to those values.
IF(CMAKE_USER_MAKE_RULES_OVERRIDE)
INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE})
ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE)
IF(CMAKE_USER_MAKE_RULES_OVERRIDE_D)
INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_D})
ENDIF(CMAKE_USER_MAKE_RULES_OVERRIDE_D)
# for most systems a module is the same as a shared library
# so unless the variable CMAKE_MODULE_EXISTS is set just
# copy the values from the LIBRARY variables
IF(NOT CMAKE_MODULE_EXISTS)
SET(CMAKE_SHARED_MODULE_D_FLAGS ${CMAKE_SHARED_LIBRARY_D_FLAGS})
SET(CMAKE_SHARED_MODULE_CREATE_D_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS})
ENDIF(NOT CMAKE_MODULE_EXISTS)
SET (CMAKE_D_FLAGS "$ENV{CFLAGS} ${CMAKE_D_FLAGS_INIT}" CACHE STRING
"Flags for D compiler.")
IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
# default build type is none
IF(NOT CMAKE_NO_BUILD_TYPE)
SET (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING
"Choose the type of build, options are: None(CMAKE_D_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
ENDIF(NOT CMAKE_NO_BUILD_TYPE)
SET (CMAKE_D_FLAGS_DEBUG "${CMAKE_D_FLAGS_DEBUG_INIT}" CACHE STRING
"Flags used by the compiler during debug builds.")
SET (CMAKE_D_FLAGS_MINSIZEREL "${CMAKE_D_FLAGS_MINSIZEREL_INIT}" CACHE STRING
"Flags used by the compiler during release minsize builds.")
SET (CMAKE_D_FLAGS_RELEASE "${CMAKE_D_FLAGS_RELEASE_INIT}" CACHE STRING
"Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).")
SET (CMAKE_D_FLAGS_RELWITHDEBINFO "${CMAKE_D_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING
"Flags used by the compiler during Release with Debug Info builds.")
ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
IF(CMAKE_D_STANDARD_LIBRARIES_INIT)
SET(CMAKE_D_STANDARD_LIBRARIES "${CMAKE_D_STANDARD_LIBRARIES_INIT}"
CACHE STRING "Libraries linked by defalut with all D applications.")
MARK_AS_ADVANCED(CMAKE_D_STANDARD_LIBRARIES)
ENDIF(CMAKE_D_STANDARD_LIBRARIES_INIT)
INCLUDE(CMakeCommonLanguageInclude)
# now define the following rule variables
# CMAKE_D_CREATE_SHARED_LIBRARY
# CMAKE_D_CREATE_SHARED_MODULE
# CMAKE_D_CREATE_STATIC_LIBRARY
# CMAKE_D_COMPILE_OBJECT
# CMAKE_D_LINK_EXECUTABLE
# variables supplied by the generator at use time
# <TARGET>
# <TARGET_BASE> the target without the suffix
# <OBJECTS>
# <OBJECT>
# <LINK_LIBRARIES>
# <FLAGS>
# <LINK_FLAGS>
# D compiler information
# <CMAKE_D_COMPILER>
# <CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS>
# <CMAKE_SHARED_MODULE_CREATE_D_FLAGS>
# <CMAKE_D_LINK_FLAGS>
# Static library tools
# <CMAKE_AR>
# <CMAKE_RANLIB>
IF("$ENV{D_PATH}" STREQUAL "")
STRING(LENGTH ${CMAKE_D_COMPILER} CMAKE_D_COMPILER_LENGTH)
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
MATH(EXPR CMAKE_D_COMPILER_LENGTH "${CMAKE_D_COMPILER_LENGTH} - 12")
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
MATH(EXPR CMAKE_D_COMPILER_LENGTH "${CMAKE_D_COMPILER_LENGTH} - 8")
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
STRING(SUBSTRING ${CMAKE_D_COMPILER} 0 ${CMAKE_D_COMPILER_LENGTH} D_PATH)
ELSE("$ENV{D_PATH}" STREQUAL "")
SET(D_PATH "$ENV{D_PATH}")
ENDIF("$ENV{D_PATH}" STREQUAL "")
MESSAGE(STATUS "D Compiler Install Prefix (use D_PATH env var to override): ${D_PATH}")
IF(CMAKE_COMPILER_IS_GDC)
SET(CMAKE_OUTPUT_D_FLAG "-o ")
SET(CMAKE_SHARED_LIBRARY_D_FLAGS "-fPIC")
SET(CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS "-shared")
SET(CMAKE_INCLUDE_FLAG_D "-I") # -I
SET(CMAKE_INCLUDE_FLAG_D_SEP "") # , or empty
SET(CMAKE_LIBRARY_PATH_FLAG "-L")
SET(CMAKE_LINK_LIBRARY_FLAG "-l")
SET(CMAKE_D_VERSION_FLAG "-fversion=")
ELSE(CMAKE_COMPILER_IS_GDC)
SET(CMAKE_OUTPUT_D_FLAG "-of")
SET(CMAKE_D_VERSION_FLAG "-version=")
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
SET(CMAKE_INCLUDE_FLAG_D "-I") # -I
SET(CMAKE_INCLUDE_FLAG_D_SEP "") # , or empty
SET(CMAKE_LINK_LIBRARY_FLAG "-L+")
SET(CMAKE_LIBRARY_PATH_FLAG "-L+")
SET(CMAKE_LIBRARY_PATH_TERMINATOR "\\")
FIND_PROGRAM(DMD_LIBRARIAN "lib.exe")
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
SET(CMAKE_SHARED_LIBRARY_D_FLAGS "-fPIC")
SET(CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS "-shared")
SET(CMAKE_INCLUDE_FLAG_D "-I") # -I
SET(CMAKE_INCLUDE_FLAG_D_SEP "") # , or empty
SET(CMAKE_LIBRARY_PATH_FLAG "-L")
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
ENDIF(CMAKE_COMPILER_IS_GDC)
IF(CMAKE_D_USE_TANGO)
IF(CMAKE_COMPILER_IS_GDC)
SET(DSTDLIB_TYPE "-fversion=Tango")
SET(DSTDLIB_FLAGS "-lgtango")
ELSE(CMAKE_COMPILER_IS_GDC)
SET(DSTDLIB_TYPE "-version=Tango")
SET(DSTDLIB_FLAGS "-L${D_PATH}/lib -ltango -lphobos")
ENDIF(CMAKE_COMPILER_IS_GDC)
ENDIF(CMAKE_D_USE_TANGO)
IF(CMAKE_D_USE_PHOBOS)
IF(CMAKE_COMPILER_IS_GDC)
SET(DSTDLIB_TYPE "-fversion=Phobos")
SET(DSTDLIB_FLAGS "-lgphobos")
ELSE(CMAKE_COMPILER_IS_GDC)
SET(DSTDLIB_TYPE "-version=Phobos")
SET(DSTDLIB_FLAGS "-L${D_PATH}/lib -lphobos")
ENDIF(CMAKE_COMPILER_IS_GDC)
ENDIF(CMAKE_D_USE_PHOBOS)
# create a D shared library
IF(NOT CMAKE_D_CREATE_SHARED_LIBRARY)
IF(CMAKE_COMPILER_IS_GDC)
SET(CMAKE_D_CREATE_SHARED_LIBRARY
"<CMAKE_D_COMPILER> <CMAKE_SHARED_LIBRARY_D_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_D_FLAG><TARGET_SONAME> ${CMAKE_OUTPUT_D_FLAG}<TARGET> <OBJECTS> <LINK_LIBRARIES>")
ELSE(CMAKE_COMPILER_IS_GDC)
SET(CMAKE_D_CREATE_SHARED_LIBRARY
"<CMAKE_D_COMPILER> <CMAKE_SHARED_LIBRARY_D_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_D_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_D_FLAG><TARGET_SONAME> ${CMAKE_OUTPUT_D_FLAG}<TARGET> <OBJECTS> <LINK_LIBRARIES> ${DSTDLIB_FLAGS}")
ENDIF(CMAKE_COMPILER_IS_GDC)
ENDIF(NOT CMAKE_D_CREATE_SHARED_LIBRARY)
# create a D shared module just copy the shared library rule
IF(NOT CMAKE_D_CREATE_SHARED_MODULE)
SET(CMAKE_D_CREATE_SHARED_MODULE ${CMAKE_D_CREATE_SHARED_LIBRARY})
ENDIF(NOT CMAKE_D_CREATE_SHARED_MODULE)
# create a D static library
IF(NOT CMAKE_D_CREATE_STATIC_LIBRARY)
IF(CMAKE_COMPILER_IS_GDC)
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
SET(CMAKE_D_CREATE_STATIC_LIBRARY
"<CMAKE_AR> cr <TARGET>.lib <LINK_FLAGS> <OBJECTS> "
"<CMAKE_RANLIB> <TARGET>.lib "
"<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> "
"<CMAKE_RANLIB> <TARGET> "
)
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
SET(CMAKE_D_CREATE_STATIC_LIBRARY
"<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS> "
"<CMAKE_RANLIB> <TARGET> "
)
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
ELSE(CMAKE_COMPILER_IS_GDC)
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
SET(CMAKE_D_CREATE_STATIC_LIBRARY
"<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>"
"<CMAKE_RANLIB> <TARGET>")
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
SET(CMAKE_D_CREATE_STATIC_LIBRARY
"${DMD_LIBRARIAN} -c -p256 <TARGET> <OBJECTS>")
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
ENDIF(CMAKE_COMPILER_IS_GDC)
ENDIF(NOT CMAKE_D_CREATE_STATIC_LIBRARY)
# compile a D file into an object file
IF(NOT CMAKE_D_COMPILE_OBJECT)
SET(CMAKE_D_COMPILE_OBJECT
"<CMAKE_D_COMPILER> <FLAGS> ${CMAKE_OUTPUT_D_FLAG}<OBJECT> -c <SOURCE>")
ENDIF(NOT CMAKE_D_COMPILE_OBJECT)
IF(NOT CMAKE_D_LINK_EXECUTABLE)
IF(CMAKE_COMPILER_IS_GDC)
SET(CMAKE_D_LINK_EXECUTABLE
"<CMAKE_D_COMPILER> <FLAGS> <CMAKE_D_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> ${CMAKE_OUTPUT_D_FLAG}<TARGET> <LINK_LIBRARIES> ${DSTDLIB_FLAGS} ${DSTDLIB_TYPE}")
ELSE(CMAKE_COMPILER_IS_GDC)
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
SET(CMAKE_D_LINK_EXECUTABLE
"gcc ${DLINK_FLAGS} <CMAKE_D_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -lpthread -lm ${DSTDLIB_FLAGS}")
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
SET(CMAKE_D_LINK_EXECUTABLE
"<CMAKE_D_COMPILER> <FLAGS> <CMAKE_D_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> ${CMAKE_OUTPUT_D_FLAG}<TARGET> <LINK_LIBRARIES>")
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
ENDIF(CMAKE_COMPILER_IS_GDC)
ENDIF(NOT CMAKE_D_LINK_EXECUTABLE)
MARK_AS_ADVANCED(
CMAKE_D_FLAGS
CMAKE_D_FLAGS_DEBUG
CMAKE_D_FLAGS_MINSIZEREL
CMAKE_D_FLAGS_RELEASE
CMAKE_D_FLAGS_RELWITHDEBINFO
)
SET(CMAKE_D_INFORMATION_LOADED 1)

View file

@ -0,0 +1,108 @@
#
# CMakeD - CMake module for D Language
#
# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>
# Tim Burrell <tim.burrell@gmail.com>
#
# All rights reserved.
#
# See Copyright.txt for details.
#
# Modified from CMake 2.6.5 CMakeDetermineCCompiler.cmake
# See http://www.cmake.org/HTML/Copyright.html for details
#
# determine the compiler to use for D programs
# NOTE, a generator may set CMAKE_D_COMPILER before
# loading this file to force a compiler.
# use environment variable DC first if defined by user, next use
# the cmake variable CMAKE_GENERATOR_D which can be defined by a generator
# as a default compiler
IF(NOT CMAKE_D_COMPILER)
# prefer the environment variable DC
IF($ENV{DC} MATCHES ".+")
GET_FILENAME_COMPONENT(CMAKE_D_COMPILER_INIT $ENV{DC} PROGRAM PROGRAM_ARGS CMAKE_D_FLAGS_ENV_INIT)
IF(CMAKE_D_FLAGS_ENV_INIT)
SET(CMAKE_D_COMPILER_ARG1 "${CMAKE_D_FLAGS_ENV_INIT}" CACHE STRING "First argument to D compiler")
ENDIF(CMAKE_D_FLAGS_ENV_INIT)
IF(EXISTS ${CMAKE_D_COMPILER_INIT})
ELSE(EXISTS ${CMAKE_D_COMPILER_INIT})
MESSAGE(FATAL_ERROR "Could not find compiler set in environment variable C:\n$ENV{DC}.")
ENDIF(EXISTS ${CMAKE_D_COMPILER_INIT})
ENDIF($ENV{DC} MATCHES ".+")
# next try prefer the compiler specified by the generator
IF(CMAKE_GENERATOR_D)
IF(NOT CMAKE_D_COMPILER_INIT)
SET(CMAKE_D_COMPILER_INIT ${CMAKE_GENERATOR_D})
ENDIF(NOT CMAKE_D_COMPILER_INIT)
ENDIF(CMAKE_GENERATOR_D)
# finally list compilers to try
IF(CMAKE_D_COMPILER_INIT)
SET(CMAKE_D_COMPILER_LIST ${CMAKE_D_COMPILER_INIT})
ELSE(CMAKE_D_COMPILER_INIT)
SET(CMAKE_D_COMPILER_LIST gdc dmd)
ENDIF(CMAKE_D_COMPILER_INIT)
# Find the compiler.
FIND_PROGRAM(CMAKE_D_COMPILER NAMES ${CMAKE_D_COMPILER_LIST} DOC "C compiler")
IF(CMAKE_D_COMPILER_INIT AND NOT CMAKE_D_COMPILER)
SET(CMAKE_D_COMPILER "${CMAKE_D_COMPILER_INIT}" CACHE FILEPATH "C compiler" FORCE)
ENDIF(CMAKE_D_COMPILER_INIT AND NOT CMAKE_D_COMPILER)
ENDIF(NOT CMAKE_D_COMPILER)
MARK_AS_ADVANCED(CMAKE_D_COMPILER)
GET_FILENAME_COMPONENT(COMPILER_LOCATION "${CMAKE_D_COMPILER}" PATH)
FIND_PROGRAM(CMAKE_AR NAMES ar PATHS ${COMPILER_LOCATION} )
FIND_PROGRAM(CMAKE_RANLIB NAMES ranlib)
IF(NOT CMAKE_RANLIB)
SET(CMAKE_RANLIB : CACHE INTERNAL "noop for ranlib")
ENDIF(NOT CMAKE_RANLIB)
MARK_AS_ADVANCED(CMAKE_RANLIB)
# do not test for GNU if the generator is visual studio
IF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
SET(CMAKE_COMPILER_IS_GDC_RUN 1)
ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
IF(NOT CMAKE_COMPILER_IS_GDC_RUN)
# test to see if the d compiler is gdc
SET(CMAKE_COMPILER_IS_GDC_RUN 1)
IF("${CMAKE_D_COMPILER}" MATCHES ".*gdc.*" )
SET(CMAKE_COMPILER_IS_GDC 1)
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the D compiler is GDC succeeded with "
"the following output:\n${CMAKE_D_COMPILER}\n\n")
EXEC_PROGRAM(${CMAKE_D_COMPILER} ARGS "--version" OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT)
IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*mingw.*" )
SET(CMAKE_COMPILER_IS_MINGW 1)
ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*mingw.*" )
IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" )
SET(CMAKE_COMPILER_IS_CYGWIN 1)
ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" )
ELSE("${CMAKE_D_COMPILER}" MATCHES ".*dmd.*" )
SET(CMAKE_COMPILER_IS_DMD 1)
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the D compiler is DMD succeeded with "
"the following output:\n${CMAKE_D_COMPILER}\n\n")
ENDIF("${CMAKE_D_COMPILER}" MATCHES ".*gdc.*" )
ENDIF(NOT CMAKE_COMPILER_IS_GDC_RUN)
# configure variables set in this file for fast reload later on
IF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in
"${CMAKE_PLATFORM_ROOT_BIN}/CMakeDCompiler.cmake" IMMEDIATE)
ELSE(EXISTS ${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in)
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeDCompiler.cmake.in
"${CMAKE_PLATFORM_ROOT_BIN}/CMakeDCompiler.cmake" IMMEDIATE)
ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in)
MARK_AS_ADVANCED(CMAKE_AR)
SET(CMAKE_D_COMPILER_ENV_VAR "DC")

View file

@ -0,0 +1,175 @@
#
# CMakeD - CMake module for D Language
#
# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>
# Tim Burrell <tim.burrell@gmail.com>
#
# All rights reserved.
#
# See Copyright.txt for details.
#
# Modified from CMake 2.6.5 CMakeTestCCompiler.cmake
# See http://www.cmake.org/HTML/Copyright.html for details
#
# This file is used by EnableLanguage in cmGlobalGenerator to
# determine that that selected D compiler can actually compile
# and link the most basic of programs. If not, a fatal error
# is set and cmake stops processing commands and will not generate
# any makefiles or projects.
IF(NOT CMAKE_D_COMPILER_WORKS)
MESSAGE(STATUS "Check for working D compiler: ${CMAKE_D_COMPILER}")
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
"int main(char[][] args)\n"
"{return args.sizeof-1;}\n")
STRING(REGEX MATCH "dmd" DMDTEST "${CMAKE_D_COMPILER}")
IF(DMDTEST STREQUAL "dmd")
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
TRY_COMPILE(CMAKE_D_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
OUTPUT_VARIABLE OUTPUT)
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
TRY_COMPILE(CMAKE_D_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
CMAKE_FLAGS "-DLINK_LIBRARIES=${D_PATH}/lib/libphobos.a"
OUTPUT_VARIABLE OUTPUT)
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
ELSE(DMDTEST STREQUAL "dmd")
TRY_COMPILE(CMAKE_D_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
OUTPUT_VARIABLE OUTPUT)
ENDIF(DMDTEST STREQUAL "dmd")
SET(C_TEST_WAS_RUN 1)
ENDIF(NOT CMAKE_D_COMPILER_WORKS)
IF(NOT CMAKE_D_COMPILER_WORKS)
MESSAGE(STATUS "Check for working D compiler: ${CMAKE_D_COMPILER} -- broken")
message(STATUS "To force a specific D compiler set the DC environment variable")
message(STATUS " ie - export DC=\"/opt/dmd/bin/dmd\"")
message(STATUS "If the D path is not set please use the D_PATH variable")
message(STATUS " ie - export D_PATH=\"/opt/dmd\"")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if the D compiler works failed with "
"the following output:\n${OUTPUT}\n\n")
MESSAGE(FATAL_ERROR "The D compiler \"${CMAKE_D_COMPILER}\" "
"is not able to compile a simple test program.\nIt fails "
"with the following output:\n ${OUTPUT}\n\n"
"CMake will not be able to correctly generate this project.")
ELSE(NOT CMAKE_D_COMPILER_WORKS)
IF(C_TEST_WAS_RUN)
MESSAGE(STATUS "Check for working D compiler: ${CMAKE_D_COMPILER} -- works")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if the D compiler works passed with "
"the following output:\n${OUTPUT}\n\n")
ENDIF(C_TEST_WAS_RUN)
SET(CMAKE_D_COMPILER_WORKS 1 CACHE INTERNAL "")
# re-configure this file CMakeDCompiler.cmake so that it gets
# the value for CMAKE_SIZEOF_VOID_P
# configure variables set in this file for fast reload later on
IF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeDCompiler.cmake IMMEDIATE)
ELSE(EXISTS ${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in)
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeDCompiler.cmake.in
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeDCompiler.cmake IMMEDIATE)
ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/Modules/CMakeDCompiler.cmake.in)
ENDIF(NOT CMAKE_D_COMPILER_WORKS)
IF(NOT CMAKE_D_PHOBOS_WORKS)
MESSAGE(STATUS "Check for working Phobos")
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
"import std.stdio;\n"
"int main(char[][] args)\n"
"{ writefln(\"%s\", args[0]); return args.sizeof-1;}\n")
IF(CMAKE_COMPILER_IS_GDC)
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
TRY_COMPILE(CMAKE_D_PHOBOS_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
#CMAKE_FLAGS "-DLINK_LIBRARIES=gphobos"
OUTPUT_VARIABLE OUTPUT)
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
TRY_COMPILE(CMAKE_D_PHOBOS_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
CMAKE_FLAGS "-DLINK_LIBRARIES=gphobos"
OUTPUT_VARIABLE OUTPUT)
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
ELSE(CMAKE_COMPILER_IS_GDC)
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
TRY_COMPILE(CMAKE_D_PHOBOS_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
OUTPUT_VARIABLE OUTPUT)
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
TRY_COMPILE(CMAKE_D_PHOBOS_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
CMAKE_FLAGS "-DLINK_LIBRARIES=${D_PATH}/lib/libphobos.a"
COMPILE_DEFINITIONS "-I${D_PATH}/include -I${D_PATH}/import"
OUTPUT_VARIABLE OUTPUT)
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
ENDIF(CMAKE_COMPILER_IS_GDC)
SET(C_TEST_WAS_RUN 1)
ENDIF(NOT CMAKE_D_PHOBOS_WORKS)
IF(NOT CMAKE_D_PHOBOS_WORKS)
MESSAGE(STATUS "Check for working Phobos -- unavailable")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if Phobos works failed with "
"the following output:\n${OUTPUT}\n\n")
#MESSAGE(FATAL_ERROR "Phobos does not work")
ELSE(NOT CMAKE_D_PHOBOS_WORKS)
IF(C_TEST_WAS_RUN)
MESSAGE(STATUS "Check for working Phobos -- works")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if Phobos works passed with "
"the following output:\n${OUTPUT}\n\n")
ENDIF(C_TEST_WAS_RUN)
SET(CMAKE_D_PHOBOS_WORKS 1 CACHE INTERNAL "")
ENDIF(NOT CMAKE_D_PHOBOS_WORKS)
IF(NOT CMAKE_D_TANGO_WORKS)
MESSAGE(STATUS "Check for working Tango")
FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
"import tango.io.Stdout;"
"int main(char[][] args)\n"
"{Stdout.newline();return args.sizeof-1;}\n")
IF(CMAKE_COMPILER_IS_GDC)
TRY_COMPILE(CMAKE_D_TANGO_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
CMAKE_FLAGS "-DLINK_LIBRARIES=gtango"
OUTPUT_VARIABLE OUTPUT)
ELSE(CMAKE_COMPILER_IS_GDC)
IF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
TRY_COMPILE(CMAKE_D_TANGO_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
OUTPUT_VARIABLE OUTPUT)
ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
TRY_COMPILE(CMAKE_D_TANGO_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testDCompiler.d
CMAKE_FLAGS "-DLINK_LIBRARIES=${D_PATH}/lib/libtango.a;${D_PATH}/lib/libphobos.a"
COMPILE_DEFINITIONS "-I${D_PATH}/include -I${D_PATH}/import"
OUTPUT_VARIABLE OUTPUT)
ENDIF(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
ENDIF(CMAKE_COMPILER_IS_GDC)
SET(C_TEST_WAS_RUN 1)
ENDIF(NOT CMAKE_D_TANGO_WORKS)
IF(NOT CMAKE_D_TANGO_WORKS)
MESSAGE(STATUS "Check for working Tango -- unavailable")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining if Tango works failed with "
"the following output:\n${OUTPUT}\n\n")
#MESSAGE(FATAL_ERROR "Tango does not work: \n${OUTPUT}\n\n")
ELSE(NOT CMAKE_D_TANGO_WORKS)
IF(C_TEST_WAS_RUN)
MESSAGE(STATUS "Check for working Tango -- works")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determining if Tango works passed with "
"the following output:\n${OUTPUT}\n\n")
ENDIF(C_TEST_WAS_RUN)
SET(CMAKE_D_TANGO_WORKS 1 CACHE INTERNAL "")
ENDIF(NOT CMAKE_D_TANGO_WORKS)
# if both tango and phobos are selected try to choose which one is available
IF(CMAKE_D_USE_TANGO AND CMAKE_D_USE_PHOBOS)
MESSAGE(FATAL_ERROR "Tango AND Phobos selected, please choose one or the other!")
ENDIF(CMAKE_D_USE_TANGO AND CMAKE_D_USE_PHOBOS)
# ensure the user has the appropriate std lib available
IF(CMAKE_D_USE_TANGO AND NOT CMAKE_D_TANGO_WORKS)
MESSAGE(FATAL_ERROR "Tango is required for this project, but it is not available!")
ENDIF(CMAKE_D_USE_TANGO AND NOT CMAKE_D_TANGO_WORKS)
IF(CMAKE_D_USE_PHOBOS AND NOT CMAKE_D_PHOBOS_WORKS)
MESSAGE(FATAL_ERROR "Phobos is required for this project, but it is not available!")
ENDIF(CMAKE_D_USE_PHOBOS AND NOT CMAKE_D_PHOBOS_WORKS)

View file

@ -0,0 +1,58 @@
# This file will be configured to contain variables for CPack. These variables
# should be set in the CMake list file of the project before CPack module is
# included. Example variables are:
# CPACK_GENERATOR - Generator used to create package
# CPACK_INSTALL_CMAKE_PROJECTS - For each project (path, name, component)
# CPACK_CMAKE_GENERATOR - CMake Generator used for the projects
# CPACK_INSTALL_COMMANDS - Extra commands to install components
# CPACK_INSTALL_DIRECTORIES - Extra directories to install
# CPACK_PACKAGE_DESCRIPTION_FILE - Description file for the package
# CPACK_PACKAGE_DESCRIPTION_SUMMARY - Summary of the package
# CPACK_PACKAGE_EXECUTABLES - List of pairs of executables and labels
# CPACK_PACKAGE_FILE_NAME - Name of the package generated
# CPACK_PACKAGE_ICON - Icon used for the package
# CPACK_PACKAGE_INSTALL_DIRECTORY - Name of directory for the installer
# CPACK_PACKAGE_NAME - Package project name
# CPACK_PACKAGE_VENDOR - Package project vendor
# CPACK_PACKAGE_VERSION - Package project version
# CPACK_PACKAGE_VERSION_MAJOR - Package project version (major)
# CPACK_PACKAGE_VERSION_MINOR - Package project version (minor)
# CPACK_PACKAGE_VERSION_PATCH - Package project version (patch)
# There are certain generator specific ones
# NSIS Generator:
# CPACK_PACKAGE_INSTALL_REGISTRY_KEY - Name of the registry key for the installer
# CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS - Extra commands used during uninstall
# CPACK_NSIS_EXTRA_INSTALL_COMMANDS - Extra commands used during install
SET(CPACK_CMAKE_GENERATOR "Unix Makefiles")
SET(CPACK_GENERATOR "TGZ;TBZ2;ZIP")
SET(CPACK_INSTALL_CMAKE_PROJECTS "/home/tim/projects/mmorlg.D/cmake/Modules;mmorlg;ALL;/")
SET(CPACK_MODULE_PATH "/home/tim/projects/mmorlg.D/cmake/Modules")
SET(CPACK_NSIS_DISPLAY_NAME "mmorlg 0.1.0")
SET(CPACK_OUTPUT_CONFIG_FILE "/home/tim/projects/mmorlg.D/cmake/Modules/CPackConfig.cmake")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "/home/tim/projects/mmorlg.D/README")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "mmorlg")
SET(CPACK_PACKAGE_EXECUTABLES "mmorlg;mmorlg")
SET(CPACK_PACKAGE_FILE_NAME "mmorlg-0.1-linux-i686")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "mmorlg 0.1.0")
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "mmorlg 0.1.0")
SET(CPACK_PACKAGE_NAME "mmorlg")
SET(CPACK_PACKAGE_VENDOR "mmorlg")
SET(CPACK_PACKAGE_VERSION "0.1.0")
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
SET(CPACK_PACKAGE_VERSION_MINOR "1")
SET(CPACK_PACKAGE_VERSION_PATCH "0")
SET(CPACK_RESOURCE_FILE_LICENSE "/home/tim/projects/mmorlg.D/COPYING")
SET(CPACK_RESOURCE_FILE_README "/usr/share/cmake/Templates/CPack.GenericDescription.txt")
SET(CPACK_RESOURCE_FILE_WELCOME "/usr/share/cmake/Templates/CPack.GenericWelcome.txt")
SET(CPACK_SOURCE_GENERATOR "TGZ;TBZ2")
SET(CPACK_SOURCE_IGNORE_FILES "\\.svn/;/debug/;/optimized/;/documentation/;[a-z]*\\.kdev*;[a-z]*\\.tag;[a-z]*\\.pyc")
SET(CPACK_SOURCE_OUTPUT_CONFIG_FILE "/home/tim/projects/mmorlg.D/cmake/Modules/CPackSourceConfig.cmake")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "mmorlg-0.1")
SET(CPACK_SOURCE_STRIP_FILES "")
SET(CPACK_STRIP_FILES "mmorlg/mmorlg")
SET(CPACK_SYSTEM_NAME "Linux")
SET(CPACK_TOPLEVEL_TAG "Linux")

View file

@ -0,0 +1,62 @@
# This file will be configured to contain variables for CPack. These variables
# should be set in the CMake list file of the project before CPack module is
# included. Example variables are:
# CPACK_GENERATOR - Generator used to create package
# CPACK_INSTALL_CMAKE_PROJECTS - For each project (path, name, component)
# CPACK_CMAKE_GENERATOR - CMake Generator used for the projects
# CPACK_INSTALL_COMMANDS - Extra commands to install components
# CPACK_INSTALL_DIRECTORIES - Extra directories to install
# CPACK_PACKAGE_DESCRIPTION_FILE - Description file for the package
# CPACK_PACKAGE_DESCRIPTION_SUMMARY - Summary of the package
# CPACK_PACKAGE_EXECUTABLES - List of pairs of executables and labels
# CPACK_PACKAGE_FILE_NAME - Name of the package generated
# CPACK_PACKAGE_ICON - Icon used for the package
# CPACK_PACKAGE_INSTALL_DIRECTORY - Name of directory for the installer
# CPACK_PACKAGE_NAME - Package project name
# CPACK_PACKAGE_VENDOR - Package project vendor
# CPACK_PACKAGE_VERSION - Package project version
# CPACK_PACKAGE_VERSION_MAJOR - Package project version (major)
# CPACK_PACKAGE_VERSION_MINOR - Package project version (minor)
# CPACK_PACKAGE_VERSION_PATCH - Package project version (patch)
# There are certain generator specific ones
# NSIS Generator:
# CPACK_PACKAGE_INSTALL_REGISTRY_KEY - Name of the registry key for the installer
# CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS - Extra commands used during uninstall
# CPACK_NSIS_EXTRA_INSTALL_COMMANDS - Extra commands used during install
SET(CPACK_CMAKE_GENERATOR "Unix Makefiles")
SET(CPACK_GENERATOR "TGZ;TBZ2")
SET(CPACK_IGNORE_FILES "\\.svn/;/debug/;/optimized/;/documentation/;[a-z]*\\.kdev*;[a-z]*\\.tag;[a-z]*\\.pyc")
SET(CPACK_INSTALLED_DIRECTORIES "/home/tim/projects/mmorlg.D;/")
SET(CPACK_INSTALL_CMAKE_PROJECTS "")
SET(CPACK_MODULE_PATH "/home/tim/projects/mmorlg.D/cmake/Modules")
SET(CPACK_NSIS_DISPLAY_NAME "mmorlg 0.1.0")
SET(CPACK_OUTPUT_CONFIG_FILE "/home/tim/projects/mmorlg.D/cmake/Modules/CPackConfig.cmake")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "/home/tim/projects/mmorlg.D/README")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "mmorlg")
SET(CPACK_PACKAGE_EXECUTABLES "mmorlg;mmorlg")
SET(CPACK_PACKAGE_FILE_NAME "mmorlg-0.1")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "mmorlg 0.1.0")
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "mmorlg 0.1.0")
SET(CPACK_PACKAGE_NAME "mmorlg")
SET(CPACK_PACKAGE_VENDOR "mmorlg")
SET(CPACK_PACKAGE_VERSION "0.1.0")
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
SET(CPACK_PACKAGE_VERSION_MINOR "1")
SET(CPACK_PACKAGE_VERSION_PATCH "0")
SET(CPACK_RESOURCE_FILE_LICENSE "/home/tim/projects/mmorlg.D/COPYING")
SET(CPACK_RESOURCE_FILE_README "/usr/share/cmake/Templates/CPack.GenericDescription.txt")
SET(CPACK_RESOURCE_FILE_WELCOME "/usr/share/cmake/Templates/CPack.GenericWelcome.txt")
SET(CPACK_SOURCE_GENERATOR "TGZ;TBZ2")
SET(CPACK_SOURCE_IGNORE_FILES "\\.svn/;/debug/;/optimized/;/documentation/;[a-z]*\\.kdev*;[a-z]*\\.tag;[a-z]*\\.pyc")
SET(CPACK_SOURCE_INSTALLED_DIRECTORIES "/home/tim/projects/mmorlg.D;/")
SET(CPACK_SOURCE_OUTPUT_CONFIG_FILE "/home/tim/projects/mmorlg.D/cmake/Modules/CPackSourceConfig.cmake")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "mmorlg-0.1")
SET(CPACK_SOURCE_STRIP_FILES "")
SET(CPACK_SOURCE_TOPLEVEL_TAG "Linux-Source")
SET(CPACK_STRIP_FILES "")
SET(CPACK_SYSTEM_NAME "Linux")
SET(CPACK_TOPLEVEL_TAG "Linux-Source")

View file

@ -0,0 +1,8 @@
# define system dependent compiler flags
IF(CMAKE_COMPILER_IS_GDC)
add_definitions(-DHAVE_CONFIG_H -Wall -Werror)
ELSE(CMAKE_COMPILER_IS_GDC)
add_definitions(-version=HaveConfig)
ENDIF(CMAKE_COMPILER_IS_GDC)

View file

@ -0,0 +1,124 @@
if (UNIX)
IF (NOT APPLICATION_NAME)
MESSAGE(STATUS "${PROJECT_NAME} is used as APPLICATION_NAME")
SET(APPLICATION_NAME ${PROJECT_NAME})
ENDIF (NOT APPLICATION_NAME)
# Suffix for Linux
SET(LIB_SUFFIX
CACHE STRING "Define suffix of directory name (32/64)"
)
SET(EXEC_INSTALL_PREFIX
"${CMAKE_INSTALL_PREFIX}"
CACHE PATH "Base directory for executables and libraries"
FORCE
)
SET(SHARE_INSTALL_PREFIX
"${CMAKE_INSTALL_PREFIX}/share"
CACHE PATH "Base directory for files which go to share/"
FORCE
)
SET(DATA_INSTALL_PREFIX
"${SHARE_INSTALL_PREFIX}/${APPLICATION_NAME}"
CACHE PATH "The parent directory where applications can install their data" FORCE)
# The following are directories where stuff will be installed to
SET(BIN_INSTALL_DIR
"${EXEC_INSTALL_PREFIX}/bin"
CACHE PATH "The ${APPLICATION_NAME} binary install dir (default prefix/bin)"
FORCE
)
SET(SBIN_INSTALL_DIR
"${EXEC_INSTALL_PREFIX}/sbin"
CACHE PATH "The ${APPLICATION_NAME} sbin install dir (default prefix/sbin)"
FORCE
)
SET(LIB_INSTALL_DIR
"${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}"
CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is prefix/lib)"
FORCE
)
SET(LIBEXEC_INSTALL_DIR
"${EXEC_INSTALL_PREFIX}/libexec"
CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is prefix/libexec)"
FORCE
)
SET(PLUGIN_INSTALL_DIR
"${LIB_INSTALL_DIR}/${APPLICATION_NAME}"
CACHE PATH "The subdirectory relative to the install prefix where plugins will be installed (default is prefix/lib/${APPLICATION_NAME})"
FORCE
)
SET(INCLUDE_INSTALL_DIR
"${CMAKE_INSTALL_PREFIX}/include"
CACHE PATH "The subdirectory to the header prefix (default prefix/include)"
FORCE
)
SET(DATA_INSTALL_DIR
"${DATA_INSTALL_PREFIX}"
CACHE PATH "The parent directory where applications can install their data (default prefix/share/${APPLICATION_NAME})"
FORCE
)
SET(HTML_INSTALL_DIR
"${DATA_INSTALL_PREFIX}/doc/HTML"
CACHE PATH "The HTML install dir for documentation (default data/doc/html)"
FORCE
)
SET(ICON_INSTALL_DIR
"${DATA_INSTALL_PREFIX}/icons"
CACHE PATH "The icon install dir (default data/icons/)"
FORCE
)
SET(SOUND_INSTALL_DIR
"${DATA_INSTALL_PREFIX}/sounds"
CACHE PATH "The install dir for sound files (default data/sounds)"
FORCE
)
SET(LOCALE_INSTALL_DIR
"${SHARE_INSTALL_PREFIX}/locale"
CACHE PATH "The install dir for translations (default prefix/share/locale)"
FORCE
)
SET(XDG_APPS_DIR
"${SHARE_INSTALL_PREFIX}/applications/"
CACHE PATH "The XDG apps dir"
FORCE
)
SET(XDG_DIRECTORY_DIR
"${SHARE_INSTALL_PREFIX}/desktop-directories"
CACHE PATH "The XDG directory"
FORCE
)
SET(SYSCONF_INSTALL_DIR
"${EXEC_INSTALL_PREFIX}/etc"
CACHE PATH "The ${APPLICATION_NAME} sysconfig install dir (default prefix/etc)"
FORCE
)
SET(MAN_INSTALL_DIR
"${SHARE_INSTALL_PREFIX}/man"
CACHE PATH "The ${APPLICATION_NAME} man install dir (default prefix/man)"
FORCE
)
SET(INFO_INSTALL_DIR
"${SHARE_INSTALL_PREFIX}/info"
CACHE PATH "The ${APPLICATION_NAME} info install dir (default prefix/info)"
FORCE
)
endif (UNIX)
if (WIN32)
# Same same
SET(BIN_INSTALL_DIR .)
SET(SBIN_INSTALL_DIR .)
SET(LIB_INSTALL_DIR .)
SET(PLUGIN_INSTALL_DIR plugins)
SET(HTML_INSTALL_DIR doc/HTML)
SET(ICON_INSTALL_DIR .)
SET(SOUND_INSTALL_DIR .)
SET(LOCALE_INSTALL_DIR lang)
endif (WIN32)

View file

@ -0,0 +1,31 @@
# Required cmake version
cmake_minimum_required(VERSION 2.4.3)
# Always include srcdir and builddir in include path
# This saves typing ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY} in
# about every subdir
# since cmake 2.4.0
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Put the include dirs which are in the source or build tree
# before all other include dirs, so the headers in the sources
# are prefered over the already installed ones
# since cmake 2.4.1
set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
# Use colored output
# since cmake 2.4.0
set(CMAKE_COLOR_MAKEFILE ON)
# Define the generic version of the libraries here
set(GENERIC_LIB_VERSION "2.0.0")
set(GENERIC_LIB_SOVERSION "2")
# Set the default build type to release with debug info
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug
CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE
)
endif (NOT CMAKE_BUILD_TYPE)

View file

@ -0,0 +1,43 @@
#
# CMakeD - CMake module for D Language
#
# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>
# Tim Burrell <tim.burrell@gmail.com>
#
# All rights reserved.
#
# See Copyright.txt for details.
#
# - Find GDC Include Path
#
# GDC_INCLUDE_PATH = path to where object.d is found
#
SET(GDC_POSSIBLE_INCLUDE_PATHS
/usr/include/d/4.2.1
/usr/include/d/4.2.0
/usr/include/d/4.1.2
/usr/include/d/4.1.1
/usr/include/d/4.1.0
/usr/include/d/4.0.4
/usr/include/d/4.0.3
/usr/include/d/4.0.2
/usr/include/d/4.0.1
/usr/include/d/4.0.0
/usr/include/d/4.0.6
/usr/include/d/4.0.5
/usr/include/d/3.4.4
/usr/include/d/3.4.3
/usr/include/d/3.4.2
/usr/include/d/3.4.1
/usr/include/d/3.4.0
)
FIND_PATH(GDC_INCLUDE_PATH object.d
${GDC_POSSIBLE_INCLUDE_PATHS})
MARK_AS_ADVANCED(
GDC_INCLUDE_PATH
)

View file

@ -0,0 +1,453 @@
# - Try to find GTK2
# Once done this will define
#
# GTK2_FOUND - System has Boost
# GTK2_INCLUDE_DIRS - GTK2 include directory
# GTK2_LIBRARIES - Link these to use GTK2
# GTK2_LIBRARY_DIRS - The path to where the GTK2 library files are.
# GTK2_DEFINITIONS - Compiler switches required for using GTK2
#
# Copyright (c) 2007 Andreas Schneider <mail@cynapses.org>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see
# http://cmake-modules.googlecode.com/svn/trunk/Modules/COPYING-CMAKE-SCRIPTS
#
set(GTK2_DEBUG ON)
macro(GTK2_DEBUG_MESSAGE _message)
if (GTK2_DEBUG)
message(STATUS "(DEBUG) ${_message}")
endif (GTK2_DEBUG)
endmacro(GTK2_DEBUG_MESSAGE _message)
if (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS)
# in cache already
set(GTK2_FOUND TRUE)
else (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS)
if (UNIX)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
include(UsePkgConfig)
pkgconfig(gtk+-2.0 _GTK2IncDir _GTK2LinkDir _GTK2LinkFlags _GTK2Cflags)
find_path(GTK2_GTK_INCLUDE_DIR
NAMES
gtk/gtk.h
PATHS
$ENV{GTK2_HOME}
${_GTK2IncDir}
/usr/include/gtk-2.0
/usr/local/include/gtk-2.0
/opt/include/gtk-2.0
/opt/gnome/include/gtk-2.0
/sw/include/gtk-2.0
)
gtk2_debug_message("GTK2_GTK_INCLUDE_DIR is ${GTK2_GTK_INCLUDE_DIR}")
# Some Linux distributions (e.g. Red Hat) have glibconfig.h
# and glib.h in different directories, so we need to look
# for both.
# - Atanas Georgiev <atanas@cs.columbia.edu>
pkgconfig(glib-2.0 _GLIB2IncDir _GLIB2LinkDir _GLIB2LinkFlags _GLIB2Cflags)
pkgconfig(gmodule-2.0 _GMODULE2IncDir _GMODULE2LinkDir _GMODULE2LinkFlags _GMODULE2Cflags)
find_path(GTK2_GLIBCONFIG_INCLUDE_DIR
NAMES
glibconfig.h
PATHS
${_GLIB2IncDir}
${_GMODULE2IncDir}
/opt/gnome/lib64/glib-2.0/include
/opt/gnome/lib/glib-2.0/include
/opt/lib/glib-2.0/include
/usr/lib64/glib-2.0/include
/usr/lib/glib-2.0/include
/sw/lib/glib-2.0/include
)
gtk2_debug_message("GTK2_GLIBCONFIG_INCLUDE_DIR is ${GTK2_GLIBCONFIG_INCLUDE_DIR}")
find_path(GTK2_GLIB_INCLUDE_DIR
NAMES
glib.h
PATHS
${_GLIB2IncDir}
${_GMODULE2IncDir}
/opt/include/glib-2.0
/opt/gnome/include/glib-2.0
/usr/include/glib-2.0
/sw/include/glib-2.0
)
gtk2_debug_message("GTK2_GLIB_INCLUDE_DIR is ${GTK2_GLIB_INCLUDE_DIR}")
pkgconfig(gdk-2.0 _GDK2IncDir _GDK2LinkDir _GDK2LinkFlags _GDK2Cflags)
find_path(GTK2_GDK_INCLUDE_DIR
NAMES
gdkconfig.h
PATHS
${_GDK2IncDir}
/opt/gnome/lib/gtk-2.0/include
/opt/gnome/lib64/gtk-2.0/include
/opt/lib/gtk-2.0/include
/usr/lib/gtk-2.0/include
/usr/lib64/gtk-2.0/include
/sw/lib/gtk-2.0/include
)
gtk2_debug_message("GTK2_GDK_INCLUDE_DIR is ${GTK2_GDK_INCLUDE_DIR}")
find_path(GTK2_GTKGL_INCLUDE_DIR
NAMES
gtkgl/gtkglarea.h
PATHS
${_GLIB2IncDir}
/usr/include
/usr/local/include
/usr/openwin/share/include
/opt/gnome/include
/opt/include
/sw/include
)
gtk2_debug_message("GTK2_GTKGL_INCLUDE_DIR is ${GTK2_GTKGL_INCLUDE_DIR}")
pkgconfig(libglade-2.0 _GLADEIncDir _GLADELinkDir _GLADELinkFlags _GLADECflags)
find_path(GTK2_GLADE_INCLUDE_DIR
NAMES
glade/glade.h
PATHS
${_GLADEIncDir}
/opt/gnome/include/libglade-2.0
/usr/include/libglade-2.0
/opt/include/libglade-2.0
/sw/include/libglade-2.0
)
gtk2_debug_message("GTK2_GLADE_INCLUDE_DIR is ${GTK2_GLADE_INCLUDE_DIR}")
pkgconfig(pango _PANGOIncDir _PANGOLinkDir _PANGOLinkFlags _PANGOCflags)
find_path(GTK2_PANGO_INCLUDE_DIR
NAMES
pango/pango.h
PATHS
${_PANGOIncDir}
/usr/include/pango-1.0
/opt/gnome/include/pango-1.0
/opt/include/pango-1.0
/sw/include/pango-1.0
)
gtk2_debug_message("GTK2_PANGO_INCLUDE_DIR is ${GTK2_PANGO_INCLUDE_DIR}")
pkgconfig(cairo _CAIROIncDir _CAIROLinkDir _CAIROLinkFlags _CAIROCflags)
find_path(GTK2_CAIRO_INCLUDE_DIR
NAMES
cairo.h
PATHS
${_CAIROIncDir}
/opt/gnome/include/cairo
/usr/include
/usr/include/cairo
/opt/include
/opt/include/cairo
/sw/include
/sw/include/cairo
)
gtk2_debug_message("GTK2_CAIRO_INCLUDE_DIR is ${GTK2_CAIRO_INCLUDE_DIR}")
pkgconfig(atk _ATKIncDir _ATKLinkDir _ATKLinkFlags _ATKCflags)
find_path(GTK2_ATK_INCLUDE_DIR
NAMES
atk/atk.h
PATHS
${_ATKIncDir}
/opt/gnome/include/atk-1.0
/usr/include/atk-1.0
/opt/include/atk-1.0
/sw/include/atk-1.0
)
gtk2_debug_message("GTK2_ATK_INCLUDE_DIR is ${GTK2_ATK_INCLUDE_DIR}")
find_library(GTK2_GTK_LIBRARY
NAMES
gtk-x11-2.0
PATHS
${_GTK2LinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GTK_LIBRARY is ${GTK2_GTK_LIBRARY}")
find_library(GTK2_GDK_LIBRARY
NAMES
gdk-x11-2.0
PATHS
${_GDK2LinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GDK_LIBRARY is ${GTK2_GDK_LIBRARY}")
find_library(GTK2_GDK_PIXBUF_LIBRARY
NAMES
gdk_pixbuf-2.0
PATHS
${_GDK2LinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GDK_PIXBUF_LIBRARY is ${GTK2_GDK_PIXBUF_LIBRARY}")
find_library(GTK2_GMODULE_LIBRARY
NAMES
gmodule-2.0
PATHS
${_GMODULE2LinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GMODULE_LIBRARY is ${GTK2_GMODULE_LIBRARY}")
find_library(GTK2_GTHREAD_LIBRARY
NAMES
gthread-2.0
PATHS
${_GTK2LinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GTHREAD_LIBRARY is ${GTK2_GTHREAD_LIBRARY}")
find_library(GTK2_GOBJECT_LIBRARY
NAMES
gobject-2.0
PATHS
${_GTK2LinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GOBJECT_LIBRARY is ${GTK2_GOBJECT_LIBRARY}")
find_library(GTK2_GLIB_LIBRARY
NAMES
glib-2.0
PATHS
${_GLIB2LinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GLIB_LIBRARY is ${GTK2_GLIB_LIBRARY}")
find_library(GTK2_GTKGL_LIBRARY
NAMES
gtkgl
PATHS
${_GTK2LinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GTKGL_LIBRARY is ${GTK2_GTKGL_LIBRARY}")
find_library(GTK2_GLADE_LIBRARY
NAMES
glade-2.0
PATHS
${_GLADELinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_GLADE_LIBRARY is ${GTK2_GLADE_LIBRARY}")
find_library(GTK2_PANGO_LIBRARY
NAMES
pango-1.0
PATHS
${_PANGOLinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_PANGO_LIBRARY is ${GTK2_PANGO_LIBRARY}")
find_library(GTK2_CAIRO_LIBRARY
NAMES
pangocairo-1.0
PATHS
${_CAIROLinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_PANGO_LIBRARY is ${GTK2_CAIRO_LIBRARY}")
find_library(GTK2_ATK_LIBRARY
NAMES
atk-1.0
PATHS
${_ATKinkDir}
/usr/lib
/usr/local/lib
/usr/openwin/lib
/usr/X11R6/lib
/opt/gnome/lib
/opt/lib
/sw/lib
)
gtk2_debug_message("GTK2_ATK_LIBRARY is ${GTK2_ATK_LIBRARY}")
set(GTK2_INCLUDE_DIRS
${GTK2_GTK_INCLUDE_DIR}
${GTK2_GLIBCONFIG_INCLUDE_DIR}
${GTK2_GLIB_INCLUDE_DIR}
${GTK2_GDK_INCLUDE_DIR}
${GTK2_GLADE_INCLUDE_DIR}
${GTK2_PANGO_INCLUDE_DIR}
${GTK2_CAIRO_INCLUDE_DIR}
${GTK2_ATK_INCLUDE_DIR}
)
if (GTK2_GTK_LIBRARY AND GTK2_GTK_INCLUDE_DIR)
if (GTK2_GDK_LIBRARY AND GTK2_GDK_PIXBUF_LIBRARY AND GTK2_GDK_INCLUDE_DIR)
if (GTK2_GMODULE_LIBRARY)
if (GTK2_GTHREAD_LIBRARY)
if (GTK2_GOBJECT_LIBRARY)
if (GTK2_GLADE_LIBRARY AND GTK2_GLADE_INCLUDE_DIR)
if (GTK2_PANGO_LIBRARY AND GTK2_PANGO_INCLUDE_DIR)
if (GTK2_CAIRO_LIBRARY AND GTK2_CAIRO_INCLUDE_DIR)
if (GTK2_ATK_LIBRARY AND GTK2_ATK_INCLUDE_DIR)
# set GTK2 libraries
set (GTK2_LIBRARIES
${GTK2_GTK_LIBRARY}
${GTK2_GDK_LIBRARY}
${GTK2_GDK_PIXBUF_LIBRARY}
${GTK2_GMODULE_LIBRARY}
${GTK2_GTHREAD_LIBRARY}
${GTK2_GOBJECT_LIBRARY}
${GTK2_GLADE_LIBRARY}
${GTK2_PANGO_LIBRARY}
${GTK2_CAIRO_LIBRARY}
${GTK2_ATK_LIBRARY}
)
# check for gtkgl support
if (GTK2_GTKGL_LIBRARY AND GTK2_GTKGL_INCLUDE_DIR)
set(GTK2_GTKGL_FOUND TRUE)
set(GTK2_INCLUDE_DIRS
${GTK2_INCLUDE_DIR}
${GTK2_GTKGL_INCLUDE_DIR}
)
set(GTK2_LIBRARIES
${GTK2_LIBRARIES}
${GTK2_GTKGL_LIBRARY}
)
endif (GTK2_GTKGL_LIBRARY AND GTK2_GTKGL_INCLUDE_DIR)
else (GTK2_ATK_LIBRARY AND GTK2_ATK_INCLUDE_DIR)
message(SEND_ERROR "Could not find ATK")
endif (GTK2_ATK_LIBRARY AND GTK2_ATK_INCLUDE_DIR)
else (GTK2_CAIRO_LIBRARY AND GTK2_CAIRO_INCLUDE_DIR)
message(SEND_ERROR "Could not find CAIRO")
endif (GTK2_CAIRO_LIBRARY AND GTK2_CAIRO_INCLUDE_DIR)
else (GTK2_PANGO_LIBRARY AND GTK2_PANGO_INCLUDE_DIR)
message(SEND_ERROR "Could not find PANGO")
endif (GTK2_PANGO_LIBRARY AND GTK2_PANGO_INCLUDE_DIR)
else (GTK2_GLADE_LIBRARY AND GTK2_GLADE_INCLUDE_DIR)
message(SEND_ERROR "Could not find GLADE")
endif (GTK2_GLADE_LIBRARY AND GTK2_GLADE_INCLUDE_DIR)
else (GTK2_GOBJECT_LIBRARY)
message(SEND_ERROR "Could not find GOBJECT")
endif (GTK2_GOBJECT_LIBRARY)
else (GTK2_GTHREAD_LIBRARY)
message(SEND_ERROR "Could not find GTHREAD")
endif (GTK2_GTHREAD_LIBRARY)
else (GTK2_GMODULE_LIBRARY)
message(SEND_ERROR "Could not find GMODULE")
endif (GTK2_GMODULE_LIBRARY)
else (GTK2_GDK_LIBRARY AND GTK2_GDK_PIXBUF_LIBRARY AND GTK2_GDK_INCLUDE_DIR)
message(SEND_ERROR "Could not find GDK (GDK_PIXBUF)")
endif (GTK2_GDK_LIBRARY AND GTK2_GDK_PIXBUF_LIBRARY AND GTK2_GDK_INCLUDE_DIR)
else (GTK2_GTK_LIBRARY AND GTK2_GTK_INCLUDE_DIR)
message(SEND_ERROR "Could not find GTK2-X11")
endif (GTK2_GTK_LIBRARY AND GTK2_GTK_INCLUDE_DIR)
if (GTK2_INCLUDE_DIRS AND GTK2_LIBRARIES)
set(GTK2_FOUND TRUE)
endif (GTK2_INCLUDE_DIRS AND GTK2_LIBRARIES)
if (GTK2_FOUND)
if (NOT GTK2_FIND_QUIETLY)
message(STATUS "Found GTK2: ${GTK2_LIBRARIES}")
endif (NOT GTK2_FIND_QUIETLY)
else (GTK2_FOUND)
if (GTK2_FIND_REQUIRED)
message(FATAL_ERROR "Could not find GTK2")
endif (GTK2_FIND_REQUIRED)
endif (GTK2_FOUND)
# show the GTK2_INCLUDE_DIRS and GTK2_LIBRARIES variables only in the advanced view
mark_as_advanced(GTK2_INCLUDE_DIRS GTK2_LIBRARIES)
endif (UNIX)
endif (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS)

View file

@ -0,0 +1,65 @@
#------------------------------------------------------------------------------
# Desc:
# Tabs: 3
#
# Copyright (c) 2007 Novell, Inc. All Rights Reserved.
#
# This program and the accompanying materials are made available
# under the terms of the Eclipse Public License v1.0 which
# accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# To contact Novell about this file by physical or electronic mail,
# you may find current contact information at www.novell.com.
#
# $Id$
#
# Author: Andrew Hodgkinson <ahodgkinson@novell.com>
#------------------------------------------------------------------------------
# Include the local modules directory
set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules")
# Locate ncurses files
if( NOT NCURSES_FOUND)
find_path( NCURSES_INCLUDE_DIR ncurses.h
PATHS /usr/include
/usr/local/include
NO_DEFAULT_PATH
)
MARK_AS_ADVANCED( NCURSES_INCLUDE_DIR)
find_library( NCURSES_LIBRARY
NAMES ncurses
PATHS /usr/lib
/usr/local/lib
NO_DEFAULT_PATH
)
MARK_AS_ADVANCED( NCURSES_LIBRARY)
if( NCURSES_INCLUDE_DIR AND NCURSES_LIBRARY)
set( NCURSES_FOUND TRUE)
set( NCURSES_INCLUDE_DIRS ${NCURSES_INCLUDE_DIR})
set( NCURSES_LIBRARIES ${NCURSES_LIBRARY})
endif( NCURSES_INCLUDE_DIR AND NCURSES_LIBRARY)
if( NCURSES_FOUND)
if( NOT NCURSES_FIND_QUIETLY)
message( STATUS "Found ncurses libraries: ${NCURSES_LIBRARIES}")
message( STATUS "Found ncurses inc dirs: ${NCURSES_INCLUDE_DIRS}")
endif( NOT NCURSES_FIND_QUIETLY)
else( NCURSES_FOUND)
if( NCURSES_FIND_REQUIRED)
message( FATAL_ERROR "Could not find ncurses")
else( NCURSES_FIND_REQUIRED)
if( NOT NCURSES_FIND_QUIETLY)
message( STATUS "Could not find ncurses")
endif( NOT NCURSES_FIND_QUIETLY)
endif( NCURSES_FIND_REQUIRED)
endif( NCURSES_FOUND)
endif( NOT NCURSES_FOUND)

View file

@ -0,0 +1,21 @@
# - MACRO_ADD_COMPILE_FLAGS(target_name flag1 ... flagN)
# Copyright (c) 2006, Oswald Buddenhagen, <ossi@kde.org>
# Copyright (c) 2006, Andreas Schneider, <mail@cynapses.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
macro (MACRO_ADD_COMPILE_FLAGS _target)
get_target_property(_flags ${_target} COMPILE_FLAGS)
if (_flags)
set(_flags ${_flags} ${ARGN})
else (_flags)
set(_flags ${ARGN})
endif (_flags)
set_target_properties(${_target} PROPERTIES COMPILE_FLAGS ${_flags})
endmacro (MACRO_ADD_COMPILE_FLAGS)

View file

@ -0,0 +1,20 @@
# - MACRO_ADD_LINK_FLAGS(target_name flag1 ... flagN)
# Copyright (c) 2006, Oswald Buddenhagen, <ossi@kde.org>
# Copyright (c) 2006, Andreas Schneider, <mail@cynapses.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
macro (MACRO_ADD_LINK_FLAGS _target)
get_target_property(_flags ${_target} LINK_FLAGS)
if (_flags)
set(_flags "${_flags} ${ARGN}")
else (_flags)
set(_flags "${ARGN}")
endif (_flags)
set_target_properties(${_target} PROPERTIES LINK_FLAGS "${_flags}")
endmacro (MACRO_ADD_LINK_FLAGS)

View file

@ -0,0 +1,30 @@
# - MACRO_ADD_PLUGIN(name [WITH_PREFIX] file1 .. fileN)
#
# Create a plugin from the given source files.
# If WITH_PREFIX is given, the resulting plugin will have the
# prefix "lib", otherwise it won't.
#
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
# Copyright (c) 2006, Laurent Montel, <montel@kde.org>
# Copyright (c) 2006, Andreas Schneider, <mail@cynapses.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
macro (MACRO_ADD_PLUGIN _target_NAME _with_PREFIX)
if (${_with_PREFIX} STREQUAL "WITH_PREFIX")
set(_first_SRC)
else (${_with_PREFIX} STREQUAL "WITH_PREFIX")
set(_first_SRC ${_with_PREFIX})
endif (${_with_PREFIX} STREQUAL "WITH_PREFIX")
add_library(${_target_NAME} MODULE ${_first_SRC} ${ARGN})
if (_first_SRC)
set_target_properties(${_target_NAME} PROPERTIES PREFIX "")
endif (_first_SRC)
endmacro (MACRO_ADD_PLUGIN _name _sources)

View file

@ -0,0 +1,16 @@
# - MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)
# MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
MACRO (MACRO_ENSURE_OUT_OF_SOURCE_BUILD _errorMessage)
STRING(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" insource)
IF(insource)
MESSAGE(FATAL_ERROR "${_errorMessage}")
ENDIF(insource)
ENDMACRO (MACRO_ENSURE_OUT_OF_SOURCE_BUILD)

View file

@ -0,0 +1,35 @@
#
# CMakeD - CMake module for D Language
#
# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>
# Tim Burrell <tim.burrell@gmail.com>
#
# All rights reserved.
#
# See Copyright.txt for details.
#
# Modified from CMake 2.6.5 gcc.cmake
# See http://www.cmake.org/HTML/Copyright.html for details
#
IF(CMAKE_D_USE_TANGO)
SET(DSTDLIB_FLAGS "-version=Tango")
ENDIF(CMAKE_D_USE_TANGO)
IF(CMAKE_D_USE_PHOBOS)
SET(DSTDLIB_FLAGS "-version=Phobos")
ENDIF(CMAKE_D_USE_PHOBOS)
IF(CMAKE_D_BUILD_DOCS)
SET(DDOC_FLAGS "-D -Dddocumentation")
#FOREACH(item ${CMAKE_D_DDOC_FILES})
# SET(DDOC_FLAGS "${DDOC_FLAGS} ${item}")
#ENDFOREACH(item)
ENDIF(CMAKE_D_BUILD_DOCS)
SET (CMAKE_D_FLAGS_INIT "-version=Posix ${DSTDLIB_FLAGS} -I$ENV{D_PATH}/include -I$ENV{D_PATH}/import")
SET (CMAKE_D_FLAGS_DEBUG_INIT "-g ${DDOC_FLAGS}")
# SET (CMAKE_D_FLAGS_MINSIZEREL_INIT "-Os ${DDOC_FLAGS}")
SET (CMAKE_D_FLAGS_RELEASE_INIT "-O -release -inline ${DDOC_FLAGS}")
SET (CMAKE_D_FLAGS_RELWITHDEBINFO_INIT "-O -g ${DDOC_FLAGS}")
# SET (CMAKE_D_CREATE_PREPROCESSED_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
SET (CMAKE_D_CREATE_ASSEMBLY_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
# SET (CMAKE_INCLUDE_SYSTEM_FLAG_D "-isystem ")

View file

@ -0,0 +1,36 @@
#
# CMakeD - CMake module for D Language
#
# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>
# Tim Burrell <tim.burrell@gmail.com>
#
# All rights reserved.
#
# See Copyright.txt for details.
#
# Modified from CMake 2.6.5 gcc.cmake
# See http://www.cmake.org/HTML/Copyright.html for details
#
IF(CMAKE_D_USE_TANGO)
SET(DSTDLIB_FLAGS "-fversion=Tango")
ENDIF(CMAKE_D_USE_TANGO)
IF(CMAKE_D_USE_PHOBOS)
SET(DSTDLIB_FLAGS "-fversion=Phobos")
ENDIF(CMAKE_D_USE_PHOBOS)
IF(CMAKE_D_BUILD_DOCS)
SET(DDOC_FLAGS "-fdoc -fdoc-dir=documentation")
FOREACH(item ${CMAKE_D_DDOC_FILES})
SET(DDOC_FLAGS "${DDOC_FLAGS} -fdoc-inc=${item}")
ENDFOREACH(item)
ENDIF(CMAKE_D_BUILD_DOCS)
SET (CMAKE_D_FLAGS_INIT "-fversion=Posix ${DSTDLIB_FLAGS}")
SET (CMAKE_D_FLAGS_DEBUG_INIT "-g ${DDOC_FLAGS}")
SET (CMAKE_D_FLAGS_MINSIZEREL_INIT "-Os ${DDOC_FLAGS}")
SET (CMAKE_D_FLAGS_RELEASE_INIT "-O3 -fomit-frame-pointer -fweb -frelease -finline-functions ${DDOC_FLAGS}")
SET (CMAKE_D_FLAGS_RELWITHDEBINFO_INIT "-O2 -g ${DDOC_FLAGS}")
# SET (CMAKE_D_CREATE_PREPROCESSED_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
SET (CMAKE_D_CREATE_ASSEMBLY_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
#SET (CMAKE_INCLUDE_SYSTEM_FLAG_D "-isystem ")

View file

@ -0,0 +1,36 @@
#
# CMakeD - CMake module for D Language
#
# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>
# Tim Burrell <tim.burrell@gmail.com>
#
# All rights reserved.
#
# See Copyright.txt for details.
#
# Modified from CMake 2.6.5 gcc.cmake
# See http://www.cmake.org/HTML/Copyright.html for details
#
IF(CMAKE_D_USE_TANGO)
SET(DSTDLIB_FLAGS "-version=Tango")
ENDIF(CMAKE_D_USE_TANGO)
IF(CMAKE_D_USE_PHOBOS)
SET(DSTDLIB_FLAGS "-version=Phobos")
ENDIF(CMAKE_D_USE_PHOBOS)
IF(CMAKE_D_BUILD_DOCS)
SET(DDOC_FLAGS "-D -Dddocumentation")
#FOREACH(item ${CMAKE_D_DDOC_FILES})
# SET(DDOC_FLAGS "${DDOC_FLAGS} ${item}")
#ENDFOREACH(item)
ENDIF(CMAKE_D_BUILD_DOCS)
SET (CMAKE_D_FLAGS_INIT "-version=Win ${DSTDLIB_FLAGS}")
SET (CMAKE_D_FLAGS_DEBUG_INIT "-g ${DDOC_FLAGS}")
# SET (CMAKE_D_FLAGS_MINSIZEREL_INIT "-Os ${DDOC_FLAGS}")
SET (CMAKE_D_FLAGS_RELEASE_INIT "-O -release -inline ${DDOC_FLAGS}")
SET (CMAKE_D_FLAGS_RELWITHDEBINFO_INIT "-O -g ${DDOC_FLAGS}")
# SET (CMAKE_D_CREATE_PREPROCESSED_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
SET (CMAKE_D_CREATE_ASSEMBLY_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
# SET (CMAKE_INCLUDE_SYSTEM_FLAG_D "-isystem ")

View file

@ -0,0 +1,36 @@
#
# CMakeD - CMake module for D Language
#
# Copyright (c) 2007, Selman Ulug <selman.ulug@gmail.com>
# Tim Burrell <tim.burrell@gmail.com>
#
# All rights reserved.
#
# See Copyright.txt for details.
#
# Modified from CMake 2.6.5 gcc.cmake
# See http://www.cmake.org/HTML/Copyright.html for details
#
IF(CMAKE_D_USE_TANGO)
SET(DSTDLIB_FLAGS "-fversion=Tango")
ENDIF(CMAKE_D_USE_TANGO)
IF(CMAKE_D_USE_PHOBOS)
SET(DSTDLIB_FLAGS "-fversion=Phobos")
ENDIF(CMAKE_D_USE_PHOBOS)
IF(CMAKE_D_BUILD_DOCS)
SET(DDOC_FLAGS "-fdoc -fdoc-dir=documentation")
FOREACH(item ${CMAKE_D_DDOC_FILES})
SET(DDOC_FLAGS "${DDOC_FLAGS} -fdoc-inc=${item}")
ENDFOREACH(item)
ENDIF(CMAKE_D_BUILD_DOCS)
SET (CMAKE_D_FLAGS_INIT "-fversion=Win ${DSTDLIB_FLAGS}")
SET (CMAKE_D_FLAGS_DEBUG_INIT "-g ${DDOC_FLAGS}")
SET (CMAKE_D_FLAGS_MINSIZEREL_INIT "-Os ${DDOC_FLAGS}")
SET (CMAKE_D_FLAGS_RELEASE_INIT "-O3 -fomit-frame-pointer -fweb -frelease -finline-functions ${DDOC_FLAGS}")
SET (CMAKE_D_FLAGS_RELWITHDEBINFO_INIT "-O2 -g ${DDOC_FLAGS}")
# SET (CMAKE_D_CREATE_PREPROCESSED_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
SET (CMAKE_D_CREATE_ASSEMBLY_SOURCE "<CMAKE_D_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
#SET (CMAKE_INCLUDE_SYSTEM_FLAG_D "-isystem ")

View file

@ -0,0 +1,61 @@
# check if the user wants to build ddocs
#
# Copyright (c) 2007 Tim Burrell <tim.burrell@gmail.com>
#
# All rights reserved.
#
# See Copyright.txt for details.
#
# Do not build documentation by default
if (NOT CMAKE_D_BUILD_DOCS)
set(CMAKE_D_BUILD_DOCS False CACHE BOOLEAN TRUE FORCE)
else (NOT CMAKE_D_BUILD_DOCS)
# check for specified ddoc files
# default to the candydoc usual
set(CMAKE_D_BUILD_DOCS True CACHE BOOLEAN FALSE FORCE)
if (NOT CMAKE_D_DDOC_FILES)
set(CMAKE_D_DDOC_FILES "documentation/candydoc/candy.ddoc;documentation/candydoc/modules.ddoc" CACHE STRING FALSE FORCE)
else (NOT CMAKE_D_DDOC_FILES)
set(CMAKE_D_DDOC_FILES "${CMAKE_D_DDOC_FILES}" CACHE STRING FALSE FORCE)
endif (NOT CMAKE_D_DDOC_FILES)
# copy the candydoc files
file(GLOB_RECURSE CANDY_DOC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/candydoc/*")
foreach(item ${CANDY_DOC_FILES})
string(REGEX REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" item ${item})
configure_file(${item} ${CMAKE_CURRENT_BINARY_DIR}/documentation/${item} COPYONLY)
endforeach(item)
# create modules.ddoc
file(GLOB_RECURSE sources "${CMAKE_CURRENT_SOURCE_DIR}/*.d")
set(first True)
foreach(item ${sources})
# first make sure we're not config.d
string(REGEX MATCH "config\\.d" ignore ${item})
if (NOT ${ignore} MATCHES "")
# fix up the output
string(REGEX REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" item ${item})
string(REGEX REPLACE "\\.d" ".html" htmlFile ${item})
string(REGEX REPLACE "^.*/" "" htmlFile ${htmlFile})
string(REGEX REPLACE "\\.d" "" item ${item})
string(REGEX REPLACE "/" "." item ${item})
if (first)
set(modules "${item}")
set(first False)
set(CMAKE_D_DDOC_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/documentation/${htmlFile}" CACHE STRING FALSE FORCE)
else (first)
set(modules "${modules};${item}")
set(CMAKE_D_DDOC_CLEAN_FILES "${CMAKE_D_DDOC_CLEAN_FILES}" "${CMAKE_CURRENT_BINARY_DIR}/documentation/${htmlFile}" CACHE STRING FALSE FORCE)
endif (first)
endif (NOT ${ignore} MATCHES "")
endforeach(item)
# create formatted modules string
set(modString "MODULES = \n")
foreach(item ${modules})
set(modString "${modString}\t$(MODULE ${item})\n")
endforeach(item)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/documentation/candydoc/modules.ddoc" ${modString})
endif (NOT CMAKE_D_BUILD_DOCS)

View file

@ -0,0 +1,123 @@
# -helper macro to add a "doc" target with CMake build system.
# and configure doxy.config.in to doxy.config
#
# target "doc" allows building the documentation with doxygen/dot on WIN32 and Linux
# Creates .chm windows help file if MS HTML help workshop
# (available from http://msdn.microsoft.com/workshop/author/htmlhelp)
# is installed with its DLLs in PATH.
#
#
# Please note, that the tools, e.g.:
# doxygen, dot, latex, dvips, makeindex, gswin32, etc.
# must be in path.
#
# Note about Visual Studio Projects:
# MSVS has its own path environment which may differ from the shell.
# See "Menu Tools/Options/Projects/VC++ Directories" in VS 7.1
#
# author Jan Woetzel 2004-2006
# www.mip.informatik.uni-kiel.de/~jw
FIND_PACKAGE(Doxygen)
IF (DOXYGEN_FOUND)
# click+jump in Emacs and Visual Studio (for doxy.config) (jw)
IF (CMAKE_BUILD_TOOL MATCHES "(msdev|devenv)")
SET(DOXY_WARN_FORMAT "\"$file($line) : $text \"")
ELSE (CMAKE_BUILD_TOOL MATCHES "(msdev|devenv)")
SET(DOXY_WARN_FORMAT "\"$file:$line: $text \"")
ENDIF (CMAKE_BUILD_TOOL MATCHES "(msdev|devenv)")
# we need latex for doxygen because of the formulas
FIND_PACKAGE(LATEX)
IF (NOT LATEX_COMPILER)
MESSAGE(STATUS "latex command LATEX_COMPILER not found but usually required. You will probably get warnings and user inetraction on doxy run.")
ENDIF (NOT LATEX_COMPILER)
IF (NOT MAKEINDEX_COMPILER)
MESSAGE(STATUS "makeindex command MAKEINDEX_COMPILER not found but usually required.")
ENDIF (NOT MAKEINDEX_COMPILER)
IF (NOT DVIPS_CONVERTER)
MESSAGE(STATUS "dvips command DVIPS_CONVERTER not found but usually required.")
ENDIF (NOT DVIPS_CONVERTER)
IF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in")
MESSAGE(STATUS "Generate ${CMAKE_CURRENT_BINARY_DIR}/doxy.config from doxy.config.in")
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in
${CMAKE_CURRENT_BINARY_DIR}/doxy.config
@ONLY )
# use (configured) doxy.config from (out of place) BUILD tree:
SET(DOXY_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/doxy.config")
ELSE (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in")
# use static hand-edited doxy.config from SOURCE tree:
SET(DOXY_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config")
IF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config")
MESSAGE(STATUS "WARNING: using existing ${CMAKE_CURRENT_SOURCE_DIR}/doxy.config instead of configuring from doxy.config.in file.")
ELSE (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config")
IF (EXISTS "${CMAKE_MODULE_PATH}/doxy.config.in")
# using template doxy.config.in
MESSAGE(STATUS "Generate ${CMAKE_CURRENT_BINARY_DIR}/doxy.config from doxy.config.in")
CONFIGURE_FILE(${CMAKE_MODULE_PATH}/doxy.config.in
${CMAKE_CURRENT_BINARY_DIR}/doxy.config
@ONLY )
SET(DOXY_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/doxy.config")
ELSE (EXISTS "${CMAKE_MODULE_PATH}/doxy.config.in")
# failed completely...
MESSAGE(SEND_ERROR "Please create ${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in (or doxy.config as fallback)")
ENDIF(EXISTS "${CMAKE_MODULE_PATH}/doxy.config.in")
ENDIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config")
ENDIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in")
ADD_CUSTOM_TARGET(doc ${DOXYGEN_EXECUTABLE} ${DOXY_CONFIG} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/doxy.config)
# create a windows help .chm file using hhc.exe
# HTMLHelp DLL must be in path!
# fallback: use hhw.exe interactively
IF (WIN32)
FIND_PACKAGE(HTMLHelp)
IF (HTML_HELP_COMPILER)
SET (TMP "${CMAKE_CURRENT_BINARY_DIR}\\doc\\html\\index.hhp")
STRING(REGEX REPLACE "[/]" "\\\\" HHP_FILE ${TMP} )
# MESSAGE(SEND_ERROR "DBG HHP_FILE=${HHP_FILE}")
ADD_CUSTOM_TARGET(winhelp ${HTML_HELP_COMPILER} ${HHP_FILE})
ADD_DEPENDENCIES (winhelp doc)
IF (NOT TARGET_DOC_SKIP_INSTALL)
# install windows help?
# determine useful name for output file
# should be project and version unique to allow installing
# multiple projects into one global directory
IF (EXISTS "${PROJECT_BINARY_DIR}/doc/html/index.chm")
IF (PROJECT_NAME)
SET(OUT "${PROJECT_NAME}")
ELSE (PROJECT_NAME)
SET(OUT "Documentation") # default
ENDIF(PROJECT_NAME)
IF (${PROJECT_NAME}_VERSION_MAJOR)
SET(OUT "${OUT}-${${PROJECT_NAME}_VERSION_MAJOR}")
IF (${PROJECT_NAME}_VERSION_MINOR)
SET(OUT "${OUT}.${${PROJECT_NAME}_VERSION_MINOR}")
IF (${PROJECT_NAME}_VERSION_PATCH)
SET(OUT "${OUT}.${${PROJECT_NAME}_VERSION_PATCH}")
ENDIF(${PROJECT_NAME}_VERSION_PATCH)
ENDIF(${PROJECT_NAME}_VERSION_MINOR)
ENDIF(${PROJECT_NAME}_VERSION_MAJOR)
# keep suffix
SET(OUT "${OUT}.chm")
#MESSAGE("DBG ${PROJECT_BINARY_DIR}/doc/html/index.chm \n${OUT}")
# create target used by install and package commands
INSTALL(FILES "${PROJECT_BINARY_DIR}/doc/html/index.chm"
DESTINATION "doc"
RENAME "${OUT}"
)
ENDIF(EXISTS "${PROJECT_BINARY_DIR}/doc/html/index.chm")
ENDIF(NOT TARGET_DOC_SKIP_INSTALL)
ENDIF(HTML_HELP_COMPILER)
# MESSAGE(SEND_ERROR "HTML_HELP_COMPILER=${HTML_HELP_COMPILER}")
ENDIF (WIN32)
ENDIF(DOXYGEN_FOUND)

View file

@ -0,0 +1,24 @@
# - pkg-config variable module for CMake
#
# Defines the following macros:
#
# PKGCONFIG_VAR(package varname outputvar)
#
include(UsePkgConfig REQUIRED)
MACRO(PKGCONFIG_VAR _package _varname _outputvar)
# reset the variables at the beginning
SET(${_outputvar})
# if pkg-config has been found
IF(PKGCONFIG_EXECUTABLE)
EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --exists RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull )
# and if the package of interest also exists for pkg-config, then get the information
IF(NOT _return_VALUE)
EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --variable=${_varname} OUTPUT_VARIABLE ${_outputvar} )
ENDIF(NOT _return_VALUE)
ENDIF(PKGCONFIG_EXECUTABLE)
ENDMACRO(PKGCONFIG_VAR _package _varname _outputvar)

View file

@ -0,0 +1,11 @@
static const char [] PACKAGE = "${APPLICATION_NAME}";
static const char [] VERSION = "${APPLICATION_VERSION}";
static const char [] PREFIX = "${CMAKE_INSTALL_PREFIX}";
static const char [] LOCALEDIR = "${LOCALE_INSTALL_DIR}";
static const char [] DATADIR = "${SHARE_INSTALL_PREFIX}";
static const char [] LIBDIR = "${LIB_INSTALL_DIR}";
static const char [] PLUGINDIR = "${PLUGIN_INSTALL_DIR}";
static const char [] SYSCONFDIR = "${SYSCONF_INSTALL_DIR}";
static const char [] RENDERER_X11 = "${BUILD_RENDERER_X11}";
static const char [] RENDERER_WIN = "${BUILD_RENDERER_WIN}";

View file

@ -0,0 +1,70 @@
#################################
# Project
##############
project(libraryA D)
#################################
# Dependencies
##############
# INotify
if (HAVE_INOTIFY_INIT)
set(INOTIFY_SOURCES "io/INotify.d")
set(INOTIFY_DEFINITIONS "${INOTIFY_DEFINITIONS} ${CMAKE_D_VERSION_FLAG}INotify" CACHE BOOLEAN TRUE FORCE)
endif (HAVE_INOTIFY_INIT)
#################################
# Compiler Switches
##############
INCLUDE_DIRECTORIES(
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}
)
link_directories(
)
add_definitions(
${INOTIFY_DEFINITIONS}
)
#################################
# Source Files
##############
add_library(A STATIC
core/Exception.d
${INOTIFY_SOURCES}
io/Output.d
mixins/BladeParse.d
mixins/HandyMixins.d
mixins/HandyMixinHelpers.d
)
#################################
# Linking
##############
target_link_libraries(A
)
#################################
# Clean ddoc's
##############
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_D_DDOC_CLEAN_FILES}")
#################################
# Install Files
##############
file(GLOB sources "${CMAKE_CURRENT_SOURCE_DIR}/*.d")
install(
FILES
${sources}
DESTINATION
include/FullSkeleton/A
)

View file

@ -0,0 +1,40 @@
/**
*
* Exception Class
*
* Authors: Tim Burrell
* Copyright: Copyright (c) 2007
* License: <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>
*
**/
////////////////////////////////////////////////////////////////////////////
// Module
///////////////////////////////////////
module libraryA.core.Exception;
////////////////////////////////////////////////////////////////////////////
// Imports
///////////////////////////////////////
import tango.core.Exception;
////////////////////////////////////////////////////////////////////////////
// Typedef's / Enums
///////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
// Exception Classes
///////////////////////////////////////
/**
* PathNotFoundException Class
**/
class PathNotFoundException : IOException {
/// Default Constructor
this (char [] Message) {
super(Message);
}
}

View file

@ -0,0 +1,95 @@
/**
*
* INotify Class
*
* Authors: Tim Burrell
* Copyright: Copyright (c) 2007
* License: <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>
*
**/
////////////////////////////////////////////////////////////////////////////
// Module
///////////////////////////////////////
module libraryA.io.INotify;
////////////////////////////////////////////////////////////////////////////
// Imports
///////////////////////////////////////
import libraryA.core.Exception;
////////////////////////////////////////////////////////////////////////////
// C Bindings
///////////////////////////////////////
extern (C) int inotify_init();
////////////////////////////////////////////////////////////////////////////
// Typedef's / Enums
///////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
// INotify Definition
///////////////////////////////////////
/**
* INotify Class
**/
class INotify {
////////////////////////////////////////////////////////////////////
// Constants
///////////////////////////////
////////////////////////////////////////////////////////////////////
// Public members
///////////////////////////////
////////////////////////////////////////////////////////////////////
// Construction
///////////////////////////////
/**
* Default Constructor
**/
this () {
// init inotify
if ((mInotifyFD = inotify_init()) < 0)
throw new Exception("Failed to Initialize INotify!");
}
/**
* Destructor
**/
~this () {
//close(mInotifyFD);
}
////////////////////////////////////////////////////////////////////
// Public Functions
///////////////////////////////
/**
* Add a path to be watched by INotify
*
* Params: WatchPatch = Patch to Watch
* Throws:
**/
void addWatch(char [] WatchPatch) {
}
////////////////////////////////////////////////////////////////////
private:
////////////////////////////////////////////////////////////////////
// Private Functions
///////////////////////////////
////////////////////////////////////////////////////////////////////
// Private Members
///////////////////////////////
int mInotifyFD; ///< Inotify File Descriptor
}

View file

@ -0,0 +1,106 @@
/**
*
* Output Class
*
* Authors: Tim Burrell
* Copyright: Copyright (c) 2007
* License: <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>
*
**/
////////////////////////////////////////////////////////////////////////////
// Module
///////////////////////////////////////
module libraryA.io.Output;
////////////////////////////////////////////////////////////////////////////
// Imports
///////////////////////////////////////
version (Tango) {
import tango.io.Stdout;
} else {
import std.stdio;
}
////////////////////////////////////////////////////////////////////////////
// Typedef's / Enums
///////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
// Output Definition
///////////////////////////////////////
/**
* Output Class
**/
class Output {
////////////////////////////////////////////////////////////////////
// Constants
///////////////////////////////
////////////////////////////////////////////////////////////////////
// Public members
///////////////////////////////
public alias output opCall; /// Alias opCall
////////////////////////////////////////////////////////////////////
// Construction
///////////////////////////////
/**
* Default Constructor
**/
this () {
}
/**
* Destructor
**/
~this () {
}
////////////////////////////////////////////////////////////////////
// Public Functions
///////////////////////////////
/**
* Output some text
*
* Params: LogLevel = Level of output
* Returns: Self
**/
final Output output(lazy char [] Output) {
version (Tango) {
Stdout(Output).newline;
} else {
writefln(Output);
}
return this;
}
////////////////////////////////////////////////////////////////////
private:
////////////////////////////////////////////////////////////////////
// Private Functions
///////////////////////////////
////////////////////////////////////////////////////////////////////
// Private Members
///////////////////////////////
}
////////////////////////////////////////////////////////////////////////////
// Globals
///////////////////////////////////////
static this() {
Out = new Output();
}
public static Output Out; /// Global Logout object

View file

@ -0,0 +1,130 @@
/**
*
* BladeParse
*
* Thanks to the <a href="http://www.dsource.org/projects/mathextra/">mathextra</a> project for this!
*
* Original source <a href="http://www.dsource.org/projects/mathextra/browser/trunk/blade/BladeParse.d">here</a>.
**/
module libraryA.mixins.BladeParse;
// General utilities.
char [] itoa(T)(T x)
{
char [] s="";
static if (is(T==byte)||is(T==short)||is(T==int)||is(T==long)) {
if (x<0) {
s = "-";
x = -x;
}
}
do {
s = cast(char)('0' + (x%10)) ~ s;
x/=10;
} while (x>0);
return s;
}
bool isDigit(char c) { return c>='0' && c<='9'; }
bool isHexDigit(char c) { return c>='0' && c<='9' || c>='a' && c<='f' || c>='A' && c<='F'; }
bool isAlpha(char c) {
return (c>='a' && c<='z') || (c>='A' && c<='Z');
}
// Underscores allowed
bool isUnderscoreDigit(char c) { return c=='_' || c>='0' && c<='9'; }
bool isUnderscoreHexDigit(char c) { return c=='_' || c>='0' && c<='9' || c>='a' && c<='f' || c>='A' && c<='F'; }
bool isUnderscoreAlpha(char c) {
return c=='_' || (c>='a' && c<='z') || (c>='A' && c<='Z');
}
unittest {
assert(isHexDigit('9'));
}
// Extract a D identifier. Return the remainder of the string.
char [] parseIdentifier(char [] s, out char [] rest)
{
int i=0;
if (!isUnderscoreAlpha(s[0])) { assert(0, "Identifier expected"); }
while (i<s.length && (isUnderscoreAlpha(s[i])||isDigit(s[i]))) ++i;
char [] ident=s[0..i];
while (i<s.length && s[i]==' ') ++i; // skip trailing spaces
rest = s[i..$];
return ident;
}
char [] parseNumber(char [] s, out char[] rest)
{
int k=0;
while(k<s.length && isDigit(s[k])) ++k;
if (k<s.length-1 && s[k]=='.' && s[k+1]!='.') {
++k;
while(k<s.length && isDigit(s[k])) ++k;
if (k<s.length && s[k]=='e') { ++k;
if (k<s.length && (s[k]=='+' || s[k]=='-')) ++k;
while(k<s.length && isDigit(s[k])) ++k;
}
if (k<s.length && (s[k]=='L' || s[k]=='f')) ++k;
}
char [] ident = s[0..k];
int i=k;
while (i<s.length && s[i]==' ') ++i; // skip trailing spaces
rest = s[i..$];
return ident;
}
char [] parseOperator(char [] s, out char [] rest)
{
int i=1;
if (s[0]=='+' || s[0]=='-' || s[0]=='*') {
if (s.length>1 && s[1]=='=') ++i;
int k=i;
while (k<s.length && s[k]==' ') ++k; // skip trailing spaces
rest = s[k..$];
return s[0..i];
} else {
assert(0, `Operator expected, not "` ~ s~ `"`);
}
}
char [] parseQualifiedName(char [] s, out char[] rest)
{
char [] r;
char [] id = parseIdentifier(s, r);
while (r.length>0 && r[0]=='.') {
int i;
for (i=1; r[i]==' '; ++i) {}
id ~= "." ~ parseIdentifier(r[i..$], r);
}
rest=r;
return id;
}
// Some functions to grab information from the typestring.
// Return the first index in the tuple which is of vector type
int findFirstVector(char [][] typelist)
{
for (int i=0; i< typelist.length;++i) {
if (isVector(typelist[i])) return i;
}
return 0;
}
bool isVector(char [] typestr)
{
return (typestr[0]=='V' || typestr[0]=='Z');
}
// Count the number of vectors in the typestring
int countVectors(char [][] typelist)
{
int numVecs=0;
for (int i=0; i<typelist.length; ++i) {
if (isVector(typelist[i])) ++numVecs;
}
return numVecs;
}

View file

@ -0,0 +1,44 @@
/**
*
* Handy Mixin Helpers
*
* Authors: Tim Burrell
* Copyright: Copyright (c) 2007
* License: <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>
*
**/
////////////////////////////////////////////////////////////////////////////
// Module
///////////////////////////////////////
module libraryA.mixins.HandyMixinHelpers;
////////////////////////////////////////////////////////////////////////////
// Imports
///////////////////////////////////////
import libraryA.mixins.BladeParse;
////////////////////////////////////////////////////////////////////////////
// Mixin Helpers (like not useful on their own)
///////////////////////////////////////
/// for use with enumConditional
char [] createEnumConditionalLoop(int Size) {
char [] ret = "bool NeedsComma = false;\n";
for (int lp = 1; lp < Size; lp += 2) {
char [] curVal = itoa(lp);
char [] curValMinus1 = itoa(lp - 1);
ret ~= "if ( (T.length > " ~ curVal ~") && (T[" ~ curVal ~ "]) ) {";
if (lp > 1) {
ret ~= " if (NeedsComma) {"
" ret ~= \",\n\";"
" }";
}
ret ~= " ret ~= \"\t\" ~ T[" ~ curValMinus1 ~ "];"
" NeedsComma = true;"
"}";
}
return ret;
}

View file

@ -0,0 +1,103 @@
/**
*
* Handy Mixins
*
* Authors: Tim Burrell
* Copyright: Copyright (c) 2007
* License: <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>
*
**/
////////////////////////////////////////////////////////////////////////////
// Module
///////////////////////////////////////
module libraryA.mixins.HandyMixins;
////////////////////////////////////////////////////////////////////////////
// Imports
///////////////////////////////////////
import libraryA.mixins.HandyMixinHelpers;
////////////////////////////////////////////////////////////////////////////
// Mixins
///////////////////////////////////////
/**
* Auto build class member
*
* Params: Type = Type of the property
* Name = Name of the property
* Returns: String containing the resulting property
**/
template prop(Type, char [] Name) {
const char [] prop = "private " ~ Type.stringof ~ " " ~ Name ~ ";" ;
}
/**
* Auto build setter
*
* Params: Type = Type of the property
* Name = Name of the property
* Returns: String containing the resulting property
**/
template propWrite(Type, char [] Name) {
const char [] propWrite = "void set" ~ Name ~ "(inout " ~ Type.stringof ~ " The" ~ Name ~ ") { "
~ Name ~ " = The" ~ Name ~ "; }; \n\n"
~ prop!(Type, Name);
}
/**
* Auto build getter
*
* Params: Type = Type of the property
* Name = Name of the property
* Returns: String containing the resulting property
*
* Bugs: Not Implemented!
**/
template propRead(Type, char [] Name) {
const char [] propRead = "void set" ~ Name ~ "(inout " ~ Type.stringof ~ " The" ~ Name ~ ") { "
~ Name ~ " = The" ~ Name ~ "; }; \n\n"
~ prop!(Type, Name);
}
/**
* Conditionally construct an enum
*
* Params: Name = Name of the enum
* T = Enum elements and their conditions
* Returns: String containing the resulting enum
*
* Example:
* -------------------------------------------------------------------------
* const char [] RENDERER_CURSES = "False";
* const char [] RENDERER_VT102 = "True";
* const char [] RENDERER_X11 = "True";
*
* mixin(enumConditional!("RendererClass",
* "RendererCurses", RENDERER_CURSES == "True",
* "RendererVT102", RENDERER_VT102 == "True",
* "RendererX11", RENDERER_X11 == "True"
* ).createEnum());
* -------------------------------------------------------------------------
* Would result in the following enum:
* -------------------------------------------------------------------------
* enum {
* RendererVT102,
* RendererX11
* }
* -------------------------------------------------------------------------
* Obviously, this is all done at compile time.
**/
template enumConditional(char [] Name, T...) {
//alias T tupleof;
char [] createEnum() {
char [] ret = "enum " ~ Name ~ " {\n";
mixin(createEnumConditionalLoop(T.length));
return ret ~ "\n}";
}
}

View file

@ -0,0 +1,76 @@
#################################
# Project
##############
project(libraryB D)
#################################
# Dependencies
##############
# x11 plugin
if (BUILD_RENDERER_X11)
find_package(X11 REQUIRED)
set(RENDERER_X11_SOURCES
"render/RendererX11.d"
)
set(RENDERER_DEFINITIONS "${RENDERER_DEFINITIONS} ${CMAKE_D_VERSION_FLAG}RendererX11" CACHE BOOLEAN TRUE FORCE)
endif (BUILD_RENDERER_X11)
# windows renderer
if (BUILD_RENDERER_WIN)
set(RENDERER_WIN_SOURCES
"render/RendererWindows.d"
)
set(RENDERER_DEFINITIONS "${RENDERER_DEFINITIONS} ${CMAKE_D_VERSION_FLAG}RendererWin" CACHE BOOLEAN TRUE FORCE)
endif (BUILD_RENDERER_WIN)
#################################
# Compiler Switches
##############
include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}
${X11_INCLUDE_DIR}
)
link_directories(
)
add_definitions(
${RENDERER_DEFINITIONS}
)
#################################
# Source Files
##############
add_library(B STATIC
LibraryB.d
render/Renderer.d
${RENDERER_X11_SOURCES}
${RENDERER_WIN_SOURCES}
)
#################################
# Linking
##############
target_link_libraries(B
A
${X11_LIBRARIES}
)
#################################
# Install Files
##############
file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.d")
install(
FILES
${headers}
DESTINATION
include/FullSkeleton/B
)

View file

@ -0,0 +1,131 @@
/**
*
* Main LibraryB Class
*
* Authors: Tim Burrell
* Copyright: Copyright (c) 2007
* License: <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>
*
**/
////////////////////////////////////////////////////////////////////////////
// Module
///////////////////////////////////////
module libraryB.LibraryB;
////////////////////////////////////////////////////////////////////////////
// Imports
///////////////////////////////////////
import config;
import libraryB.render.Renderer;
version(RendererX11) {
import libraryB.render.RendererX11;
}
version(RendererWin) {
import libraryB.render.RendererWin;
}
import libraryA.io.Output;
import libraryA.mixins.HandyMixins;
////////////////////////////////////////////////////////////////////////////
// Typedef's / enums
///////////////////////////////////////
/**
* RendererClass Enum
*
* Conditional Enum that can have different elements based on what
* Renderers have been selected for compilation
**/
mixin(enumConditional!("RendererClass",
"RendererX11", RENDERER_X11 == "True",
"RendererWin", RENDERER_WIN == "True"
).createEnum());
////////////////////////////////////////////////////////////////////////////
// Class Definition
///////////////////////////////////////
/**
* This is the main instance of LibraryB
*
* Your program should inherit this class
**/
class LibraryB {
////////////////////////////////////////////////////////////////////
// Construction
///////////////////////////////
/**
* Default Constructor
**/
this() {
Out("Construct Library B");
}
/**
* Destructor
**/
~this() {
Out("Destruct Library B");
}
////////////////////////////////////////////////////////////////////
// Public functions
///////////////////////////////
/**
* Enter the processing loop
**/
void enterLoop() {
if (mRenderer is null)
throw new Exception("You must intialize LibraryB!");
// do event loop here!
}
/**
* Initialize LibraryB with a specific renderer
*
* Params: Renderer = Renderer to use
**/
void initialize(RendererClass Renderer) {
// allocate the renderer
switch (Renderer) {
version(RendererX11) {
case RendererClass.RendererX11:
mRenderer = new RendererX11();
break;
}
version(RendererWin) {
case RendererClass.RendererWin:
mRenderer = new RendererWindows();
break;
}
default:
throw new Exception("Invalid Renderer Specified!");
}
// initialize the renderer
mRenderer.initialize();
}
////////////////////////////////////////////////////////////////////
private:
////////////////////////////////////////////////////////////////////
// Private Functions
///////////////////////////////
////////////////////////////////////////////////////////////////////
// Private Members
///////////////////////////////
Renderer mRenderer; /// The renderer
}

View file

@ -0,0 +1,65 @@
/**
*
* enCurseD Renderer Class
*
* Authors: Tim Burrell
* Copyright: Copyright (c) 2007
* License: <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>
*
**/
////////////////////////////////////////////////////////////////////////////
// Module
///////////////////////////////////////
module enCurseD.render.Renderer;
////////////////////////////////////////////////////////////////////////////
// Imports
///////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
// Class Definition
///////////////////////////////////////
/**
* Renderer Class
**/
class Renderer {
////////////////////////////////////////////////////////////////////
// Construction
///////////////////////////////
/**
* Default Constructor
**/
this() {
}
/**
* Destructor
**/
~this() {
}
////////////////////////////////////////////////////////////////////
// Public functions
///////////////////////////////
/**
* Initialize the renderer
**/
abstract void initialize();
////////////////////////////////////////////////////////////////////
private:
////////////////////////////////////////////////////////////////////
// Private Functions
///////////////////////////////
////////////////////////////////////////////////////////////////////
// Private Members
///////////////////////////////
}

View file

@ -0,0 +1,72 @@
/**
*
* enCurseD RendererWindows Class
*
* Authors: Tim Burrell
* Copyright: Copyright (c) 2007
* License: <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>
*
**/
////////////////////////////////////////////////////////////////////////////
// Module
///////////////////////////////////////
module libraryB.render.RendererWindows;
////////////////////////////////////////////////////////////////////////////
// Imports
///////////////////////////////////////
import libraryB.render.Renderer;
import libraryA.io.Output;
////////////////////////////////////////////////////////////////////////////
// Class Definition
///////////////////////////////////////
/**
* RendererWindows Class
**/
class RendererWindows : Renderer {
////////////////////////////////////////////////////////////////////
// Construction
///////////////////////////////
/**
* Default Constructor
**/
this() {
}
/**
* Destructor
**/
~this() {
}
////////////////////////////////////////////////////////////////////
// Public functions
///////////////////////////////
/**
* Initialize the renderer
**/
void initialize() {
Out("LibraryA Windows Renderer Initializing...");
Out("LibraryA Windows Renderer Initialized");
}
////////////////////////////////////////////////////////////////////
private:
////////////////////////////////////////////////////////////////////
// Private Functions
///////////////////////////////
////////////////////////////////////////////////////////////////////
// Private Members
///////////////////////////////
}

View file

@ -0,0 +1,72 @@
/**
*
* enCurseD RendererX11 Class
*
* Authors: Tim Burrell
* Copyright: Copyright (c) 2007
* License: <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>
*
**/
////////////////////////////////////////////////////////////////////////////
// Module
///////////////////////////////////////
module libraryB.render.RendererX11;
////////////////////////////////////////////////////////////////////////////
// Imports
///////////////////////////////////////
import libraryB.render.Renderer;
import libraryA.io.Output;
////////////////////////////////////////////////////////////////////////////
// Class Definition
///////////////////////////////////////
/**
* RendererX11 Class
**/
class RendererX11 : Renderer {
////////////////////////////////////////////////////////////////////
// Construction
///////////////////////////////
/**
* Default Constructor
**/
this() {
}
/**
* Destructor
**/
~this() {
}
////////////////////////////////////////////////////////////////////
// Public functions
///////////////////////////////
/**
* Initialize the renderer
**/
void initialize() {
Out("LibraryB X11 Renderer Initializing...");
Out("LibraryB X11 Renderer Initialized");
}
////////////////////////////////////////////////////////////////////
private:
////////////////////////////////////////////////////////////////////
// Private Functions
///////////////////////////////
////////////////////////////////////////////////////////////////////
// Private Members
///////////////////////////////
}

View file

@ -0,0 +1,71 @@
#################################
if (BUILD_CLIENT)
#################################
# Project
##############
project(ProgramClient D)
#################################
# Dependencies
##############
#################################
# Compiler Switches
##############
include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}
)
link_directories(
${CMAKE_BINARY_DIR}/libraryA
${CMAKE_BINARY_DIR}/libraryB
)
add_definitions(
${RENDERER_DEFINITIONS}
)
#################################
# Source Files
##############
add_executable(client
ProgramClient.d
ProgramClientApp.d
ProgramClientMain.d
)
#################################
# Linking
##############
target_link_libraries(client
A
B
)
#################################
# Install Files
##############
file(GLOB sources "${CMAKE_CURRENT_SOURCE_DIR}/*.d")
install(
FILES
${sources}
DESTINATION
include/FullSkeleton
)
install(TARGETS client
RUNTIME DESTINATION bin
)
#################################
endif (BUILD_CLIENT)

View file

@ -0,0 +1,74 @@
/**
*
* Main ProgramClient Class -- This is where everything happens!
*
* Authors: Tim Burrell
* Copyright: Copyright (c) 2007
* License: <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>
*
**/
////////////////////////////////////////////////////////////////////////////
// Module
///////////////////////////////////////
module programClient.ProgramClient;
////////////////////////////////////////////////////////////////////////////
// Imports
///////////////////////////////////////
import config;
import libraryB.LibraryB;
import libraryA.io.Output;
////////////////////////////////////////////////////////////////////////////
// Definitions
///////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
// Class Definition
///////////////////////////////////////
/**
* This is the main ProgramClient class
**/
class ProgramClient : LibraryB {
////////////////////////////////////////////////////////////////////
// Construction
///////////////////////////////
/**
* Default Constructor
**/
this() {
}
/**
* Destructor
**/
~this() {
}
////////////////////////////////////////////////////////////////////
// Public Members
///////////////////////////////
////////////////////////////////////////////////////////////////////
// Public functions
///////////////////////////////
////////////////////////////////////////////////////////////////////
private:
////////////////////////////////////////////////////////////////////
// Private Functions
///////////////////////////////
////////////////////////////////////////////////////////////////////
// Private Members
///////////////////////////////
}

View file

@ -0,0 +1,128 @@
/**
*
* ProgramClientApp Class -- Common app init code encapsulation
*
* Authors: Tim Burrell
* Copyright: Copyright (c) 2007
* License: <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>
*
**/
////////////////////////////////////////////////////////////////////////////
// Module
///////////////////////////////////////
module programClient.ProgramClientApp;
////////////////////////////////////////////////////////////////////////////
// Imports
///////////////////////////////////////
import config;
import programClient.ProgramClient;
import libraryB.LibraryB;
import libraryA.io.Output;
////////////////////////////////////////////////////////////////////////////
// Definitions
///////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
// Class Definition
///////////////////////////////////////
/**
* This is the ProgramClientApp class. It is responsible for handling init stuff
* like command line parsing and so forth.
**/
class ProgramClientApp : ProgramClient {
////////////////////////////////////////////////////////////////////
// Construction
///////////////////////////////
/**
* Default Constructor
**/
this(char [][] Args) {
Out(props());
initialize(Args);
}
/**
* Destructor
**/
~this() {
Out("Shutting Down...");
}
////////////////////////////////////////////////////////////////////
// Public functions
///////////////////////////////
/**
* Get help info
**/
char [] getHelp() {
char [] output = "You must specify a renderer. Available renderers: ";
version (RendererX11)
output ~= "x11 ";
version (RendererWin)
output ~= "windows ";
return output;
}
/**
* Get the program's propers
*
* Returns: Formatted propers
**/
char [] props() {
return "\n" ~ PACKAGE ~ " v" ~ VERSION ~ " -=- (c) 2007\n";
}
////////////////////////////////////////////////////////////////////
private:
////////////////////////////////////////////////////////////////////
// Private Functions
///////////////////////////////
/**
* Initialize the program
*
* Params: Args = Command line arguments
* Throws: Exception If initialization error occurs
**/
void initialize(char [][] Args) {
if (Args.length < 2)
throw new Exception(getHelp());
bool RendererFound = false;
version (RendererX11) {
if (Args[1] == "x11") {
mRendererClass = RendererClass.RendererX11;
RendererFound = true;
}
}
version (RendererWin) {
if (Args[1] == "windows") {
mRendererClass = RendererClass.RendererWin;
RendererFound = true;
}
}
if (RendererFound)
ProgramClient.initialize(mRendererClass);
else
throw new Exception(getHelp());
}
////////////////////////////////////////////////////////////////////
// Private Members
///////////////////////////////
RendererClass mRendererClass; /// Renderer class
}

View file

@ -0,0 +1,52 @@
/**
*
* FullSkeleton -- A skeleton for your CMakeD app
*
* Authors: Tim Burrell
* Copyright: Copyright (c) 2007
* License: <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>
*
**/
////////////////////////////////////////////////////////////////////////////
// Module
///////////////////////////////////////
module programClient.ProgramClientMain;
////////////////////////////////////////////////////////////////////////////
// Imports
///////////////////////////////////////
import config;
import programClient.ProgramClientApp;
import libraryA.io.Output;
////////////////////////////////////////////////////////////////////////////
// Main
///////////////////////////////////////
/**
* Main function
**/
void main(char [][] Args) {
// create the App
scope ProgramClientApp App;
try {
App = new ProgramClientApp(Args);
} catch (Exception e) {
Out("Unable to Initialize " ~ PACKAGE ~ ":\n " ~ e.msg ~ "\n");
return -1;
}
// run the app
try {
App.enterLoop();
} catch (Exception e) {
Out("Unable to Run " ~ PACKAGE ~ ": " ~ e.msg ~ "\n");
return -1;
}
}

View file

@ -0,0 +1,68 @@
#################################
if (BUILD_SERVER)
#################################
# Project
##############
project(ProgramServer D)
#################################
# Dependencies
##############
#################################
# Compiler Switches
##############
include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}
)
link_directories(
${CMAKE_BINARY_DIR}/libraryA
${CMAKE_BINARY_DIR}/libraryB
)
add_definitions(
)
#################################
# Source Files
##############
add_executable(server
ProgramServerMain.d
)
#################################
# Linking
##############
target_link_libraries(server
A
B
)
#################################
# Install Files
##############
file(GLOB sources "${CMAKE_CURRENT_SOURCE_DIR}/*.d")
install(
FILES
${sources}
DESTINATION
include/FullSkeleton
)
install(TARGETS server
RUNTIME DESTINATION bin
)
#################################
endif (BUILD_SERVER)

View file

@ -0,0 +1,34 @@
/**
*
* ProgramServer -- A conditionally built server
*
* Authors: Tim Burrell
* Copyright: Copyright (c) 2007
* License: <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>
*
**/
////////////////////////////////////////////////////////////////////////////
// Module
///////////////////////////////////////
module programServer.ProgramServerMain;
////////////////////////////////////////////////////////////////////////////
// Imports
///////////////////////////////////////
import config;
import libraryA.io.Output;
////////////////////////////////////////////////////////////////////////////
// Main
///////////////////////////////////////
/**
* Main function
**/
void main(char [][] Args) {
Out("Conditionally Built Server says hello!");
}