This commit is contained in:
Zihan Chen
2020-07-31 18:09:39 -07:00
parent 0a9db6bba0
commit 9dd9f9ae19
6 changed files with 59 additions and 1 deletions
@@ -1,7 +1,6 @@
#include <VlppWorkflowCompiler.h>
#include "../W05_Lib/W05_Lib.h"
using namespace vl::collections;
using namespace vl::stream;
using namespace vl::parsing;
using namespace vl::filesystem;
@@ -0,0 +1,40 @@
#include <VlppWorkflowCompiler.h>
#include "../W05_Lib/W05_Lib.h"
using namespace vl::stream;
using namespace vl::parsing;
using namespace vl::filesystem;
using namespace vl::reflection::description;
using namespace vl::workflow::runtime;
int wmain(int argc, const wchar_t* argv[])
{
// start reflection
LoadPredefinedTypes();
WfLoadLibraryTypes();
LoadMyApiTypes();
GetGlobalTypeManager()->Load();
{
// load the assembly
FilePath assemblyPath = FilePath(argv[0]).GetFolder() / L"WorkflowAssembly.bin";
FileStream fileStream(assemblyPath.GetFullPath(), FileStream::ReadOnly);
CHECK_ERROR(fileStream.IsAvailable(), L"You need to run W05_Compile before W05_DynamicRun.");
WfAssemblyLoadErrors errors;
auto assembly = WfAssembly::Deserialize(fileStream, errors);
// initialize the assembly
auto globalContext = MakePtr<WfRuntimeGlobalContext>(assembly);
auto initializeFunction = LoadFunction<void()>(globalContext, L"<initialize>");
initializeFunction();
// call MyApp
auto myapp = Value::Create(L"myscript::MyApp");
auto scripting = UnboxValue<Ptr<myapi::IScripting>>(myapp.Invoke(L"CreateScripting"));
scripting->Execute(L"Gaclib");
}
// stop reflection
DestroyGlobalTypeManager();
}
@@ -190,6 +190,7 @@
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<ClCompile Include="..\W05_Lib\W05_Lib.cpp" />
<ClCompile Include="Main.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\Import\Vlpp.h" />
@@ -42,6 +42,9 @@
<ClCompile Include="..\W05_Lib\W05_Lib.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\Import\Vlpp.h">
@@ -152,6 +152,8 @@
<ClInclude Include="..\..\..\Import\VlppReflection.h" />
<ClInclude Include="..\..\..\Import\VlppRegex.h" />
<ClInclude Include="..\..\..\Import\VlppWorkflowLibrary.h" />
<ClInclude Include="..\W05_DynamicRun\Generated\W05Script.h" />
<ClInclude Include="..\W05_DynamicRun\Generated\W05ScriptIncludes.h" />
<ClInclude Include="..\W05_Lib\W05_Lib.h" />
</ItemGroup>
<ItemGroup>
@@ -185,6 +187,7 @@
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">/bigobj %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">/bigobj %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<ClCompile Include="..\W05_DynamicRun\Generated\W05Script.cpp" />
<ClCompile Include="..\W05_Lib\W05_Lib.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
@@ -16,6 +16,9 @@
<Filter Include="Import">
<UniqueIdentifier>{c19153f0-f627-4efb-9291-6658296b5572}</UniqueIdentifier>
</Filter>
<Filter Include="Generated">
<UniqueIdentifier>{5cde26dc-d02c-4b14-81bd-e3c77ab4c4c9}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\Import\VlppRegex.h">
@@ -36,6 +39,12 @@
<ClInclude Include="..\W05_Lib\W05_Lib.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\W05_DynamicRun\Generated\W05ScriptIncludes.h">
<Filter>Generated</Filter>
</ClInclude>
<ClInclude Include="..\W05_DynamicRun\Generated\W05Script.h">
<Filter>Generated</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\Import\VlppWorkflowLibrary.cpp">
@@ -56,5 +65,8 @@
<ClCompile Include="..\W05_Lib\W05_Lib.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\W05_DynamicRun\Generated\W05Script.cpp">
<Filter>Generated</Filter>
</ClCompile>
</ItemGroup>
</Project>