24.09., 9:00 - 11:00: Due to updates GitLab will be unavailable for some minutes between 09:00 and 11:00.

Fixed GCC compatability of scripting module:

* CMake build files now support unix builds
* SWIG interface files and Lua wrappers are now fully C++ compliant to comfort GCC
* Hacked shared/static builds of the campvis-modules module even more, but now it works on both MSVC and GCC
parent bc9ac14d
......@@ -48,8 +48,10 @@ IF(CAMPVIS_BUILD_LIB_TGT)
ENDIF()
IF(CAMPVIS_BUILD_LIB_LUA)
# Keep LUA_BUILD_AS_DLL in sync with BUILD_SHARED_LIBS
SET(LUA_BUILD_AS_DLL ${BUILD_SHARED_LIBS} CACHE BOOL "Build Lua library as DLL" FORCE)
IF(WIN32)
# Keep LUA_BUILD_AS_DLL in sync with BUILD_SHARED_LIBS
SET(LUA_BUILD_AS_DLL ${BUILD_SHARED_LIBS} CACHE BOOL "Build Lua library as DLL" FORCE)
ENDIF(WIN32)
ADD_SUBDIRECTORY(ext/lua EXCLUDE_FROM_ALL)
......
......@@ -4,24 +4,17 @@
# LUA_INCLUDE_DIR
# LUA_LIBRARY
IF(WIN32)
# For now Lua needs to be built as part of CAMPVis on Windows
IF(CAMPVIS_BUILD_LIB_LUA)
SET(LUA_DIR "${CampvisHome}/ext/lua" CACHE PATH "If Lua is not found, set this path")
IF(CAMPVIS_BUILD_LIB_LUA)
SET(LUA_DIR "${CampvisHome}/ext/lua" CACHE PATH "If Lua is not found, set this path")
SET(LUA_INCLUDE_DIR "${LUA_DIR}/src" "${CMAKE_BINARY_DIR}/ext/lua")
SET(LUA_INCLUDE_DIR "${LUA_DIR}/src" "${CMAKE_BINARY_DIR}/ext/lua")
IF(LUA_INCLUDE_DIR)
SET(LUA_LIBRARY liblua)
SET(LUA_FOUND TRUE)
ELSE()
SET(LUA_FOUND FALSE)
ENDIF()
ENDIF(CAMPVIS_BUILD_LIB_LUA)
ELSE(WIN32)
# TODO: not tested
MESSAGE(FATAL_ERROR "FindLua.cmake doesn't support platforms other than Windows yet")
ENDIF(WIN32)
IF(LUA_INCLUDE_DIR)
SET(LUA_LIBRARY liblua)
SET(LUA_FOUND TRUE)
ELSE()
SET(LUA_FOUND FALSE)
ENDIF()
ENDIF(CAMPVIS_BUILD_LIB_LUA)
MARK_AS_ADVANCED(LUA_DIR LUA_INCLUDE_DIR LUA_LIBRARY)
......@@ -121,6 +121,10 @@ IF(WIN32)
SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /MANIFEST:NO")
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /MANIFEST:NO")
ENDIF()
# For Windows targets, we have to build campvis-modules and some other libs as static library,
# since we did not define the __declspec exports here.
SET(CampvisSharedStaticModulesFix "STATIC")
ENDIF()
# enable/disable incremental linking in debug builds
......@@ -142,7 +146,7 @@ IF(WIN32)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}")
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}")
ENDIF(CAMPVIS_NMAKE)
ELSEIF(UNIX)
LIST(APPEND CampvisGlobalDefinitions "-DUNIX")
LIST(APPEND CampvisGlobalDefinitions "-Wall -Wno-unused-local-typedefs -Wno-unused-variable")
......
......@@ -79,7 +79,7 @@ MACRO(WRITE_SCRIPTED_PIPELINE_REGISTRATION FileName)
LIST(APPEND PipelineRegistrationSource "// Include required headers:\n"
"#include \"scripting/scriptedpipelineregistrar.h\"\n")
LIST(APPEND PipelineRegistrationSource "\nnamespace campvis {\n\tnamespace {\n" )
LIST(APPEND PipelineRegistrationSource "\nnamespace campvis {\n" )
LIST(APPEND PipelineRegistrationSource "\t\t// Instantiate templated ScriptedPipelineRegistrars to register pipelines.\n" )
WHILE(ScriptedPipelineRegistrationPipelineNames)
......@@ -96,7 +96,7 @@ MACRO(WRITE_SCRIPTED_PIPELINE_REGISTRATION FileName)
"${PipelineName}PipelineScript>\;\n")
ENDWHILE(ScriptedPipelineRegistrationPipelineNames)
LIST(APPEND PipelineRegistrationSource "\t}\n}\n" )
LIST(APPEND PipelineRegistrationSource "}\n" )
FILE(WRITE ${FileName} ${PipelineRegistrationSource})
ENDMACRO(WRITE_SCRIPTED_PIPELINE_REGISTRATION)
......
......@@ -164,7 +164,7 @@ namespace campvis {
template<typename T, size_t ND>
void campvis::ConcurrentGenericHistogramND<T, ND>::addSample(T sample[ND]) {
size_t bucketNumbers[ND];
for(int i = 0; i < ND; ++i)
for (size_t i = 0; i < ND; ++i)
bucketNumbers[i] = getBucketNumber(i, sample[i]);
size_t index = getArrayIndex(bucketNumbers);
......
......@@ -10,6 +10,8 @@
%include lua_fnptr.i
%{
#include <cstdio>
#include <iostream>
#include "tbb/recursive_mutex.h"
#include "ext/sigslot/sigslot.h"
%}
......@@ -284,7 +286,7 @@ namespace sigslot {
{}
virtual _connection_base0<mt_policy>* clone() {
return new _lua_connection0(copySlotFunction(), _lua_state_mutex);
return new _lua_connection0(this->copySlotFunction(), this->_lua_state_mutex);
}
virtual _connection_base0<mt_policy>* duplicate(sigslot::has_slots<mt_policy>* pnewdest) {
......@@ -298,11 +300,11 @@ namespace sigslot {
virtual void emitSignal() {
std::list<ArgWithTypeInfoType>* argWithTypeInfoList = new std::list<ArgWithTypeInfoType>(0);
callLuaSlot(argWithTypeInfoList);
this->callLuaSlot(argWithTypeInfoList);
}
virtual has_slots<mt_policy>* getdest() const {
return getDummyDest();
return this->getDummyDest();
}
};
......@@ -322,7 +324,7 @@ namespace sigslot {
{}
virtual _connection_base1<arg1_type, mt_policy>* clone() {
return new _lua_connection1(copySlotFunction(), _lua_state_mutex);
return new _lua_connection1(this->copySlotFunction(), this->_lua_state_mutex);
}
virtual _connection_base1<arg1_type, mt_policy>* duplicate(sigslot::has_slots<mt_policy>* pnewdest) {
......@@ -336,11 +338,11 @@ namespace sigslot {
virtual void emitSignal(arg1_type a1) {
std::list<ArgWithTypeInfoType>* argWithTypeInfoList = getArgWithTypeInfoList<arg1_type>(a1);
callLuaSlot(argWithTypeInfoList);
this->callLuaSlot(argWithTypeInfoList);
}
virtual has_slots<mt_policy>* getdest() const {
return getDummyDest();
return this->getDummyDest();
}
};
......@@ -361,7 +363,7 @@ namespace sigslot {
{}
virtual _connection_base2<arg1_type, arg2_type, mt_policy>* clone() {
return new _lua_connection2(copySlotFunction(), _lua_state_mutex);
return new _lua_connection2(this->copySlotFunction(), this->_lua_state_mutex);
}
virtual _connection_base2<arg1_type, arg2_type, mt_policy>* duplicate(sigslot::has_slots<mt_policy>* pnewdest) {
......@@ -375,11 +377,11 @@ namespace sigslot {
virtual void emitSignal(arg1_type a1, arg2_type a2) {
std::list<ArgWithTypeInfoType>* argWithTypeInfoList = getArgWithTypeInfoList<arg1_type, arg2_type>(a1, a2);
callLuaSlot(argWithTypeInfoList);
this->callLuaSlot(argWithTypeInfoList);
}
virtual has_slots<mt_policy>* getdest() const {
return getDummyDest();
return this->getDummyDest();
}
};
......@@ -400,7 +402,7 @@ namespace sigslot {
{}
virtual _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy>* clone() {
return new _lua_connection3(copySlotFunction(), _lua_state_mutex);
return new _lua_connection3(this->copySlotFunction(), this->_lua_state_mutex);
}
virtual _connection_base3<arg1_type, arg2_type, arg3_type,
......@@ -417,11 +419,11 @@ namespace sigslot {
virtual void emitSignal(arg1_type a1, arg2_type a2, arg3_type a3) {
std::list<ArgWithTypeInfoType>* argWithTypeInfoList =
getArgWithTypeInfoList<arg1_type, arg2_type, arg3_type>(a1, a2, a3);
callLuaSlot(argWithTypeInfoList);
this->callLuaSlot(argWithTypeInfoList);
}
virtual has_slots<mt_policy>* getdest() const {
return getDummyDest();
return this->getDummyDest();
}
};
......@@ -442,7 +444,7 @@ namespace sigslot {
{}
virtual _connection_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>* clone() {
return new _lua_connection4(copySlotFunction(), _lua_state_mutex);
return new _lua_connection4(this->copySlotFunction(), this->_lua_state_mutex);
}
virtual _connection_base4<arg1_type, arg2_type, arg3_type, arg4_type,
......@@ -459,11 +461,11 @@ namespace sigslot {
virtual void emitSignal(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4) {
std::list<ArgWithTypeInfoType>* argWithTypeInfoList =
getArgWithTypeInfoList<arg1_type, arg2_type, arg3_type, arg4_type>(a1, a2, a3, a4);
callLuaSlot(argWithTypeInfoList);
this->callLuaSlot(argWithTypeInfoList);
}
virtual has_slots<mt_policy>* getdest() const {
return getDummyDest();
return this->getDummyDest();
}
};
......@@ -484,7 +486,7 @@ namespace sigslot {
{}
virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, mt_policy>* clone() {
return new _lua_connection5(copySlotFunction(), _lua_state_mutex);
return new _lua_connection5(this->copySlotFunction(), this->_lua_state_mutex);
}
virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type,
......@@ -501,11 +503,11 @@ namespace sigslot {
virtual void emitSignal(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5) {
std::list<ArgWithTypeInfoType>* argWithTypeInfoList =
getArgWithTypeInfoList<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type>(a1, a2, a3, a4, a5);
callLuaSlot(argWithTypeInfoList);
this->callLuaSlot(argWithTypeInfoList);
}
virtual has_slots<mt_policy>* getdest() const {
return getDummyDest();
return this->getDummyDest();
}
};
......@@ -530,7 +532,7 @@ namespace sigslot {
virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type,
mt_policy>* clone()
{
return new _lua_connection6(copySlotFunction(), _lua_state_mutex);
return new _lua_connection6(this->copySlotFunction(), this->_lua_state_mutex);
}
virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type,
......@@ -548,11 +550,11 @@ namespace sigslot {
std::list<ArgWithTypeInfoType>* argWithTypeInfoList =
getArgWithTypeInfoList<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type,
arg6_type>(a1, a2, a3, a4, a5, a6);
callLuaSlot(argWithTypeInfoList);
this->callLuaSlot(argWithTypeInfoList);
}
virtual has_slots<mt_policy>* getdest() const {
return getDummyDest();
return this->getDummyDest();
}
};
......@@ -577,7 +579,7 @@ namespace sigslot {
virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type,
mt_policy>* clone()
{
return new _lua_connection7(copySlotFunction(), _lua_state_mutex);
return new _lua_connection7(this->copySlotFunction(), this->_lua_state_mutex);
}
virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type,
......@@ -597,11 +599,11 @@ namespace sigslot {
std::list<ArgWithTypeInfoType>* argWithTypeInfoList =
getArgWithTypeInfoList<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type,
arg7_type>(a1, a2, a3, a4, a5, a6, a7);
callLuaSlot(argWithTypeInfoList);
this->callLuaSlot(argWithTypeInfoList);
}
virtual has_slots<mt_policy>* getdest() const {
return getDummyDest();
return this->getDummyDest();
}
};
......@@ -626,7 +628,7 @@ namespace sigslot {
virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type,
arg8_type, mt_policy>* clone()
{
return new _lua_connection8(copySlotFunction(), _lua_state_mutex);
return new _lua_connection8(this->copySlotFunction(), this->_lua_state_mutex);
}
virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type,
......@@ -646,11 +648,11 @@ namespace sigslot {
std::list<ArgWithTypeInfoType>* argWithTypeInfoList =
getArgWithTypeInfoList<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type,
arg7_type, arg8_type>(a1, a2, a3, a4, a5, a6, a7, a8);
callLuaSlot(argWithTypeInfoList);
this->callLuaSlot(argWithTypeInfoList);
}
virtual has_slots<mt_policy>* getdest() const {
return getDummyDest();
return this->getDummyDest();
}
};
}
......
......@@ -15,7 +15,8 @@ LIST(APPEND CampvisModulesSources
LINK_DIRECTORIES(${CampvisGlobalLinkDirectories} ${CampvisModulesLinkDirectories})
ADD_LIBRARY(campvis-modules STATIC
ADD_LIBRARY(campvis-modules ${CampvisSharedStaticModulesFix}
${CampvisModulesSources} ${CampvisModulesHeaders}
)
......
......@@ -41,5 +41,5 @@ SET(RandomWalksLibSources ConfidenceMaps2D.cpp
INCLUDE_DIRECTORIES(${CampvisGlobalIncludeDirs})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
ADD_LIBRARY(RandomWalksLib STATIC ${RandomWalksLibSources} ${RandomWalksLibHeaders})
ADD_LIBRARY(RandomWalksLib ${CampvisSharedStaticModulesFix} ${RandomWalksLibSources} ${RandomWalksLibHeaders})
TARGET_LINK_LIBRARIES(RandomWalksLib ${RandomWalksLibExternalLibs})
......@@ -62,7 +62,7 @@ MACRO(DECLARE_LUA_MODULE InterfaceFile)
SWIG_ADD_MODULE(${LuaModName} lua ${InterfaceFile})
SWIG_LINK_LIBRARIES(${LuaModName} tgt campvis-core campvis-modules ${CampvisGlobalExternalLibs})
SET(LuaModFullPath "${CampvisLuaModulesDirectory}${CMAKE_SHARED_LIBRARY_PREFIX}${LuaModShortName}${CMAKE_SHARED_LIBRARY_SUFFIX}")
SET(LuaModFullPath "${CampvisLuaModulesDirectory}${LuaModShortName}${CMAKE_SHARED_LIBRARY_SUFFIX}")
# The most reliable approach to changing a target's output directory to a sub-directory of the
# main build folder if a multi-config generator (e.g. Visual Studio or XCode) may be used is
......@@ -110,8 +110,10 @@ LIST(APPEND CampvisScriptingHeaders "swigluarun.h")
ADD_DEFINITIONS(${CampvisGlobalDefinitions} ${CampvisScriptingDefinitions})
INCLUDE_DIRECTORIES(${CampvisGlobalIncludeDirs} ${CMAKE_CURRENT_BINARY_DIR})
ADD_LIBRARY(campvis-scripting STATIC
ADD_LIBRARY(campvis-scripting ${CampvisSharedStaticModulesFix}
${CampvisScriptingSources} ${CampvisScriptingHeaders}
)
ADD_DEPENDENCIES(campvis-scripting ${CampvisLuaModules})
TARGET_LINK_LIBRARIES(campvis-scripting campvis-core campvis-modules tgt ${CampvisGlobalExternalLibs})
......@@ -29,7 +29,7 @@ namespace campvis {
* such calls to be propagated through their enclosing tables all the way up to the global
* table.
*/
class LuaTable : private std::enable_shared_from_this<LuaTable>
class LuaTable : public std::enable_shared_from_this<LuaTable>
{
friend RegularLuaTable;
friend GlobalLuaTable;
......
#ifndef LUAVMSTATE_H__
#define LUAVMSTATE_H__
#include <iostream>
#include <memory>
#include <string>
#include "scripting/swigluarun.h"
......
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