Commit cae43661 authored by Robert Frohl's avatar Robert Frohl

[CHANGE] - update for the module layouting graph

parent 6e081e93
......@@ -26,4 +26,5 @@ dirk_albrecht@gmx.net Dirk_Albrecht
albrecht Dirk_Albrecht
mstuber Marcus_Stuber
skiunke Sebastian_Kiunke
a_berres@informatik.uni-kl.de Anne_Berres
\ No newline at end of file
a_berres@informatik.uni-kl.de Anne_Berres
gsommer_by@gmx.de Gerald_Sommer
\ No newline at end of file
......@@ -7,6 +7,7 @@ syntax: glob
# switch to regexp syntax.
syntax: regexp
^doc/core/html
^doc/developer/html
^doc/developer/man
^doc/developer/doxyerror.log
......
We keep this README short, since we have much documentation and information
online. So, for detailed information have a look at http://www.openwalnut.org.
OpenWalnut
==========
OpenWalnut is an open source tool for multi-modal medical and brain data
visualization. Its universality allows it to be easily extended and used in a
large variety of application cases. It is both, a tool for the scientific user
and a powerful framework for the visualization researcher. OpenWalnut is
licensed under the terms of the GNU Lesser General Public License. Written
entirely in Standard C++ and using a number of portable libraries (e.g.
OpenSceneGraph and Qt), it runs on all Windows platforms, OSX, and
GNU/Linux operating systems.
- please refer to http://www.openwalnut.org for extensive documentation
and information.
AUTHORS AND CONTRIBUTORS
========================
See the files "AUTHORS" and "CONTRIBUTORS".
LICENSE
=======
We provide dual licensing. You can choose to use either GPLv3 or LGPLv3.
See "COPYING" and "COPYING.LESSER".
CONTACT
=======
......@@ -19,9 +42,25 @@ If you have questions, comments, problems or find Bugs, contact us using:
follow the instructions.
* IRC: Occasionally you can contact us at irc.freenode.net #ow.
INSTALLING
==========
You have several options for installing OpenWalnut.
* Build it -> see next section
* Download a binary archive from our website and extract it
* Inside the extracted directory, run bin/openwalnut
* Download one of our binary packages for your distribution
* Check the NeuroDebian repository
* We are currently working on a OpenWalnut package which is intended to be
released in NeuroDebian (http://neuro.debian.net/)
BUILDING
========
As you currently read this README, we presume that you already have the source.
If not, check http://www.openwalnut.org. There, you can download source archives
and get the URL to our mercurial repository.
Required Dependencies:
----------------------
......@@ -38,12 +77,18 @@ by using the common routine:
cd build
cmake ../src
make
make install -- this is optional
make install -- this is optional and installs everything.
After that, OpenWalnut can be used inside the build directory.
Compilation on Windows:
-----------------------
If you want to install only a part of OpenWalnut, you can issue
make list_install_tarets
The listed targets will then only install the specified part.
Compilation on Windows and Mac:
-------------------------------
This is a little bit more complicated. We give you a step-by-step explanation
on http://www.openwalnut.org.
......
CHECKOUT
# OW Version File. This file specifies the version. The line VERSION=X.Y.Z is
# used and parsed. If you do not want a version, comment it out.
#
# IMPORTANT: If you modify the file, cmake re-creates the version header. But
# it is not able to set all library version. Please re-run cmake if
# you change something here.
#
# NOTE: do not add a space after #. The current CMake script will fail.
#VERSION=1.3.0
......@@ -82,20 +82,22 @@ ENDIF()
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# mimic layout of install dir for build:
SET( OW_CONFIG_DIR_RELATIVE "etc/OpenWalnut" )
SET( OW_CONFIG_DIR ${PROJECT_BINARY_DIR}/${OW_CONFIG_DIR_RELATIVE} )
SET( OW_SHARE_DIR_RELATIVE "share/OpenWalnut" )
SET( OW_SHARE_DIR ${PROJECT_BINARY_DIR}/${OW_SHARE_DIR_RELATIVE} )
SET( OW_DOC_DIR_RELATIVE "share/doc/OpenWalnut" )
SET( OW_DOC_DIR ${PROJECT_BINARY_DIR}/${OW_DOC_DIR_RELATIVE} )
# these dirs are the same for all parts of OW
SET( OW_RUNTIME_DIR_RELATIVE "bin" )
SET( OW_RUNTIME_DIR ${PROJECT_BINARY_DIR}/${OW_RUNTIME_DIR_RELATIVE} )
SET( OW_LIBRARY_DIR_RELATIVE "lib" )
SET( OW_LIBRARY_DIR ${PROJECT_BINARY_DIR}/${OW_LIBRARY_DIR_RELATIVE} )
SET( OW_ARCHIVE_DIR_RELATIVE "lib" )
SET( OW_ARCHIVE_DIR ${PROJECT_BINARY_DIR}/${OW_ARCHIVE_DIR_RELATIVE} )
SET( OW_MODULE_DIR_RELATIVE "lib/OpenWalnut" )
SET( OW_MODULE_DIR_RELATIVE "lib/openwalnut" )
SET( OW_MODULE_DIR ${PROJECT_BINARY_DIR}/${OW_MODULE_DIR_RELATIVE} )
SET( OW_MAN_DIR_RELATIVE "share/man" )
SET( OW_MAN_DIR "${PROJECT_BINARY_DIR}/share/man" )
# One could also define this for every part of OW, but it does not make sense. It is "share" because it is shared among the different parts
SET( OW_SHARE_DIR_RELATIVE "share/openwalnut" )
SET( OW_SHARE_DIR ${PROJECT_BINARY_DIR}/${OW_SHARE_DIR_RELATIVE} )
# set our paths for install targets
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OW_RUNTIME_DIR} )
......@@ -159,21 +161,45 @@ IF( NOT CMAKE_HOST_SYSTEM MATCHES "Windows" )
OPTION( OW_LINK_SHADERS "If turned on, shaders do not get copied. They get linked. This is a nice option for developers." OFF )
ENDIF()
# Provide several options to control some aspects of resource copy.
OPTION( OW_PACKAGE_BUILD "Enable this to get fine-grained control over several resources and files getting installed. This is very handy for package building." OFF )
IF( OW_PACKAGE_BUILD )
OPTION( OW_PACKAGE_NOCOPY_LICENSE "Disable to copy our licensing information. Enabling this can be useful for package maintainer since several packaging systems have their own licence mechanism (i.e. Debian)." OFF )
OPTION( OW_PACKAGE_NOLINK_OPENTHREADS "Enable this to avoid linking OpenThreads. On some systems, OpenSceneGraph already is linked against it and thus linking OpenThreads to OW is not needed (Debian and Ubuntu for example)." OFF )
ENDIF()
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# The walnut executable should print the revision/tag
# The openwalnut executable should print the revision/tag
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# Generate needed headers
# NOTE: add a line ADD_DEPENDENCIES( XYZ OW_generate_version_header ) to your target XYZ if you need the header!
SET( OW_VERSION_HEADER ${PROJECT_SOURCE_DIR}/WVersion.h )
SET( OW_VERSION_HEADER_DIRECTORY ${PROJECT_BINARY_DIR}/versionHeader )
SET( OW_VERSION_HEADER ${OW_VERSION_HEADER_DIRECTORY}/WVersion.h )
# to allow all those targets to find the header:
INCLUDE_DIRECTORIES( ${OW_VERSION_HEADER_DIRECTORY} )
# Setup the target
SETUP_VERSION_HEADER( ${OW_VERSION_HEADER} )
# Set the OW version string. This can be used by others for setting target versions during compilation.
GET_VERSION_STRING( dummy OW_VERSION "1.0.0 " )
IF( NOT DEFINED OW_VERSION )
# CMake does not like unset variables for target properties.
SET( OW_VERSION "1.0.0" )
ENDIF()
# We need a SOVERSION too. This somehow describes the API compatibility. We use the major number here.
SPLIT_VERSION_STRING( ${OW_VERSION} OW_VERSION_MAJOR OW_VERSION_MINOR OW_VERSION_PATCH )
SET( OW_SOVERSION ${OW_VERSION_MAJOR} )
# ---------------------------------------------------------------------------------------------------------------------------------------------------
#
# REQUIRED third party libs
#
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# NOTE: please also have a look in src/ext/CMakeLists.txt. Other third-party libs might be searched there.
# -----------------------------------------------------------------------------------------------------------------------------------------------
# Boost, at least 1.39
# See http://www.boost.org/
......@@ -214,10 +240,72 @@ IF( CMAKE_GENERATOR MATCHES "Visual Studio" )
SET ( CMAKE_PREFIX_PATH "$ENV{ProgramFiles}/OpenSceneGraph" )
ENDIF()
ENDIF()
FIND_PACKAGE( OpenSceneGraph ${MIN_OSG_VERSION} REQUIRED osgDB osgUtil osgGA osgViewer osgSim osgWidget osgText OpenThreads )
FIND_PACKAGE( OpenSceneGraph ${MIN_OSG_VERSION} REQUIRED osgDB osgUtil osgGA osgViewer osgSim osgWidget osgText )
# If the user did not disable license-copying, do it
# NOTE: use this "double-negative" to use the fact that undefined variables yield FALSE.
IF( OW_PACKAGE_NOLINK_OPENTHREADS )
# NOTE: this is a hack to remove the openthread lib from the list of OSG libs. It gets automatically added by the current
# find script but it is not really needed on some systems (since they provide an osg lib which already is linked against this.).
FOREACH( osglib ${OPENSCENEGRAPH_LIBRARIES} )
STRING( REGEX MATCH ".*OpenThreads.*" IsExcluded "${osglib}" )
IF( IsExcluded )
LIST( REMOVE_ITEM OPENSCENEGRAPH_LIBRARIES ${osglib} )
ENDIF( IsExcluded )
ENDFOREACH()
ENDIF()
# -----------------------------------------------------------------------------------------------------------------------------------------------
# NiftiLib, at least 2.0.0
# See http://niftilib.sourceforge.net
# we provide the niftilib in ext. If it is found on the system, the system version is used
SET( OWExtNiftiIOName "openwalnut_niftiio" )
SET( OWExtNiftiZNZName "openwalnut_niftiznz" )
FIND_PACKAGE( niftilib QUIET )
IF( NIFTILIB_FOUND )
MESSAGE( STATUS "Using system installed nifitlib." )
INCLUDE_DIRECTORIES( ${NIFTILIB_INCLUDE_DIR} )
SET( OWExtNiftiIOName ${NIFTILIB_LIBRARY} )
ELSE()
INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/ext/nifti )
ADD_SUBDIRECTORY( ext/nifti )
ENDIF()
# include the header paths
INCLUDE_DIRECTORIES( ${OPENSCENEGRAPH_INCLUDE_DIRS} )
# -----------------------------------------------------------------------------------------------------------------------------------------------
# BioSig, at least 0.84
# See http://biosig.sourceforge.net
# we provide the biosig in ext. If it is found on the system, the system version is used
SET( OWExtBioSigName "openwalnut_biosig" )
FIND_PACKAGE( biosig QUIET )
IF( BIOSIG_FOUND )
MESSAGE( STATUS "Using system installed biosig." )
INCLUDE_DIRECTORIES( ${BIOSIG_INCLUDE_DIR} )
SET( OWExtBioSigName ${BIOSIG_LIBRARY} )
ELSE()
IF( NOT CMAKE_GENERATOR MATCHES "Visual Studio" )
INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/ext/biosig )
ADD_SUBDIRECTORY( ext/biosig )
ELSE ()
INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/ext/biosigWin )
ADD_SUBDIRECTORY( ext/biosigWin )
ENDIF()
ENDIF()
# -----------------------------------------------------------------------------------------------------------------------------------------------
# Eigen3, at least 3.0.0
# See http://eigen.tuxfamily.org
FIND_PACKAGE( eigen3 QUIET )
IF( EIGEN3_FOUND )
MESSAGE( STATUS "Using system installed eigen3." )
INCLUDE_DIRECTORIES( ${EIGEN3_INCLUDE_DIR} )
ELSE()
INCLUDE_DIRECTORIES( "${PROJECT_SOURCE_DIR}/ext/eigen3" )
ENDIF()
# ---------------------------------------------------------------------------------------------------------------------------------------------------
#
......@@ -266,20 +354,20 @@ ADD_CUSTOM_TARGET( vtest
# ---------------------------------------------------------------------------------------------------------------------------------------------------
#
# Resource Copy
# - This simply copies the structure from ../resources to the build directory
# Resource/Doc Copy
# - Resource copy is done by the OW parts. This just copies additional helpers
#
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# Setup everything in ../resources
SETUP_RESOURCES()
# this is done once -> create one default walnut.cfg
IF( NOT EXISTS ${OW_CONFIG_DIR}/walnut.cfg )
CONFIGURE_FILE( ${PROJECT_SOURCE_DIR}/../resources/etc/OpenWalnut/walnut.cfg.official ${OW_CONFIG_DIR}/walnut.cfg COPYONLY )
MESSAGE( STATUS "Copied walnut.cfg.official to ${OW_CONFIG_DIR}/walnut.cfg" )
# copy our debug utilities. This is only useful if compiled debug or RelWithDebInfo
IF( NOT cmake_build_type_tolower STREQUAL "release" )
# NOTE: DO NOT add and install target here. Debugging tools are not useful and wished in an OpenWalnut installation.
ADD_CUSTOM_TARGET( CopyDebugUtilities
ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory "${PROJECT_SOURCE_DIR}/../tools/debugging" "${PROJECT_BINARY_DIR}/"
COMMENT "Copying debug utilities"
)
ENDIF()
INSTALL( FILES ${PROJECT_SOURCE_DIR}/../resources/etc/OpenWalnut/walnut.cfg.official DESTINATION ${OW_CONFIG_DIR_RELATIVE} RENAME walnut.cfg )
# ---------------------------------------------------------------------------------------------------------------------------------------------------
#
......@@ -319,16 +407,6 @@ ADD_CUSTOM_TARGET( doc
VERBATIM
)
# NOTE: this full documentation also includes call/caller graphs, colaboration graphs and nicer inheritance graphs
# but needs "dot" from graphviz to render them.
ADD_CUSTOM_TARGET( fulldoc
COMMAND doxygen ${PROJECT_SOURCE_DIR}/../doc/developer/doxygenConfigFull
COMMAND chmod -R g+r ${PROJECT_SOURCE_DIR}/../doc/developer/htmlFull
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/..
COMMENT "Build verbose doxygen documentation"
VERBATIM
)
# ---------------------------------------------------------------------------------------------------------------------------------------------------
#
# Style
......@@ -368,10 +446,53 @@ ADD_CUSTOM_TARGET( many
COMMENT "Make many special make targets in combination."
)
# some convenience install targets:
ADD_CUSTOM_TARGET( list_install_tarets
COMMAND echo The following components can be installed:
COMMAND echo " * install - install everything."
COMMAND echo " * install_runtime - install only openwalnut-qt4."
COMMAND echo " * install_lib - install only libopenwalnut."
COMMAND echo " * install_modules - install only the compiled modules."
COMMAND echo " * install_dev - install the development headers for libopenwalnut."
COMMAND echo " * install_devdoc - install the development documentation for libopenwalnut."
COMMENT "List installation targets."
)
# install targets for different parts
ADD_CUSTOM_TARGET( install_runtime
${CMAKE_COMMAND}
-DCOMPONENT=QT4GUI
-P ${CMAKE_BINARY_DIR}/cmake_install.cmake
)
ADD_CUSTOM_TARGET( install_lib
${CMAKE_COMMAND}
-DCOMPONENT=CORE
-P ${CMAKE_BINARY_DIR}/cmake_install.cmake
${CMAKE_COMMAND}
-DCOMPONENT=EXT
-P ${CMAKE_BINARY_DIR}/cmake_install.cmake
)
ADD_CUSTOM_TARGET( install_modules
${CMAKE_COMMAND}
-DCOMPONENT=MODULES
-P ${CMAKE_BINARY_DIR}/cmake_install.cmake
)
ADD_CUSTOM_TARGET( install_dev
${CMAKE_COMMAND}
-DCOMPONENT=CORE_DEV
-P ${CMAKE_BINARY_DIR}/cmake_install.cmake
)
ADD_CUSTOM_TARGET( install_devdoc
${CMAKE_COMMAND}
-DCOMPONENT=CORE_DOC
-P ${CMAKE_BINARY_DIR}/cmake_install.cmake
DEPENDS core_devdoc
)
# ---------------------------------------------------------------------------------------------------------------------------------------------------
#
# Compilation Targets
# - The GUI + OpenWalnut.cpp ==> walnut binary
# - The GUI + OpenWalnut.cpp ==> openwalnut binary
# - Ext ==> libOWext_*
# - All the others ==> libOWcore
#
......@@ -385,28 +506,26 @@ INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/ext )
INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR} )
# -----------------------------------------------------------------------------------------------------------------------------------------------
# OWext
# external libs
SET( OWExtNiftiName "OWext_niftiio" )
SET( OWExtEEPName "OWext_eep" )
SET( OWExtBioSigName "OWext_biosig" )
SET( OWExtEEPName "openwalnut_eep" )
# build external libs in ext/
ADD_SUBDIRECTORY( ext ) # The needed external libraries
# -----------------------------------------------------------------------------------------------------------------------------------------------
# OWcore
# openwalnut core library
SET( OWCoreName "OWcore" )
SET( OWCoreName "openwalnut" )
# build core
ADD_SUBDIRECTORY( core )
# -----------------------------------------------------------------------------------------------------------------------------------------------
# QT4 Walnut binary
# QT4 OpenWalnut binary
SET( OWQt4GuiName "qt4gui" )
SET( OWBinaryName "walnut" )
SET( OWBinaryName "openwalnut-qt4" )
# build core
ADD_SUBDIRECTORY( qt4gui )
......
......@@ -48,7 +48,7 @@ COLLECT_COMPILE_FILES( "${CMAKE_CURRENT_SOURCE_DIR}" TARGET_CPP_FILES TARGET_H_F
# Setup the target
ADD_LIBRARY( ${LibName} SHARED ${TARGET_CPP_FILES} ${TARGET_H_FILES} ${OW_VERSION_HEADER} )
TARGET_LINK_LIBRARIES( ${LibName} ${OWExtBioSigName} ${OWExtEEPName} ${OWExtNiftiName}
TARGET_LINK_LIBRARIES( ${LibName} ${OWExtBioSigName} ${OWExtEEPName} ${OWExtNiftiIOName}
${Boost_LIBRARIES} ${CMAKE_DL_LIBS} ${OPENGL_gl_LIBRARY} ${OPENSCENEGRAPH_LIBRARIES}
)
......@@ -56,20 +56,19 @@ TARGET_LINK_LIBRARIES( ${LibName} ${OWExtBioSigName} ${OWExtEEPName} ${OWExtNift
# NOTE: this needs to be placed AFTER ADD_EXECUTABLE or ADD_LIBRARY
SETUP_USE_VERSION_HEADER( ${LibName} )
# Do not forget the install targets
INSTALL( TARGETS ${LibName}
ARCHIVE # NOTE: this is needed on windows
DESTINATION ${OW_LIBRARY_DIR_RELATIVE}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
LIBRARY # NOTE: this is needed for all the others
DESTINATION ${OW_LIBRARY_DIR_RELATIVE}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
# Set the version of the library.
SET_TARGET_PROPERTIES( ${LibName} PROPERTIES
VERSION ${OW_VERSION}
SOVERSION ${OW_SOVERSION}
)
# Do not forget the install targets
SETUP_LIB_INSTALL( ${LibName} ${OW_LIBRARY_DIR_RELATIVE} "CORE" )
# Core contains the headers which are needed for any developer release. Install them.
# NOTE: do not use ${TARGET_H_FILES}. The command requires a list
SETUP_DEV_INSTALL( ${LibName} ${OW_LIBRARY_DIR_RELATIVE} TARGET_H_FILES "include/openwalnut/core" "CORE_DEV" )
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# Test Setup
# ---------------------------------------------------------------------------------------------------------------------------------------------------
......@@ -77,12 +76,46 @@ INSTALL( TARGETS ${LibName}
# Setup tests of this target
SETUP_TESTS( "${TARGET_TEST_FILES}" "${LibName}" "" )
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# Doxygen Release documentation
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# NOTE: this full documentation also includes call/caller graphs, colaboration graphs and nicer inheritance graphs
# but needs "dot" from graphviz to render them.
SET( DEVDOC_DIR "${PROJECT_SOURCE_DIR}/../doc/core/html" )
ADD_CUSTOM_TARGET( core_devdoc
COMMAND doxygen ${PROJECT_SOURCE_DIR}/../doc/core/doxygenConfig
COMMAND chmod -R g+r ${DEVDOC_DIR}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/..
COMMENT "Build verbose doxygen documentation for core"
VERBATIM
)
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# Copy local resources
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# copy our own resources
SETUP_RESOURCES( "core" "CORE" )
# where to put doc files?
# NOTE: the doc path should match the SONAME of lib. Use this command to query a proper name:
# objdump -p libopenwalnut.so | sed -n -e's/^[[:space:]]*SONAME[[:space:]]*//p' | sed -e's/\([0-9]\)\.so\./\1-/; s/\.so\.//'
SET( OW_DOC_DIR_RELATIVE "share/doc/libopenwalnut1" )
SETUP_COMMON_DOC( ${OW_DOC_DIR_RELATIVE} "CORE" )
# Also add an install target for this
INSTALL( DIRECTORY ${DEVDOC_DIR}
DESTINATION ${OW_DOC_DIR_RELATIVE}
COMPONENT "CORE_DOC"
)
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# Copy Shaders
# ---------------------------------------------------------------------------------------------------------------------------------------------------
COLLECT_SHADER_FILES( ${CMAKE_CURRENT_SOURCE_DIR} TARGET_GLSL_FILES )
SETUP_SHADERS( "${TARGET_GLSL_FILES}" "${OW_SHARE_DIR_RELATIVE}/shaders" )
SETUP_SHADERS( "${TARGET_GLSL_FILES}" "${OW_SHARE_DIR_RELATIVE}/shaders" "CORE" )
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# Style Checker
......
......@@ -28,8 +28,6 @@
#include <boost/tokenizer.hpp>
#include "WPreferences.h"
#include "WPathHelper.h"
// path helper instance as singleton
......@@ -58,11 +56,11 @@ boost::shared_ptr< WPathHelper > WPathHelper::getPathHelper()
void WPathHelper::setAppPath( boost::filesystem::path appPath )
{
m_appPath = appPath;
m_sharePath = m_appPath / "../share/OpenWalnut";
m_docPath = m_appPath / "../share/doc/OpenWalnut";
m_configPath = m_appPath / "../etc/OpenWalnut";
m_sharePath = m_appPath / "../share/openwalnut";
m_docPath = m_appPath / "../share/doc";
m_configPath = m_appPath / "../share/openwalnut";
m_libPath = m_appPath / "../lib";
m_modulePath = m_libPath / "OpenWalnut";
m_modulePath = m_libPath / "openwalnut";
}
boost::filesystem::path WPathHelper::getAppPath()
......@@ -70,26 +68,6 @@ boost::filesystem::path WPathHelper::getAppPath()
return getPathHelper()->m_appPath;
}
boost::filesystem::path WPathHelper::getConfigFile()
{
namespace fs = boost::filesystem;
// I know that this work only for linux, but it should not break anything elsewhere.
// Thus, we prefer the file in the home directory now.
std::string homeDir = getenv( "HOME" ) ? getenv( "HOME" ) : "";
std::string linuxDefault= homeDir + "/.walnut.cfg";
boost::filesystem::path configFile;
if( fs::exists( linuxDefault ) )
{
configFile = boost::filesystem::path( linuxDefault );
}
else
{
configFile = getPathHelper()->m_configPath / "walnut.cfg";
}
return configFile;
}
boost::filesystem::path WPathHelper::getFontPath()
{
return getPathHelper()->m_sharePath / "fonts";
......@@ -103,9 +81,9 @@ boost::filesystem::path WPathHelper::getShaderPath()
WPathHelper::Fonts WPathHelper::getAllFonts()
{
Fonts fonts;
fonts.Regular = getFontPath() / "LiberationMono-Regular.ttf";
fonts.Bold = getFontPath() / "LiberationMono-Bold.ttf";
fonts.Italic = getFontPath() / "LiberationMono-Italic.ttf";
fonts.Regular = getFontPath() / "Regular.ttf";
fonts.Bold = getFontPath() / "Bold.ttf";
fonts.Italic = getFontPath() / "Italic.ttf";
fonts.Default = fonts.Bold;
return fonts;
......@@ -143,12 +121,8 @@ std::vector< boost::filesystem::path > WPathHelper::getAllModulePaths()
// the first element always is the global search path
paths.push_back( getModulePath() );
std::string additionalPaths = "";
if( !WPreferences::getPreference< std::string >( "modules.path", &additionalPaths ) )
{
// no config option found.
return paths;
}
// the environment variable stores the additional paths
std::string additionalPaths( getenv( "OW_MODULE_PATH" ) ? getenv( "OW_MODULE_PATH" ) : "" );
// separate list of additional paths:
typedef boost::tokenizer< boost::char_separator< char > > tokenizer;
......
......@@ -69,13 +69,6 @@ public:
*/
static boost::filesystem::path getAppPath();
/**
* The path of the configuration file walnut.cfg. Always use this file to parse configurations.
*
* \return the config file.
*/
static boost::filesystem::path getConfigFile();
/**
* The path where font files reside in.
*
......@@ -133,7 +126,7 @@ public:
static boost::filesystem::path getModulePath();
/**
* This returns a list of search paths for modules. This list is defined by the "modules.path" - option in walnut.cfg. All of these
* This returns a list of search paths for modules. This list is defined by the environment variable "OW_MODULE_PATH". All of these
* directories CAN contain modules. On startup, they get searched in the specified order.
*
* \return list of search paths for modules
......
......@@ -36,6 +36,32 @@
*/
namespace WPredicateHelper
{
/**
* Predicate which is always true. Useful if you want to ignore something all the time.
*
* @tparam T the value type to check
*
* \return always true.
*/
template< typename T >
bool alwaysTrue( const T& /* obj */ )
{
return true;
}
/**
* Predicate which is always false. Useful if you want to ignore something all the time.
*
* @tparam T the value type to check
*
* \return always false.
*/