Commit 8dc4b6eb authored by Mathias Goldau's avatar Mathias Goldau
Browse files

[CHANGE]

 * Since its christmas this is not related to any ticket
 * renamed run script in walnut, and walnut into walnut-bin
 * fixed wlanut script to support also PATH variables without current path
 * moved some utils into the utils directory. Maybe we should merge this with common later?
 * some info messages for the config file reading
parent 0227e1fb
......@@ -8,4 +8,4 @@ WALNUTPATH="$PWD/$BINDIR"
# go there and run walnut to ensure walnuts working directory is set correctly
cd $WALNUTPATH
walnut $@
./walnut-bin $@
......@@ -102,8 +102,8 @@ ADD_SUBDIRECTORY( utils )
ADD_SUBDIRECTORY( kernel )
ADD_SUBDIRECTORY( common )
ADD_SUBDIRECTORY( modules )
ADD_EXECUTABLE( walnut OpenWalnut.cpp )
TARGET_LINK_LIBRARIES( walnut kernel dataHandler gui guiqt4 common ${Boost_LIBRARIES} )
ADD_EXECUTABLE( walnut-bin OpenWalnut.cpp )
TARGET_LINK_LIBRARIES( walnut-bin kernel dataHandler gui guiqt4 common ${Boost_LIBRARIES} )
#---------- Shaders -------------
option( OW_COPY_SHADERS "This enables copying shaders with every make call." ON )
......
......@@ -15,11 +15,10 @@ TARGET_LINK_LIBRARIES( common ${Boost_LIBRARIES} )
# Unit tests
IF( CXXTEST_FOUND )
CXXTEST_ADD_TESTS_FROM_LIST( "${COMMON_SRC}"
"common" # no libs for linking required
"common;utils"
"WSegmentationFault.cpp"
"WTransferable.cpp"
"WConditionSet.cpp"
"WPrototyped.cpp"
"WStringUtils.h" # since unit tests are already included via the .h file
)
ENDIF( CXXTEST_FOUND )
......@@ -26,8 +26,8 @@
#include <string>
#include <vector>
#include "../utils/WStringUtils.h"
#include "WColor.h"
#include "WStringUtils.h"
WColor::WColor( float red, float green, float blue, float alpha )
: m_red( red ),
......
......@@ -3,6 +3,6 @@ FILE( GLOB COMMON_DATASTRUCTURES_SRC "*.cpp" )
# Unit tests
IF( CXXTEST_FOUND )
CXXTEST_ADD_TESTS_FROM_LIST( "${COMMON_DATASTRUCTURES_SRC}"
"common" # no libs for linking required
"common;utils" # no libs for linking required
)
ENDIF( CXXTEST_FOUND )
ADD_SUBDIRECTORY( io )
IF( CMAKE_HOST_SYSTEM MATCHES Windows )
FILE( GLOB DATAHANDLER_SRC "*.cpp" )
FILE( GLOB DATAHANDLER_EXCEPTIONS_SRC "exceptions/*.cpp" )
FILE( GLOB DATAHANDLER_IO_SRC "io/*.cpp" ) # former WLoader
FILE( GLOB DATAHANDLER_SRC "*.cpp" )
FILE( GLOB DATAHANDLER_EXCEPTIONS_SRC "exceptions/*.cpp" )
FILE( GLOB DATAHANDLER_IO_SRC "io/*.cpp" ) # former WLoader
FILE( GLOB EXCLUDE_biosig "io/*Biosig.cpp" )
LIST( REMOVE_ITEM DATAHANDLER_IO_SRC ${EXCLUDE_biosig} )
ADD_LIBRARY( dataHandler ${DATAHANDLER_SRC} ${DATAHANDLER_EXCEPTIONS_SRC} ${DATAHANDLER_IO_SRC} )
TARGET_LINK_LIBRARIES( dataHandler common math ${Boost_LIBRARIES} niftiio ${OPENSCENEGRAPH_LIBRARIES})
ADD_LIBRARY( dataHandler ${DATAHANDLER_SRC} ${DATAHANDLER_EXCEPTIONS_SRC} ${DATAHANDLER_IO_SRC} )
TARGET_LINK_LIBRARIES( dataHandler common math ${Boost_LIBRARIES} niftiio ${OPENSCENEGRAPH_LIBRARIES})
ELSE()
FILE( GLOB DATAHANDLER_SRC "*.cpp" )
FILE( GLOB DATAHANDLER_EXCEPTIONS_SRC "exceptions/*.cpp" )
FILE( GLOB DATAHANDLER_IO_SRC "io/*.cpp" ) # former WLoader
FILE( GLOB DATAHANDLER_SRC "*.cpp" )
FILE( GLOB DATAHANDLER_EXCEPTIONS_SRC "exceptions/*.cpp" )
FILE( GLOB DATAHANDLER_IO_SRC "io/*.cpp" ) # former WLoader
ADD_LIBRARY( dataHandler SHARED ${DATAHANDLER_SRC} ${DATAHANDLER_EXCEPTIONS_SRC} ${DATAHANDLER_IO_SRC} )
TARGET_LINK_LIBRARIES( dataHandler common math ${Boost_LIBRARIES} niftiio biosig ${OPENSCENEGRAPH_LIBRARIES})
ADD_LIBRARY( dataHandler SHARED ${DATAHANDLER_SRC} ${DATAHANDLER_EXCEPTIONS_SRC} ${DATAHANDLER_IO_SRC} )
TARGET_LINK_LIBRARIES( dataHandler common math utils ${Boost_LIBRARIES} niftiio biosig ${OPENSCENEGRAPH_LIBRARIES})
ENDIF()
# Unit tests
IF( CXXTEST_FOUND )
......
......@@ -24,9 +24,9 @@
#include <string>
#include "../utils/WIOTools.h"
#include "WLoader.h"
#include "exceptions/WDHIOFailure.h"
#include "io/WIOTools.h"
WLoader::WLoader( std::string fileName, boost::shared_ptr< WDataHandler > dataHandler ) throw( WDHIOFailure )
......
......@@ -26,13 +26,14 @@
#include <iostream>
#include <string>
#include <vector>
#include <boost/lexical_cast.hpp>
#include "WLoaderEEGASCII.h"
#include "../WSubject.h"
#include "../WEEG.h"
#include "../../common/WException.h"
#include "../../common/WStringUtils.h"
#include "../../utils/WStringUtils.h"
#include "../WEEG.h"
#include "../WSubject.h"
#include "WLoaderEEGASCII.h"
WLoaderEEGASCII::WLoaderEEGASCII( std::string fileName, boost::shared_ptr< WDataHandler > dataHandler )
: WLoader( fileName, dataHandler )
......
......@@ -23,21 +23,22 @@
//---------------------------------------------------------------------------
#include <stdint.h>
#include <cassert>
#include <fstream>
#include <string>
#include <vector>
#include <boost/shared_ptr.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/shared_ptr.hpp>
#include "../../common/WStringUtils.h"
#include "../../common/WLogger.h"
#include "../../math/WPosition.h"
#include "../../utils/WIOTools.h"
#include "../../utils/WStringUtils.h"
#include "../WDataHandler.h"
#include "../WDataSetFibers.h"
#include "../WSubject.h"
#include "WIOTools.h"
#include "WLoaderFibers.h"
WLoaderFibers::WLoaderFibers( std::string fname, boost::shared_ptr< WDataHandler > dataHandler ) throw( WDHIOFailure )
......
......@@ -24,9 +24,9 @@
#include <string>
#include "WReader.h"
#include "WIOTools.h"
#include "../../utils/WIOTools.h"
#include "../exceptions/WDHNoSuchFile.h"
#include "WReader.h"
WReader::WReader( std::string fname )
{
......
......@@ -30,12 +30,12 @@
#include <boost/lexical_cast.hpp>
#include <boost/shared_ptr.hpp>
#include "WIOTools.h"
#include "WReader.h"
#include "WReaderLookUpTableVTK.h"
#include "../../utils/WIOTools.h"
#include "../../utils/WStringUtils.h"
#include "../exceptions/WDHException.h"
#include "../exceptions/WDHIOFailure.h"
#include "../../common/WStringUtils.h"
#include "WReader.h"
#include "WReaderLookUpTableVTK.h"
WReaderLookUpTableVTK::WReaderLookUpTableVTK( std::string fname )
: WReader( fname )
......
......@@ -24,9 +24,9 @@
#include <string>
#include "WWriter.h"
#include "WIOTools.h"
#include "../../utils/WIOTools.h"
#include "../exceptions/WDHIOFailure.h"
#include "WWriter.h"
WWriter::WWriter( std::string fname, bool overwrite )
: m_overwrite( overwrite )
......
......@@ -28,10 +28,10 @@
#include <boost/shared_ptr.hpp>
#include "WWriterFiberVTK.h"
#include "WIOTools.h"
#include "../../utils/WIOTools.h"
#include "../WDataSetFibers.h"
#include "../exceptions/WDHIOFailure.h"
#include "WWriterFiberVTK.h"
WWriterFiberVTK::WWriterFiberVTK( std::string fname, bool overwrite )
: WWriter( fname, overwrite )
......
......@@ -29,9 +29,9 @@
#include <boost/shared_ptr.hpp>
#include "WWriterLookUpTableVTK.h"
#include "WIOTools.h"
#include "../../utils/WIOTools.h"
#include "../exceptions/WDHIOFailure.h"
#include "WWriterLookUpTableVTK.h"
WWriterLookUpTableVTK::WWriterLookUpTableVTK( std::string fname, bool overwrite )
: WWriter( fname, overwrite )
......
......@@ -13,6 +13,6 @@ TARGET_LINK_LIBRARIES( gui common )
# Unit tests
IF( CXXTEST_FOUND )
CXXTEST_ADD_TESTS_FROM_LIST( "${GUI_SRC}"
"common"
"common;utils"
)
ENDIF( CXXTEST_FOUND )
......@@ -33,13 +33,13 @@
#include <QtGui/QApplication>
#include <QtGui/QFileDialog>
#include "WMainWindow.h"
#include "../../kernel/WKernel.h"
#include "WMainWindow.h" // this has to be included before any other includes
#include "../../graphicsEngine/WGraphicsEngine.h"
#include "../../kernel/WKernel.h"
#include "../../modules/data/WMData.h"
#include "WQt4Gui.h"
#include "../../utils/WIOTools.h"
#include "WCreateCustomDockWidgetEvent.h"
#include "WQt4Gui.h"
WQt4Gui::WQt4Gui( int argc, char** argv ):
WGUI( argc, argv )
......@@ -50,14 +50,17 @@ WQt4Gui::~WQt4Gui()
{
}
#ifdef _WIN32
// TODO(wiebel): Hi, this is math. I assume the line below is due to linker errors with boost. I just marked it with this todo
// since we don't forget this. When using Linux or Mac I _think_ we don't need this.
const unsigned int boost::program_options::options_description::m_default_line_length = 2048;
#endif
bool WQt4Gui::parseOptions( int argc, char** argv )
{
// since the namespace is far to big we use a shortcut here
namespace po = boost::program_options;
namespace po = boost::program_options; // since the namespace is far to big we use a shortcut here
po::options_description desc( "Allowed options" );
po::options_description desc( "Allowed options", 2048 );
#ifndef _WIN32
// TODO(wiebel): this does not link on windows at the moment. But it should!
desc.add_options()
......@@ -72,14 +75,9 @@ bool WQt4Gui::parseOptions( int argc, char** argv )
{
po::store( po::command_line_parser( argc, argv ).options( desc ).positional( p ).run(), m_optionsMap );
}
catch( boost::program_options::unknown_option e )
{
std::cout << e.what() << std::endl;
return false;
}
catch( boost::program_options::invalid_command_line_syntax e )
catch( const po::error &e )
{
std::cout << e.what() << std::endl;
std::cerr << e.what() << std::endl;
return false;
}
......@@ -88,6 +86,7 @@ bool WQt4Gui::parseOptions( int argc, char** argv )
//=====================
// CONFIGURATION FILE
po::options_description guiConfigurationDescription( "GUI configuration" );
#ifndef _WIN32
// TODO(wiebel): this does not link on windows at the moment. But it should!
guiConfigurationDescription.add_options()
......@@ -96,19 +95,26 @@ bool WQt4Gui::parseOptions( int argc, char** argv )
( "ge.bgColor.b", po::value< float >() );
#endif
std::ifstream ifs;
ifs.open( "walnut.cfg", std::ifstream::in );
po::variables_map guiConfiguration;
std::string cfgFileName( "walnut.cfg" );
try
if( wiotools::fileExists( cfgFileName ) )
{
po::store( po::parse_config_file( ifs, guiConfigurationDescription ), m_guiConfiguration );
wlog::info( "GUI" ) << "Reading config file: " << cfgFileName;
std::ifstream ifs( cfgFileName.c_str(), std::ifstream::in );
try
{
po::store( po::parse_config_file( ifs, guiConfigurationDescription ), m_guiConfiguration );
}
catch( const po::error &e )
{
std::cerr << "Error in configuration file \"" << cfgFileName << "\": " << e.what() << std::endl;
return false;
}
}
catch( boost::program_options::unknown_option e )
else
{
std::cout << "Syntax error in configuration file \"walnut.cfg\"." << std::endl;
return false;
wlog::info( "GUI" ) << "No Config file: " << cfgFileName << " found";
}
po::notify( m_guiConfiguration );
......
......@@ -11,7 +11,7 @@ ENDIF()
# Unit tests
IF( CXXTEST_FOUND )
CXXTEST_ADD_TESTS_FROM_LIST( "${MATH_SRC}"
"math;common"
CXXTEST_ADD_TESTS_FROM_LIST( "${MATH_SRC}"
"math;common;utils"
)
ENDIF( CXXTEST_FOUND )
......@@ -28,8 +28,8 @@
#include <iostream>
#include <vector>
#include "../utils/WStringUtils.h"
#include "WPosition.h"
#include "../common/WStringUtils.h"
// we need this to find the WLineTest class which is not inside wmath namespace
class WLineTest;
......
......@@ -29,7 +29,7 @@
#include <cmath>
#include <vector>
#include "../common/WStringUtils.h"
#include "../utils/WStringUtils.h"
namespace wmath
{
......
......@@ -2,8 +2,8 @@ FILE( GLOB FIBERSIMILARITY_SRC "*.cpp" )
# Unit tests
IF( CXXTEST_FOUND )
CXXTEST_ADD_TESTS_FROM_LIST( "${FIBERSIMILARITY_SRC}"
"math;common"
CXXTEST_ADD_TESTS_FROM_LIST( "${FIBERSIMILARITY_SRC}"
"math;utils"
"WFiberSimilarity.cpp" # This is just an interface
)
ENDIF( CXXTEST_FOUND )
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment