Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit 36d964b1 authored by Artur Grunau's avatar Artur Grunau
Browse files

Make a sample Lua pipeline available to the app

This commit marks the start of work on making Lua pipelines as easy to
register and instantiate as regular ones. A sample Lua pipeline has been
made available to the application so that problems with integrating Lua
pipelines can be discovered and fixed.

References #1
parent 32a7ae10
......@@ -60,6 +60,11 @@ IF(CAMPVIS_BUILD_MODULES)
ENDIF()
IF(CAMPVIS_ENABLE_SCRIPTING)
ADD_SUBDIRECTORY(scripting)
LIST(APPEND CampvisGlobalDefinitions "-DCAMPVIS_HAS_SCRIPTING")
ENDIF()
IF(CAMPVIS_BUILD_APPLICATION)
ADD_SUBDIRECTORY(application)
ENDIF()
......@@ -76,10 +81,6 @@ IF(CAMPVIS_BUILD_DOXYGEN)
ADD_SUBDIRECTORY(doc EXCLUDE_FROM_ALL)
ENDIF()
IF(CAMPVIS_ENABLE_SCRIPTING)
ADD_SUBDIRECTORY(scripting)
ENDIF()
#
# Copy External DLLs
......
......@@ -93,21 +93,25 @@ LIST(APPEND CampvisApplicationSources ${CampvisApplicationFormsHeaders})
LINK_DIRECTORIES(${CampvisGlobalLinkDirectories} ${CampvisModulesLinkDirectories})
SET(CampvisMainLibs campvis-core campvis-modules tgt)
IF(CAMPVIS_ENABLE_SCRIPTING)
LIST(APPEND CampvisMainLibs campvis-scripting)
ENDIF(CAMPVIS_ENABLE_SCRIPTING)
ADD_EXECUTABLE(campvis-application
${CampvisApplicationSources} ${CampvisApplicationHeaders}
${CampvisApplicationMoc}
)
ADD_DEFINITIONS(${CampvisGlobalDefinitions} ${CampvisModulesDefinitions} ${CampvisApplicationDefinitions} ${QT_DEFINITIONS})
INCLUDE_DIRECTORIES(${CampvisGlobalIncludeDirs} ${CampvisModulesIncludeDirs})
TARGET_LINK_LIBRARIES(campvis-application campvis-core campvis-modules tgt ${CampvisGlobalExternalLibs} ${CampvisModulesExternalLibs} ${QT_LIBRARIES})
TARGET_LINK_LIBRARIES(campvis-application ${CampvisMainLibs} ${CampvisGlobalExternalLibs} ${CampvisModulesExternalLibs} ${QT_LIBRARIES})
IF(CAMPVIS_GROUP_SOURCE_FILES)
DEFINE_SOURCE_GROUPS_FROM_SUBDIR(CampvisApplicationSources ${CampvisHome} "")
DEFINE_SOURCE_GROUPS_FROM_SUBDIR(CampvisApplicationHeaders ${CampvisHome} "")
ENDIF()
IF(CAMPVIS_DEPLOY_SHADERS)
LIST(APPEND CampvisShaderDirectories "application/glsl")
LIST(APPEND CampvisShaderDirectories "core/glsl")
......
......@@ -46,6 +46,10 @@
#include "core/pipeline/visualizationprocessor.h"
#include "modules/pipelinefactory.h"
#ifdef CAMPVIS_HAS_SCRIPTING
#include "scripting/scriptedpipelineregistrar.h"
#endif
namespace campvis {
const std::string CampVisApplication::loggerCat_ = "CAMPVis.application.CampVisApplication";
......
......@@ -44,9 +44,14 @@ ADD_CUSTOM_COMMAND(
LIST(APPEND CampvisScriptingHeaders "swigluarun.h")
ADD_EXECUTABLE(campvis-scripting ${CampvisScriptingSources} ${CampvisScriptingHeaders})
ADD_EXECUTABLE(campvis-scripting-test ${CampvisScriptingSources} ${CampvisScriptingHeaders})
ADD_DEFINITIONS(${CampvisGlobalDefinitions} ${CampvisScriptingDefinitions})
INCLUDE_DIRECTORIES(${CampvisGlobalIncludeDirs} ${CMAKE_CURRENT_BINARY_DIR})
TARGET_LINK_LIBRARIES(campvis-scripting-test campvis-core campvis-modules tgt ${CampvisGlobalExternalLibs})
ADD_LIBRARY(campvis-scripting
${CampvisScriptingSources} ${CampvisScriptingHeaders}
)
TARGET_LINK_LIBRARIES(campvis-scripting campvis-core campvis-modules tgt ${CampvisGlobalExternalLibs})
# If a multi-config generator is used (e.g. Visual Studio or XCode), CAMPVis Lua modules will be
......
#include "luapipeline.h"
extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}
......@@ -10,7 +11,7 @@ extern "C" {
namespace campvis {
void LuaPipeline::callLuaFunc(lua_State* _luaState, int nargs, int nresults) {
void LuaPipeline::callLuaFunc(int nargs, int nresults) {
if (lua_pcall(_luaState, nargs, nresults, 0) != LUA_OK) {
this->logLuaError();
}
......@@ -72,7 +73,7 @@ namespace campvis {
else {
lua_getfield(_luaState, -1, "ctor");
lua_getglobal(_luaState, "pipeline");
callLuaFunc(_luaState, 1, 0);
callLuaFunc(1, 0);
}
// Pop the pipeline table
......@@ -100,7 +101,7 @@ namespace campvis {
lua_getglobal(_luaState, "pipeline");
lua_getfield(_luaState, -1, "init");
lua_getglobal(_luaState, "pipeline");
callLuaFunc(_luaState, 1, 0);
callLuaFunc(1, 0);
// Pop the pipeline table
lua_pop(_luaState, 1);
......@@ -112,7 +113,7 @@ namespace campvis {
lua_getglobal(_luaState, "pipeline");
lua_getfield(_luaState, -1, "deinit");
lua_getglobal(_luaState, "pipeline");
callLuaFunc(_luaState, 1, 0);
callLuaFunc(1, 0);
// Pop the pipeline table
lua_pop(_luaState, 1);
......
#ifndef LUAPIPELINE_H__
#define LUAPIPELINE_H__
extern "C" {
#include "lua.h"
}
#include "core/pipeline/autoevaluationpipeline.h"
struct lua_State;
namespace campvis {
class LuaPipeline : public AutoEvaluationPipeline {
......@@ -43,10 +41,10 @@ namespace campvis {
/**
* Call the Lua function that's at the top of the stack.
*/
void callLuaFunc(lua_State* _luaState, int nargs, int nresults);
void callLuaFunc(int nargs, int nresults);
const std::string _scriptPath; ///< path to the Lua script defining the pipeline
lua_State* _luaState; ///< Lua state used to evaluate the pipeline
struct lua_State* _luaState; ///< Lua state used to evaluate the pipeline
};
}
......
......@@ -16,8 +16,8 @@ function pipeline:ctor()
self.ve = vis.VolumeExplorer(ivp)
self.resampler = vis.GlImageResampler(ivp)
--self.addProcessor(instance, self.gir)
--self.addProcessor(instance, self.ve)
self.addProcessor(instance, self.resampler)
self.addProcessor(instance, self.ve)
end
function pipeline:init()
......
#ifndef SCRIPTEDPIPELINEREGISTRAR_H__
#define SCRIPTEDPIPELINEREGISTRAR_H__
#include "luapipeline.h"
#include "modules/pipelinefactory.h"
namespace campvis {
static const size_t _factoryId = PipelineFactory::getRef().registerPipeline<LuaPipeline>([] (DataContainer* dc) -> AbstractPipeline* {
return new campvis::LuaPipeline(CAMPVIS_SOURCE_DIR "/scripting/script.lua", dc);
});
}
#endif // SCRIPTEDPIPELINEREGISTRAR_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