diff --git a/.gitignore b/.gitignore
index f0704cb..06aa286 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,10 @@
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
+# ignore generated Virtools.props
+SuperScriptMaterializer/Virtools.props
+
+# ignore generated database
*.db
*.db-journal
diff --git a/SuperScriptMaterializer.sln b/SuperScriptMaterializer.sln
index f45d987..3ce2cf3 100644
--- a/SuperScriptMaterializer.sln
+++ b/SuperScriptMaterializer.sln
@@ -3,10 +3,10 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29418.71
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SuperScriptMaterializer", "SuperScriptMaterializer\SuperScriptMaterializer.vcxproj", "{4D941003-020F-47FD-9FA2-FFC989E306B8}"
-EndProject
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "SuperScriptViewer", "SuperScriptViewer\SuperScriptViewer.pyproj", "{6D751BF5-87D6-4123-94B3-34721938CF04}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SuperScriptMaterializer", "SuperScriptMaterializer\SuperScriptMaterializer.vcxproj", "{431163D3-86F1-4F6F-921C-062C6A4C70D9}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -17,22 +17,20 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {4D941003-020F-47FD-9FA2-FFC989E306B8}.Debug|Any CPU.ActiveCfg = Debug|Win32
- {4D941003-020F-47FD-9FA2-FFC989E306B8}.Debug|Any CPU.Build.0 = Debug|Win32
- {4D941003-020F-47FD-9FA2-FFC989E306B8}.Debug|x64.ActiveCfg = Debug|Win32
- {4D941003-020F-47FD-9FA2-FFC989E306B8}.Debug|x86.ActiveCfg = Debug|Win32
- {4D941003-020F-47FD-9FA2-FFC989E306B8}.Debug|x86.Build.0 = Debug|Win32
- {4D941003-020F-47FD-9FA2-FFC989E306B8}.Release|Any CPU.ActiveCfg = Release|Win32
- {4D941003-020F-47FD-9FA2-FFC989E306B8}.Release|Any CPU.Build.0 = Release|Win32
- {4D941003-020F-47FD-9FA2-FFC989E306B8}.Release|x64.ActiveCfg = Release|Win32
- {4D941003-020F-47FD-9FA2-FFC989E306B8}.Release|x86.ActiveCfg = Release|Win32
- {4D941003-020F-47FD-9FA2-FFC989E306B8}.Release|x86.Build.0 = Release|Win32
{6D751BF5-87D6-4123-94B3-34721938CF04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D751BF5-87D6-4123-94B3-34721938CF04}.Debug|x64.ActiveCfg = Debug|Any CPU
{6D751BF5-87D6-4123-94B3-34721938CF04}.Debug|x86.ActiveCfg = Debug|Any CPU
{6D751BF5-87D6-4123-94B3-34721938CF04}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D751BF5-87D6-4123-94B3-34721938CF04}.Release|x64.ActiveCfg = Release|Any CPU
{6D751BF5-87D6-4123-94B3-34721938CF04}.Release|x86.ActiveCfg = Release|Any CPU
+ {431163D3-86F1-4F6F-921C-062C6A4C70D9}.Debug|Any CPU.ActiveCfg = Debug|Win32
+ {431163D3-86F1-4F6F-921C-062C6A4C70D9}.Debug|x64.ActiveCfg = Debug|Win32
+ {431163D3-86F1-4F6F-921C-062C6A4C70D9}.Debug|x86.ActiveCfg = Debug|Win32
+ {431163D3-86F1-4F6F-921C-062C6A4C70D9}.Debug|x86.Build.0 = Debug|Win32
+ {431163D3-86F1-4F6F-921C-062C6A4C70D9}.Release|Any CPU.ActiveCfg = Release|Win32
+ {431163D3-86F1-4F6F-921C-062C6A4C70D9}.Release|x64.ActiveCfg = Release|Win32
+ {431163D3-86F1-4F6F-921C-062C6A4C70D9}.Release|x86.ActiveCfg = Release|Win32
+ {431163D3-86F1-4F6F-921C-062C6A4C70D9}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/SuperScriptMaterializer/SuperScriptMaterializer.vcxproj b/SuperScriptMaterializer/SuperScriptMaterializer.vcxproj
index 06243d1..1523f58 100644
--- a/SuperScriptMaterializer/SuperScriptMaterializer.vcxproj
+++ b/SuperScriptMaterializer/SuperScriptMaterializer.vcxproj
@@ -18,13 +18,13 @@
- v142
+ v100
Dynamic
MultiByte
false
- v142
+ v100
true
MultiByte
Dynamic
@@ -62,9 +62,10 @@
Level3
$(VIRTOOLS_HEADER_PATH);$(SQLITE_HEADER_PATH);%(AdditionalIncludeDirectories)
Disabled
- WIN32;_WINDOWS;_USRDLL;$(VIRTOOLS_VER);$(BML_SPECIAL_MACRO);VX_MEM_RELEASE;$(VIRTOOLS_BUILD_TYPE);%(PreprocessorDefinitions)
+ WIN32;_WINDOWS;_USRDLL;$(VIRTOOLS_VER);VIRTOOLS_USER_SDK;_DEBUG;$(BML_SPECIAL_MACRO);VX_MEM_RELEASE;$(VIRTOOLS_BUILD_TYPE);%(PreprocessorDefinitions)
EnableFastChecks
true
+ 4819
$(VIRTOOLS_OUTPUT_PATH)SuperScriptMaterializer.$(VIRTOOLS_BUILD_SUFFIX)
@@ -74,8 +75,7 @@
$(VIRTOOLS_ATTACH_REF);$(SQLITE_ATTACH_REF);%(AdditionalDependencies)
true
$(VIRTOOLS_OUTPUT_PATH)SuperScriptMaterializer.pdb
- Windows
- SuperScriptMaterializer.def
+ $(VIRTOOLS_MODULE_DEFINE)
@@ -91,14 +91,14 @@
Default
$(VIRTOOLS_HEADER_PATH);$(SQLITE_HEADER_PATH);%(AdditionalIncludeDirectories)
ProgramDatabase
- WIN32;_WINDOWS;_USRDLL;$(VIRTOOLS_VER);$(BML_SPECIAL_MACRO);VX_MEM_RELEASE;_RELEASE;$(VIRTOOLS_BUILD_TYPE);%(PreprocessorDefinitions)
+ WIN32;_WINDOWS;_USRDLL;$(VIRTOOLS_VER);VIRTOOLS_USER_SDK;_DEBUG;$(BML_SPECIAL_MACRO);VX_MEM_RELEASE;_RELEASE;$(VIRTOOLS_BUILD_TYPE);%(PreprocessorDefinitions)
EnableFastChecks
+ 4819
- Windows
true
true
- SuperScriptMaterializer.def
+ $(VIRTOOLS_MODULE_DEFINE)
$(VIRTOOLS_OUTPUT_PATH)SuperScriptMaterializer.$(VIRTOOLS_BUILD_SUFFIX)
$(VIRTOOLS_LIB_PATH);$(SQLITE_LIB_PATH);%(AdditionalLibraryDirectories)
$(VIRTOOLS_ATTACH_REF);$(SQLITE_ATTACH_REF);%(AdditionalDependencies)
@@ -119,6 +119,7 @@
+
diff --git a/SuperScriptMaterializer/SuperScriptMaterializer.vcxproj.filters b/SuperScriptMaterializer/SuperScriptMaterializer.vcxproj.filters
index 1f7cfaa..3f7e0d2 100644
--- a/SuperScriptMaterializer/SuperScriptMaterializer.vcxproj.filters
+++ b/SuperScriptMaterializer/SuperScriptMaterializer.vcxproj.filters
@@ -15,39 +15,42 @@
+
+ 头文件
+
+
+ 头文件
+
+
+ 头文件
+
+
+ 头文件
+
头文件
头文件
-
- 头文件
-
-
- 头文件
-
-
- 头文件
-
-
- 头文件
-
-
- 源文件
-
-
- 源文件
-
源文件
+
+ 源文件
+
+
+ 源文件
+
源文件
-
+
+ 源文件
+
+
源文件
diff --git a/SuperScriptMaterializer/Virtools.props b/SuperScriptMaterializer/Virtools.props
deleted file mode 100644
index 551026b..0000000
--- a/SuperScriptMaterializer/Virtools.props
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
-
-
- Application
-
-
- Application
-
-
- E:\Virtools\Virtools Dev 5.0\Sdk/Includes
- E:\Virtools\Virtools Dev 5.0\Sdk/Lib/Win32/Release
- D:\CppLib\SQLite\sqlite-amalgamation-3310100
- D:\CppLib\SQLite\sqlite-dll-win32-x86-3310100
- E:\Virtools\Virtools Dev 5.0\
- VIRTOOLS_STANDALONE
- E:\Virtools\Virtools Dev 5.0\SuperScriptMaterializer.exe
- E:\Virtools\Virtools Dev 5.0
- exe
- VIRTOOLS_50
-
- vxmath.lib;DllEditor.lib;ck2.lib;InterfaceControls.lib;CKControls.lib
- sqlite3.lib
-
-
-
-
-
- $(VIRTOOLS_HEADER_PATH)
-
-
- $(VIRTOOLS_LIB_PATH)
-
-
- $(SQLITE_HEADER_PATH)
-
-
- $(SQLITE_LIB_PATH)
-
-
- $(VIRTOOLS_OUTPUT_PATH)
-
-
- $(VIRTOOLS_BUILD_TYPE)
-
-
- $(VIRTOOLS_DEBUG_TARGET)
-
-
- $(VIRTOOLS_DEBUG_ROOT)
-
-
- $(VIRTOOLS_BUILD_SUFFIX)
-
-
- $(VIRTOOLS_VER)
-
-
- $(BML_SPECIAL_MACRO)
-
-
- $(VIRTOOLS_ATTACH_REF)
-
-
- $(SQLITE_ATTACH_REF)
-
-
-
diff --git a/SuperScriptMaterializer/database.cpp b/SuperScriptMaterializer/database.cpp
index 881be2e..1532ea6 100644
--- a/SuperScriptMaterializer/database.cpp
+++ b/SuperScriptMaterializer/database.cpp
@@ -75,7 +75,7 @@ void dbEnvDataStructHelper::dispose() {
void database::open(const char* file) {
db = NULL;
- stmtCache = new std::vector(15, NULL);
+ stmtCache = new std::vector(14, NULL); // TODO: sync with tryGetStmt's count
//open db
int result;
@@ -206,7 +206,7 @@ BOOL scriptDatabase::finalJob() {
}
BOOL envDatabase::init() {
- stmtCache = new std::vector(5, NULL);
+ stmtCache = new std::vector(6, NULL); // TODO: sync with tryGetStmt's count
int result;
diff --git a/SuperScriptMaterializer/main.cpp b/SuperScriptMaterializer/main.cpp
index 874d509..dfc5ff3 100644
--- a/SuperScriptMaterializer/main.cpp
+++ b/SuperScriptMaterializer/main.cpp
@@ -1,6 +1,8 @@
#include "stdafx.h"
#include "vt_menu.h"
+#include "vt_player.h"
+#if defined(VIRTOOLS_PLUGIN)
PluginInterface* s_Plugininterface = NULL;
PluginInfo g_PluginInfo0;
@@ -25,18 +27,31 @@ class SuperScriptMaterializer : CWinApp {
SuperScriptMaterializer theApp;
BOOL SuperScriptMaterializer::InitInstance() {
- // TODO: Add your specialized code here and/or call the base class
+ CWinApp::InitInstance();
strcpy(g_PluginInfo0.m_Name, "Super Script Materializer");
g_PluginInfo0.m_PluginType = PluginInfo::PT_EDITOR;
g_PluginInfo0.m_PluginType = (PluginInfo::PLUGIN_TYPE)(g_PluginInfo0.m_PluginType | PluginInfo::PTF_RECEIVENOTIFICATION);
g_PluginInfo0.m_PluginCallback = PluginCallback;
- return CWinApp::InitInstance();
+ return TRUE;
}
int SuperScriptMaterializer::ExitInstance() {
- // TODO: Add your specialized code here and/or call the base class
-
return CWinApp::ExitInstance();
}
+
+#elif defined(VIRTOOLS_STANDALONE)
+
+int main(int argc, char* argv[]) {
+ if (argc != 4) {
+ printf("Arguments too less!\n");
+ printf("Format: SuperScriptMaterializer.exe [virtools composition] [script db path] [env db path]\n");
+ ExitProcess(1);
+ }
+
+ PlayerMain(argv[1], argv[2], argv[3]);
+ return 0;
+}
+
+#endif
\ No newline at end of file
diff --git a/SuperScriptMaterializer/stdafx.h b/SuperScriptMaterializer/stdafx.h
index 24177be..f355fc1 100644
--- a/SuperScriptMaterializer/stdafx.h
+++ b/SuperScriptMaterializer/stdafx.h
@@ -31,6 +31,9 @@
//PLUGIN PRECOMPILED HEADER INCLUDED
#include "CKAll.h"
+
+#if defined(VIRTOOLS_PLUGIN)
+
#include "VIControls.h"
#include "CKControlsAll.h"
#include "VEP_ScriptActionMenu.h"
@@ -38,3 +41,7 @@
#include "VEP_All.h"
using namespace CKControl;
+
+#elif defined(VIRTOOLS_STANDALONE)
+
+#endif
diff --git a/SuperScriptMaterializer/virtools_compatible.cpp b/SuperScriptMaterializer/virtools_compatible.cpp
new file mode 100644
index 0000000..5bf8048
--- /dev/null
+++ b/SuperScriptMaterializer/virtools_compatible.cpp
@@ -0,0 +1,12 @@
+#include "virtools_compatible.h"
+
+#if defined(VIRTOOLS_50) && defined(VIRTOOLS_STANDALONE)
+
+//#define stdin (__acrt_iob_func(0))
+//#define stdout (__acrt_iob_func(1))
+//#define stderr (__acrt_iob_func(2))
+//
+//FILE _iob[] = { *stdin, *stdout, *stderr };
+//extern "C" FILE * __cdecl __iob_func(void) { return _iob; }
+
+#endif
\ No newline at end of file
diff --git a/SuperScriptMaterializer/virtools_compatible.h b/SuperScriptMaterializer/virtools_compatible.h
new file mode 100644
index 0000000..2c85fda
--- /dev/null
+++ b/SuperScriptMaterializer/virtools_compatible.h
@@ -0,0 +1,8 @@
+#if !defined(_YYCDLL_VIRTOOLS_COMPATIBLE_H__IMPORTED_)
+#define _YYCDLL_VIRTOOLS_COMPATIBLE_H__IMPORTED_
+
+#include "stdafx.h"
+
+
+
+#endif
\ No newline at end of file
diff --git a/SuperScriptMaterializer/vt_menu.cpp b/SuperScriptMaterializer/vt_menu.cpp
index e09fda4..bf36356 100644
--- a/SuperScriptMaterializer/vt_menu.cpp
+++ b/SuperScriptMaterializer/vt_menu.cpp
@@ -3,6 +3,8 @@
#include "script_export.h"
#include "env_export.h"
+#if defined(VIRTOOLS_PLUGIN)
+
extern PluginInterface* s_Plugininterface;
CMenu* s_MainMenu = NULL;
@@ -177,3 +179,5 @@ BOOL OpenFileDialog(std::string* returned_file) {
free(file);
return status;
}
+
+#endif
\ No newline at end of file
diff --git a/SuperScriptMaterializer/vt_menu.h b/SuperScriptMaterializer/vt_menu.h
index 1213a47..74cff14 100644
--- a/SuperScriptMaterializer/vt_menu.h
+++ b/SuperScriptMaterializer/vt_menu.h
@@ -1,6 +1,7 @@
#if !defined(_YYCDLL_VT_MENU_H__IMPORTED_)
#define _YYCDLL_VT_MENU_H__IMPORTED_
+#if defined(VIRTOOLS_PLUGIN)
#include "stdafx.h"
#include "database.h"
@@ -12,5 +13,6 @@ void UpdateMenu();
void PluginMenuCallback(int commandID);
BOOL OpenFileDialog(std::string* returned_file);
+#endif
#endif
\ No newline at end of file
diff --git a/SuperScriptMaterializer/vt_player.cpp b/SuperScriptMaterializer/vt_player.cpp
new file mode 100644
index 0000000..c7f433e
--- /dev/null
+++ b/SuperScriptMaterializer/vt_player.cpp
@@ -0,0 +1,93 @@
+#include "vt_player.h"
+#include "script_export.h"
+#include "env_export.h"
+
+#if defined(VIRTOOLS_STANDALONE)
+
+void PlayerMain(const char* virtools_composition, const char* script_db_path, const char* env_db_path) {
+ printf("Super Script Materializer\n");
+ printf("Homepage: https://github.com/yyc12345/SuperScriptMaterializer\n");
+ printf("Report bug: https://github.com/yyc12345/SuperScriptMaterializer/issues\n");
+
+ printf("Parsing %s...\n", virtools_composition);
+
+ // ====================== init ck2 engine
+ CommonAssert(!CKStartUp(), "CKStartUp Error");
+ CKPluginManager* pluginManager = CKGetPluginManager();
+ CommonAssert(pluginManager != NULL, "PluginManager = null");
+ CommonAssert(pluginManager->ParsePlugins("RenderEngines") > 0, "Error loading RenderEngines");
+ CommonAssert(pluginManager->ParsePlugins("Managers") > 0, "Error loading Managers");
+ CommonAssert(pluginManager->ParsePlugins("BuildingBlocks") > 0, "Error loading BuildingBlocks");
+ CommonAssert(pluginManager->ParsePlugins("Plugins") > 0, "Error loading Plugins");
+
+ // ====================== create context and load file
+ CKContext* context = NULL;
+ CommonAssert(!CKCreateContext(&context, NULL), "CKCreateContext Error");
+
+ CKObjectArray* array = CreateCKObjectArray();
+ CommonAssert(!context->Load((char*)virtools_composition, array), "CKContext->Load() Error");
+
+#if defined(_RELEASE)
+ try {
+#endif
+ // ====================== do database export
+ // define and init
+ scriptDatabase* _script_db = new scriptDatabase();
+ dbScriptDataStructHelper* _script_helper = new dbScriptDataStructHelper();
+ envDatabase* _env_db = new envDatabase();
+ dbEnvDataStructHelper* _env_helper = new dbEnvDataStructHelper();
+
+ DeleteFile(script_db_path);
+ DeleteFile(env_db_path);
+ _script_db->open(script_db_path);
+ _script_helper->init(context->GetParameterManager());
+ _env_db->open(env_db_path);
+ _env_helper->init();
+
+ // export
+ IterateScript(context, _script_db, _script_helper);
+
+ IterateParameterOperation(context->GetParameterManager(), _env_db, _env_helper);
+ IterateParameter(context->GetParameterManager(), _env_db, _env_helper);
+ IterateMessage(context->GetMessageManager(), _env_db, _env_helper);
+ IterateAttribute(context->GetAttributeManager(), _env_db, _env_helper);
+ IteratePlugin(CKGetPluginManager(), _env_db, _env_helper);
+ IterateVariable(context->GetVariableManager(), _env_db, _env_helper);
+
+ // free
+ _script_helper->dispose();
+ _script_db->close();
+ _env_helper->dispose();
+ _env_db->close();
+ delete _script_helper;
+ delete _script_db;
+ delete _env_helper;
+ delete _env_db;
+
+#if defined(_RELEASE)
+ } catch (const std::exception & e) {
+ std::string errstr;
+ errstr = "An error occurs, application will exit. Please report to developer with this window and reproduce step.\nError message: ";
+ errstr += e.what();
+ printf("[ERROR] %s", errstr.c_str());
+ ExitProcess(1);
+ }
+#endif
+
+ // ====================== free resources and shutdown engine
+ DeleteCKObjectArray(array);
+ context->ClearAll();
+ CKCloseContext(context);
+ CKShutdown();
+
+ printf("Done!");
+}
+
+void CommonAssert(BOOL condition, const char* desc) {
+ if (!condition) {
+ printf("[ERROR] %s\n", desc);
+ ExitProcess(1);
+ }
+}
+
+#endif
\ No newline at end of file
diff --git a/SuperScriptMaterializer/vt_player.h b/SuperScriptMaterializer/vt_player.h
new file mode 100644
index 0000000..76a5ddb
--- /dev/null
+++ b/SuperScriptMaterializer/vt_player.h
@@ -0,0 +1,13 @@
+#if !defined(_YYCDLL_VT_PLAYER_H__IMPORTED_)
+#define _YYCDLL_VT_PLAYER_H__IMPORTED_
+
+#if defined(VIRTOOLS_STANDALONE)
+#include "stdafx.h"
+#include "database.h"
+
+void PlayerMain(const char* virtools_composition, const char* script_db_path, const char* env_db_path);
+void CommonAssert(BOOL condition, const char* desc);
+
+#endif
+
+#endif
\ No newline at end of file
diff --git a/mk_materializer_cfg.py b/mk_materializer_cfg.py
index 4397022..013ed1e 100644
--- a/mk_materializer_cfg.py
+++ b/mk_materializer_cfg.py
@@ -5,8 +5,6 @@ import sys
# ======================== const define
-program_name = "SuperScriptMaterializer"
-
build_type_standalone = "standalone"
build_type_plugin = "plugin"
valid_build_type = (
@@ -14,13 +12,20 @@ valid_build_type = (
build_type_plugin
)
-virtools_attach_ref_dict = {
+virtools_attach_ref_plugin_dict = {
"21": "vxmath.lib;DllEditor.lib;ck2.lib;InterfaceControls.lib;CKControls.lib",
"25": "vxmath.lib;DllEditor.lib;ck2.lib;InterfaceControls.lib;CKControls.lib",
"35": "vxmath.lib;DllEditor.lib;ck2.lib;InterfaceControls.lib;CKControls.lib",
"40": "vxmath.lib;DllEditor.lib;ck2.lib;InterfaceControls.lib;CKControls.lib",
"50": "vxmath.lib;DllEditor.lib;ck2.lib;InterfaceControls.lib;CKControls.lib"
}
+virtools_attach_ref_standalone_dict = {
+ "21": "vxmath.lib;ck2.lib",
+ "25": "vxmath.lib;ck2.lib",
+ "35": "vxmath.lib;ck2.lib",
+ "40": "vxmath.lib;ck2.lib",
+ "50": "vxmath.lib;ck2.lib"
+}
executable_virtools = {
"21": "Dev.exe",
@@ -117,27 +122,32 @@ sqlite_attach_ref = input_sqlite_attach_ref
virtools_ver = 'VIRTOOLS_' + input_virtools_version
virtools_debug_root = input_virtools_root_path
-virtools_attach_ref = virtools_attach_ref_dict[input_virtools_version]
if input_build_type == build_type_plugin:
virtools_build_type = 'VIRTOOLS_PLUGIN'
virtools_build_suffix = 'dll'
+ virtools_module_define = 'SuperScriptMaterializer.def'
+ virtools_debug_commandline = ''
virtools_debug_target = os.path.join(input_virtools_root_path, executable_virtools[input_virtools_version])
virtools_output_path = os.path.join(input_virtools_root_path, 'InterfacePlugins')
+ virtools_attach_ref = virtools_attach_ref_plugin_dict[input_virtools_version]
elif input_build_type == build_type_standalone:
virtools_build_type = 'VIRTOOLS_STANDALONE'
virtools_build_suffix = 'exe'
+ virtools_module_define = ''
+ virtools_debug_commandline = 'test.nmo test_script.db test_env.db'
virtools_debug_target = os.path.join(input_virtools_root_path, 'SuperScriptMaterializer.exe')
virtools_output_path = input_virtools_root_path
+ virtools_attach_ref = virtools_attach_ref_standalone_dict[input_virtools_version]
# make sure the last char of output_path is slash
if virtools_output_path[-1] != '\\' or virtools_output_path[-1] != '/':
virtools_output_path = virtools_output_path + '\\'
-# in virtools 2.1, we use bml, so we need add bml macro and set virtools header to bml's virtools header
-# also, we don't need set lib path because all virtools file have been imported in project
+# in virtools 2.1, we use bml, so we need add bml macro and set virtools header and virtools lib to blank
+# because all virtools file have been imported in project
if input_virtools_version == '21':
- virtools_header_path = ''#os.path.join(input_bml_path, 'virtools')
+ virtools_header_path = ''
virtools_lib_path = ''
bml_special_macro = 'BML_EXPORT='
else:
@@ -169,6 +179,23 @@ for bt in ('Debug', 'Release'):
node_build_type.appendChild(node_configuration_type)
root.appendChild(node_build_type)
+# ======================== write subsystem
+for bt in ('Debug', 'Release'):
+ node_item_def = dom.createElement('ItemDefinitionGroup')
+ node_item_def.setAttribute('Condition', "'$(Configuration)|$(Platform)'=='{}|Win32'".format(bt))
+
+ node_item_def_link = dom.createElement('Link')
+ node_sub_system = dom.createElement('SubSystem')
+
+ if input_build_type == build_type_standalone:
+ node_sub_system.appendChild(dom.createTextNode('Console'))
+ elif input_build_type == build_type_plugin:
+ node_sub_system.appendChild(dom.createTextNode('Windows'))
+
+ node_item_def_link.appendChild(node_sub_system)
+ node_item_def.appendChild(node_item_def_link)
+ root.appendChild(node_item_def)
+
# ======================== write macro and misc
node_property_group = dom.createElement('PropertyGroup')
node_property_group.setAttribute('Label', 'UserMacros')
@@ -191,11 +218,13 @@ write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_OUTPUT_PATH', v
write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_BUILD_TYPE', virtools_build_type)
write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_DEBUG_TARGET', virtools_debug_target)
write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_DEBUG_ROOT', virtools_debug_root)
+write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_DEBUG_COMMANDLINE', virtools_debug_commandline)
write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_BUILD_SUFFIX', virtools_build_suffix)
write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_VER', virtools_ver)
write_macro(dom, node_property_group, node_item_group, 'BML_SPECIAL_MACRO', bml_special_macro)
write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_ATTACH_REF', virtools_attach_ref)
write_macro(dom, node_property_group, node_item_group, 'SQLITE_ATTACH_REF', sqlite_attach_ref)
+write_macro(dom, node_property_group, node_item_group, 'VIRTOOLS_MODULE_DEFINE', virtools_module_define)
# ======================== write extra compile