Commit caa9977d authored by ledig's avatar ledig
Browse files

[FIX] dll and compile works for MSVC now

parent ade270b5
......@@ -145,12 +145,21 @@ ADD_SUBDIRECTORY( modules )
#-------------------------------------------------------------------------------------------------------------
# Writes information about the revision of the current code to the file version.h which then gets included by OpenWalnut.cpp
add_custom_command( OUTPUT ${PROJECT_SOURCE_DIR}/version.h
MAIN_DEPENDENCY ${PROJECT_SOURCE_DIR}/../.hg/dirstate
COMMAND hg parents --template '\#define W_VERSION \"{node|short} {rev} {branches} {tags}\"' > ${PROJECT_SOURCE_DIR}/version.h
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Creating version.h"
)
IF( NOT CMAKE_GENERATOR MATCHES "Visual Studio" )
add_custom_command( OUTPUT ${PROJECT_SOURCE_DIR}/version.h
MAIN_DEPENDENCY ${PROJECT_SOURCE_DIR}/../.hg/dirstate
COMMAND hg parents --template '\#define W_VERSION \"{node|short} {rev} {branches} {tags}\"' > ${PROJECT_SOURCE_DIR}/version.h
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Creating version.h"
)
ELSE()
add_custom_command( OUTPUT ${PROJECT_SOURCE_DIR}/version.h
MAIN_DEPENDENCY ${PROJECT_SOURCE_DIR}/../.hg/dirstate
COMMAND hg parents --template "\"#define W_VERSION \"\"{node|short} {rev} {branches} {tags}\"\"\"" > ${PROJECT_SOURCE_DIR}/version.h
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Creating version.h"
)
ENDIF()
# finally, build walnut
ADD_EXECUTABLE( walnut OpenWalnut.cpp version.h )
......
......@@ -7,14 +7,16 @@ ADD_SUBDIRECTORY( datastructures )
ADD_SUBDIRECTORY( constraints )
ADD_SUBDIRECTORY( math )
ADD_LIBRARY( OWcommon ${COMMON_SRC} ${COMMON_DATASTRUCTURES_SRC} ${COMMON_EXCEPTIONS_SRC} ${MATH_SRC} ${FIBERSIMILARITY_SRC} )
ADD_LIBRARY( OWcommon SHARED ${COMMON_SRC} ${COMMON_DATASTRUCTURES_SRC} ${COMMON_EXCEPTIONS_SRC} ${MATH_SRC} ${FIBERSIMILARITY_SRC} )
TARGET_LINK_LIBRARIES( OWcommon ${Boost_LIBRARIES} ${CMAKE_DL_LIBS} )
# Set the prefix and suffix of dynamically loadable modules to match
# CMAKEs naming of them. The quotes are necessary so the shell doesn't mess
# with these defines.
add_definitions( '-DW_LIB_PREFIX="${CMAKE_SHARED_LIBRARY_PREFIX}"' )
add_definitions( '-DW_LIB_SUFFIX="${CMAKE_SHARED_LIBRARY_SUFFIX}"' )
IF( NOT CMAKE_GENERATOR MATCHES "Visual Studio" )
add_definitions( '-DW_LIB_PREFIX="${CMAKE_SHARED_LIBRARY_PREFIX}"' )
add_definitions( '-DW_LIB_SUFFIX="${CMAKE_SHARED_LIBRARY_SUFFIX}"' )
ENDIF()
# Unit tests
IF( OW_COMPILE_TESTS )
......
......@@ -28,6 +28,7 @@
#include <string>
#include "WException.h"
#include "WExport_CommonDLL.h"
/**
* Implements assertion logic.
......@@ -40,7 +41,7 @@
* \param line The line in the file.
* \param msg An optional message.
*/
void wAssertFailed( std::string const& expression, std::string const& file, std::size_t line, std::string const& msg );
void EXPORT_OWCOMMON_DLL wAssertFailed( std::string const& expression, std::string const& file, std::size_t line, std::string const& msg );
//! the actual assertion macro
#define WAssert( e, msg ) ( ( e ) ? ( ( void )0 ) : ( wAssertFailed( #e, __FILE__, __LINE__, msg ) ) )
......
......@@ -31,10 +31,12 @@
#include <string>
#include <vector>
#include "WExport_CommonDLL.h"
/**
* Represents a RGBA Color
*/
class WColor
class EXPORT_OWCOMMON_DLL WColor
{
public:
......
......@@ -29,11 +29,13 @@
#include <boost/signals2/signal.hpp>
#include <boost/thread.hpp>
#include "WExport_CommonDLL.h"
/**
* Class to encapsulate boost::condition_variable_any. You may use it to efficiently wait for events (a condition comes true). It
* is a very simple implementation. It might be extended easily. Timed wait functions and so on.
*/
class WCondition
class EXPORT_OWCOMMON_DLL WCondition // NOLINT
{
friend class WCondition_test;
public:
......
......@@ -28,6 +28,7 @@
#include <boost/thread.hpp>
#include "WCondition.h"
#include "WExport_CommonDLL.h"
/**
* Implements a WCondition, but can be fired only ONCE. This is useful if you want to have a thread waiting for a condition but
......@@ -36,7 +37,7 @@
* on a mutex. All waiting threads try to get a read lock which is not possible as long it is write-locked. The notify method
* releases the write lock and all waiting threads can continue.
*/
class WConditionOneShot: public WCondition
class EXPORT_OWCOMMON_DLL WConditionOneShot: public WCondition
{
friend class WConditionOneShot_test;
public:
......
......@@ -32,13 +32,14 @@
#include <boost/thread.hpp>
#include "WCondition.h"
#include "WExport_CommonDLL.h"
/**
* Class allowing multiple conditions to be used for one waiting cycle. Since wait() can not be used for waiting on multiple
* conditions, this class can encapsulate multiple conditions and offer a wait() command to wait for one of them to change its
* state. Please not that this class can also be used as condition.
*/
class WConditionSet: public WCondition
class EXPORT_OWCOMMON_DLL WConditionSet: public WCondition
{
friend class WConditionSetTest;
public:
......
......@@ -31,11 +31,12 @@
#include <sstream>
#include "WTerminalColor.h"
#include "WExport_CommonDLL.h"
/**
* Basic exception handler.
*/
class WException: public std::exception
class EXPORT_OWCOMMON_DLL WException: public std::exception
{
/**
* Only UnitTests are allowed to be a friend of this class.
......
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WEXPORT_COMMONDLL_H
#define WEXPORT_COMMONDLL_H
#ifdef _MSC_VER
#pragma warning( disable: 4251 )
#ifdef OWcommon_EXPORTS
#define EXPORT_OWCOMMON_DLL __declspec( dllexport )
#else
#define EXPORT_OWCOMMON_DLL __declspec( dllimport )
#endif
#else
#define EXPORT_OWCOMMON_DLL
#endif // _MSC_VER
#endif // WEXPORT_COMMONDLL_H
......@@ -29,6 +29,7 @@
#include <boost/signals2/signal.hpp>
#include "WFlag.h"
#include "WExport_CommonDLL.h"
/**
* This class helps especially container module programmers to easily synchronize the value of one flag with several other
......@@ -49,7 +50,7 @@
* \param T the encapsulated type inside the flag. I.e. for WFlag< int32_t > use T=int32_t
*/
template < typename T >
class WFlagForwarder
class EXPORT_OWCOMMON_DLL WFlagForwarder // NOLINT
{
public:
......
......@@ -27,11 +27,13 @@
#include <utility>
#include "WExport_CommonDLL.h"
/**
* Container which associate values with (uniform width) bins (aka intervals or buckets). This class implements the abstract interface and
* therefore builds the base class for all histogram classes. The interface also allows programming histogram of different bucket sizes.
*/
class WHistogram
class EXPORT_OWCOMMON_DLL WHistogram // NOLINT
{
public:
/**
......
......@@ -33,6 +33,8 @@
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include "WExport_CommonDLL.h"
class WItemSelector;
/**
......@@ -42,7 +44,7 @@ class WItemSelector;
* not implement any function that might change the item list. The would cause odd behaviour of all the WItemSelector instances. Items can only
* be added until the first Selector instance is created.
*/
class WItemSelection: public boost::enable_shared_from_this< WItemSelection >
class EXPORT_OWCOMMON_DLL WItemSelection: public boost::enable_shared_from_this< WItemSelection >
{
public:
/**
......
......@@ -33,6 +33,7 @@
#include <boost/shared_ptr.hpp>
#include "WItemSelection.h"
#include "WExport_CommonDLL.h"
/**
* This class represents a subset of a WItemSelection. It is a class for managing selections. The class is kept very restrictive. The selection
......@@ -46,7 +47,7 @@
* \note the protected constructor avoids instance creation of classes not the WItemSelection. This is restrictive but needed. Nobody can create
* instances of it, changing the underlying WItemSelection and using it as selector for another ItemSelection instance.
*/
class WItemSelector
class EXPORT_OWCOMMON_DLL WItemSelector // NOLINT
{
friend class WItemSelection;
public:
......
......@@ -28,6 +28,7 @@
#include <string>
#include "WTerminalColor.h"
#include "WExport_CommonDLL.h"
/**
* Various log levels, to distinguish output on its level.
......@@ -44,7 +45,7 @@ LogLevel;
/**
* Represents a simple log message with some attributes.
*/
class WLogEntry
class EXPORT_OWCOMMON_DLL WLogEntry // NOLINT
{
public:
......
......@@ -33,6 +33,7 @@
/**
* Used for program wide access to the logger.
*/
WLogger* logger = NULL;
WLogger::WLogger( std::string fileName, LogLevel level ):
......
......@@ -38,11 +38,12 @@
#include "WLogEntry.h"
#include "WStringUtils.h"
#include "WThreadedRunner.h"
#include "WExport_CommonDLL.h"
/**
* Does actual logging of WLogEntries down to stdout or something similar.
*/
class WLogger: public WThreadedRunner
class EXPORT_OWCOMMON_DLL WLogger: public WThreadedRunner
{
public:
/**
......
......@@ -30,11 +30,12 @@
#include <boost/filesystem.hpp>
#include <boost/shared_ptr.hpp>
#include "WExport_CommonDLL.h"
/**
* Singleton class helping to find files and paths. It is a useful to to search for resources and the central place to "hardcode" relative paths.
* It contains global paths only. Modules have their OWN local paths.
*/
class WPathHelper
class EXPORT_OWCOMMON_DLL WPathHelper // NOLINT
{
public:
......
......@@ -36,10 +36,11 @@
#include "WProperties.h"
#include "WLogger.h"
#include "WExport_CommonDLL.h"
/**
* Fetches and caches preferences set in file.
*/
class WPreferences
class EXPORT_OWCOMMON_DLL WPreferences
{
public:
/**
......
......@@ -30,6 +30,7 @@
#include <boost/shared_ptr.hpp>
#include "WExport_CommonDLL.h"
/**
* Class managing progress inside of modules. It interacts with the abstract WGUI class to present those information to the user.
* At the same time, it also is a simple tree structure, allowing the programmer to arrange complex sub progress. This is
......@@ -37,7 +38,7 @@
*
* \see WGUI
*/
class WProgress
class EXPORT_OWCOMMON_DLL WProgress // NOLINT
{
friend class WProgressTest;
public:
......
......@@ -31,12 +31,13 @@
#include <boost/thread.hpp>
#include "WProgress.h"
#include "WExport_CommonDLL.h"
/**
* Base class for all kinds of progress combinations. You might want to derive from this class to implement some special progress
* combination.
*/
class WProgressCombiner: public WProgress
class EXPORT_OWCOMMON_DLL WProgressCombiner: public WProgress
{
friend class WProgressCombinerTest;
public:
......
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