Commit 1c5e0eae authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Cleaned up campvis-scripting package:

Removed obsolete Lua pipeline registration. Create campvis-scripting as shared library. Added CAMPVIS_SCRIPTING_API definitions where needed. Disabled warnings in SWIG lua bindings.
parent dfec0e89
# = CAMPVis - Yet another medical visualization framework =====================
PROJECT(CAMPVis)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR)
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0 FATAL_ERROR)
SET(CAMPVIS_VERSION 1.0.0)
......
......@@ -53,10 +53,6 @@
#include <QApplication>
#ifdef CAMPVIS_HAS_SCRIPTING
#include "scripting/gen_pipelineregistration.h"
#endif
namespace campvis {
const std::string CampVisApplication::loggerCat_ = "CAMPVis.application.CampVisApplication";
......
......@@ -125,7 +125,7 @@ namespace campvis {
return;
QString textUnderCursor = text().left(cursorPosition());
size_t pos = textUnderCursor.toStdString().find_last_of(" ()[]{}");
int pos = int(textUnderCursor.toStdString().find_last_of(" ()[]{}"));
QString completionPrefix = textUnderCursor.right(textUnderCursor.length() - pos - 1);
bool hasModifier = (e->modifiers() != Qt::NoModifier) && !ctrlOrShift;
......@@ -150,7 +150,7 @@ namespace campvis {
return;
QString textUnderCursor = text().left(cursorPosition());
size_t pos = textUnderCursor.toStdString().find_last_of(" .:()[]{}");
int pos = int(textUnderCursor.toStdString().find_last_of(" .:()[]{}"));
if (pos == std::string::npos)
pos = 0;
else
......
......@@ -229,6 +229,8 @@ namespace campvis {
return QVariant("[Metatable]");
case COMPLETER_MODEL:
return QVariant("[Methods]");
default:
return QVariant("");
}
}
else {
......
......@@ -24,7 +24,7 @@ FILE(GLOB CampvisScriptingHeaders
)
IF(WIN32)
LIST(APPEND CampvisScriptingDefinitions /wd4267)
#LIST(APPEND CampvisScriptingDefinitions "/wd4267")
ENDIF(WIN32)
......@@ -46,26 +46,19 @@ FOREACH(ModName ${CampvisModules})
IF(CAMPVIS_BUILD_MODULE_${ModNameUpper})
LIST(APPEND CampvisBindingDirs "modules/${ModName}")
FILE(GLOB ModLuaPipelines "${CampvisHome}/modules/${ModName}/pipelines/*.lua")
LIST(APPEND CampvisLuaPipelines ${ModLuaPipelines})
ENDIF(CAMPVIS_BUILD_MODULE_${ModNameUpper})
ENDFOREACH(ModName ${CampvisModules})
# Hack-fix for a bug in SWIG_ADD_MODULE that breaks out-of-tree builds by not creating wrapper
# output directories.
# TODO: remove once http://www.cmake.org/Bug/view.php?id=14459 lands
FOREACH(BindingDir ${CampvisBindingDirs})
FILE(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/${BindingDir}/bindings")
ENDFOREACH(BindingDir ${CampvisBindingDirs})
# Declare a Lua module to be generated by SWIG from the specified interface file
MACRO(DECLARE_LUA_MODULE InterfaceFile)
STRING(REGEX REPLACE ".*/([A-Za-z0-9_]+)\\.i" "\\1" LuaModShortName ${InterfaceFile})
SET(LuaModName "${LuaModShortName}-lua-mod")
MESSAGE(STATUS "* ${LuaModShortName}")
IF(WIN32)
ADD_DEFINITIONS("/wd4244 /wd4267")
ENDIF()
SET_SOURCE_FILES_PROPERTIES(${InterfaceFile} PROPERTIES CPLUSPLUS ON)
SET_SOURCE_FILES_PROPERTIES(${InterfaceFile} PROPERTIES SWIG_FLAGS "-I${CampvisHome}")
LINK_DIRECTORIES(${CampvisGlobalLinkDirectories} ${CampvisModulesLinkDirectories})
......@@ -101,14 +94,6 @@ FOREACH(BindingDir ${CampvisBindingDirs})
ENDFOREACH(BindingDir ${CampvisBindingDirs})
# Generate a registration header for Lua pipelines
FOREACH(LuaPipeline ${CampvisLuaPipelines})
PARSE_SCRIPT_FOR_PIPELINE(${LuaPipeline})
ENDFOREACH(LuaPipeline ${CampvisBindingDirs})
WRITE_SCRIPTED_PIPELINE_REGISTRATION("gen_pipelineregistration.h")
# Generate header with SWIG run-time functions
ADD_CUSTOM_COMMAND(
OUTPUT "swigluarun.h"
......@@ -121,14 +106,13 @@ ADD_DEFINITIONS(${CampvisGlobalDefinitions} ${CampvisScriptingDefinitions})
INCLUDE_DIRECTORIES(${CampvisGlobalIncludeDirs} ${CMAKE_CURRENT_BINARY_DIR})
LINK_DIRECTORIES(${CampvisGlobalLinkDirectories} ${CampvisModulesLinkDirectories})
ADD_LIBRARY(campvis-scripting ${CampvisSharedStaticModulesFix}
${CampvisScriptingSources} ${CampvisScriptingHeaders}
)
#ADD_DEPENDENCIES(campvis-scripting ${CampvisLuaModules})
ADD_LIBRARY(campvis-scripting ${CampvisScriptingSources} ${CampvisScriptingHeaders})
TARGET_LINK_LIBRARIES(campvis-scripting campvis-core campvis-modules cgt ${CampvisGlobalExternalLibs})
# if campvis-core is built as a shared library, CMake will define the following flag to instruct
# the code to export DLL symbols
SET_TARGET_PROPERTIES(campvis-scripting PROPERTIES DEFINE_SYMBOL "CAMPVIS_SCRIPTING_BUILD_DLL")
IF(CAMPVIS_GROUP_SOURCE_FILES)
DEFINE_SOURCE_GROUPS_FROM_SUBDIR(CampvisScriptingSources ${CampvisHome} "")
DEFINE_SOURCE_GROUPS_FROM_SUBDIR(CampvisScriptingHeaders ${CampvisHome} "")
......
......@@ -26,6 +26,7 @@
#define GLOBALLUATABLE_H__
#include "luatable.h"
#include "scripting/scriptingapi.h"
namespace campvis {
......@@ -36,7 +37,7 @@ namespace campvis {
* a result, they must be used in order to interact with Lua states and access user-defined
* values.
*/
class GlobalLuaTable : public LuaTable {
class CAMPVIS_SCRIPTING_API GlobalLuaTable : public LuaTable {
public:
/**
* Creates a new GlobalLuaTable.
......
......@@ -25,6 +25,8 @@
#ifndef LUATABLE_H__
#define LUATABLE_H__
#include "scripting/scriptingapi.h"
#include <map>
#include <memory>
#include <set>
......@@ -55,7 +57,7 @@ namespace campvis {
* such calls to be propagated through their enclosing tables all the way up to the global
* table.
*/
class LuaTable : public std::enable_shared_from_this<LuaTable>
class CAMPVIS_SCRIPTING_API LuaTable : public std::enable_shared_from_this<LuaTable>
{
friend GlobalLuaTable;
friend MetatableLuaTable;
......
......@@ -28,7 +28,14 @@
#include <iostream>
#include <memory>
#include <string>
#pragma warning(push)
#pragma warning (disable: 4244 4267)
#include "scripting/swigluarun.h"
#pragma warning(pop)
#include "scripting/scriptingapi.h"
#include "scripting/glue/globalluatable.h"
#include "tbb/recursive_mutex.h"
......@@ -60,7 +67,7 @@ namespace campvis {
* common operations (e.g. script execution) while still giving access to the underlying raw
* Lua state.
*/
class LuaVmState
class CAMPVIS_SCRIPTING_API LuaVmState
{
public:
/**
......
......@@ -2,6 +2,7 @@
#define METATABLELUATABLE_H__
#include "luatable.h"
#include "scripting/scriptingapi.h"
namespace campvis {
......@@ -11,7 +12,7 @@ namespace campvis {
* Any Lua field may contain a metatable. They serve multiple purposes, including emulation
* of classes and objects.
*/
class MetatableLuaTable : public LuaTable {
class CAMPVIS_SCRIPTING_API MetatableLuaTable : public LuaTable {
public:
/**
* Creates a new MetatableLuaTable.
......
......@@ -26,6 +26,7 @@
#define REGULARLUATABLE_H__
#include "luatable.h"
#include "scripting/scriptingapi.h"
namespace campvis {
......@@ -35,7 +36,7 @@ namespace campvis {
* Regular tables can be defined by exclusion: any Lua table that is not a global table or a
* metatable is a regular one.
*/
class RegularLuaTable : public LuaTable {
class CAMPVIS_SCRIPTING_API RegularLuaTable : public LuaTable {
public:
/**
* Creates a new RegularLuaTable.
......
......@@ -25,10 +25,8 @@
#ifndef ABSTRACTPROPERTYLUA_H__
#define ABSTRACTPROPERTYLUA_H__
#include "sigslot/sigslot.h"
#include "tbb/atomic.h"
#include <QBoxLayout>
#include <QLabel>
#include "scripting/scriptingapi.h"
#include <string>
namespace campvis {
class AbstractProperty;
......@@ -37,7 +35,7 @@ namespace campvis {
/**
* Abstract base class for property luas.
*/
class AbstractPropertyLua {
class CAMPVIS_SCRIPTING_API AbstractPropertyLua {
public:
/**
* Creates a new Lua Property for the property \a property.
......
......@@ -25,6 +25,7 @@
#ifndef BOOLPROPERTYLUA_H__
#define BOOLPROPERTYLUA_H__
#include "scripting/scriptingapi.h"
#include "scripting/luagen/properties/abstractpropertylua.h"
#include "scripting/luagen/properties/propertyluafactory.h"
#include "core/properties/genericproperty.h"
......@@ -33,7 +34,7 @@ namespace campvis {
/**
* Lua generator for a BoolProperty
*/
class BoolPropertyLua : public AbstractPropertyLua {
class CAMPVIS_SCRIPTING_API BoolPropertyLua : public AbstractPropertyLua {
public:
/**
* Creates a new BoolPropertyLua for the property \a property.
......
......@@ -29,13 +29,14 @@
#include "propertyluafactory.h"
#include "core/properties/floatingpointproperty.h"
#include "core/properties/colorproperty.h"
#include "scripting/scriptingapi.h"
namespace campvis {
/**
* Lua generator for a ColorProperty
*/
class ColorPropertyLua : public AbstractPropertyLua {
class CAMPVIS_SCRIPTING_API ColorPropertyLua : public AbstractPropertyLua {
public:
/**
* Creates a new FloatPropertyLua for the property \a property.
......
......@@ -26,21 +26,15 @@
#define DATANAMEPROPERTYLUA_H__
#include "core/properties/datanameproperty.h"
#include "scripting/scriptingapi.h"
#include "abstractpropertylua.h"
#include "propertyluafactory.h"
class QComboBox;
class QLineEdit;
namespace campvis {
class DataNameProperty;
class DataContainer;
class DataHandle;
/**
* Lua generator for a DataNameProperty
*/
class DataNamePropertyLua : public AbstractPropertyLua {
class CAMPVIS_SCRIPTING_API DataNamePropertyLua : public AbstractPropertyLua {
public:
/**
* Creates a new PropertyLua for the property \a property.
......
......@@ -34,7 +34,7 @@ namespace campvis {
/**
* Lua generator for a FloatProperty
*/
class FloatPropertyLua : public AbstractPropertyLua {
class CAMPVIS_SCRIPTING_API FloatPropertyLua : public AbstractPropertyLua {
public:
/**
* Creates a new FloatPropertyLua for the property \a property.
......
......@@ -27,6 +27,8 @@
#include "abstractpropertylua.h"
#include "propertyluafactory.h"
#include "scripting/scriptingapi.h"
#include "core/properties/numericproperty.h"
#include "core/tools/stringutils.h"
......@@ -34,7 +36,7 @@ namespace campvis {
/**
* Lua generator for a IntProperty
*/
class IntPropertyLua : public AbstractPropertyLua {
class CAMPVIS_SCRIPTING_API IntPropertyLua : public AbstractPropertyLua {
public:
/**
* Creates a new IntPropertyLua for the property \a property.
......
......@@ -26,19 +26,19 @@
#define METAPROPERTYLUA_H__
#include "scripting/scriptingapi.h"
#include "core/properties/metaproperty.h"
#include "abstractpropertylua.h"
#include "propertycollectionluascriptgenerator.h"
#include "propertyluafactory.h"
namespace campvis {
class DataContainer;
/**
* Lua for a MetaProperty.
* Forwards the call to the PropertyCollectionLua
*/
class MetaPropertyLua : public PropertyCollectionLuaScriptGenerator {
class CAMPVIS_SCRIPTING_API MetaPropertyLua : public PropertyCollectionLuaScriptGenerator {
public:
/**
* Creates a new MetaPropertyLua for the property \a property.
......
......@@ -27,7 +27,9 @@
#include "abstractpropertylua.h"
#include "propertyluafactory.h"
#include "core/properties/optionproperty.h"
#include "scripting/scriptingapi.h"
namespace campvis {
class AbstractOptionProperty;
......@@ -35,7 +37,7 @@ namespace campvis {
/**
* Lua generator for a OptionProperty
*/
class OptionPropertyLua : public AbstractPropertyLua {
class CAMPVIS_SCRIPTING_API OptionPropertyLua : public AbstractPropertyLua {
public:
/**
......
......@@ -39,7 +39,7 @@ namespace campvis {
* Main lua generator for the CAMPVis application.
* Calls individual properties for their own scripts and assembles all responses.
*/
class PropertyCollectionLuaScriptGenerator : public AbstractPropertyLua {
class CAMPVIS_SCRIPTING_API PropertyCollectionLuaScriptGenerator : public AbstractPropertyLua {
public:
/**
* Creates a new PropertyCollectionLua.
......
......@@ -31,6 +31,8 @@
#include <tbb/atomic.h>
#include <tbb/spin_mutex.h>
#include "scripting/scriptingapi.h"
#include <map>
#include <string>
#include <typeindex>
......@@ -40,7 +42,6 @@
namespace campvis {
class AbstractProperty;
class AbstractPropertyLua;
class DataContainer;
/**
* Factory for creating Lua Property depending on the Property type.
......@@ -49,7 +50,7 @@ namespace campvis {
*
* \note PropertyLuaFactory is a thread-safe lazy-instantiated singleton.
*/
class PropertyLuaFactory {
class CAMPVIS_SCRIPTING_API PropertyLuaFactory {
public:
/// Typedef for a function pointer to create a PropertyLua if you know exactly its type.
typedef AbstractPropertyLua* (*PropertyLuaCreateFunctionPointer) (AbstractProperty*);
......@@ -83,7 +84,6 @@ namespace campvis {
* Create a PropertyLua for the given property.
* Checkes all registered luas, wether they match the type of \a property.
* \param property The property the lua shall handle.
* \param dataContainer DataContainer to use (optional), defaults to nullptr. However, some derived classed might need a valid pointer here!
* \return The created property lua for the property - nullptr, if there was no matching lua found.
*/
AbstractPropertyLua* createPropertyLua(AbstractProperty* property);
......@@ -117,7 +117,6 @@ namespace campvis {
/**
* Static factory method for creating the lua if we know the property type exactly.
* \param property The property the lua shall handle.
* \param dataContainer DataContainer to use (optional), defaults to nullptr. However, some derived classed might need a valid pointer here!
* \return The newly created property lua.
*/
static AbstractPropertyLua* create(AbstractProperty* property) {
......@@ -129,7 +128,6 @@ namespace campvis {
* Static factory method for creating the lua if we don't know the property type.
* Performs a dynamic type check to see whether the property type matches.
* \param property The property the lua shall handle.
* \param dataContainer DataContainer to use (optional), defaults to nullptr. However, some derived classed might need a valid pointer here!
* \return The newly created property lua, may be nullptr in case the types do not match.
*/
static AbstractPropertyLua* tryCreate(AbstractProperty* property) {
......
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