Browse Source

Switch to Windows subsystem for non-dev builds

JoshEngebretson 9 years ago
parent
commit
92b20423db
2 changed files with 27 additions and 3 deletions
  1. 21 0
      Source/AtomicEditor/Application/Main.cpp
  2. 6 3
      Source/AtomicEditor/CMakeLists.txt

+ 21 - 0
Source/AtomicEditor/Application/Main.cpp

@@ -63,6 +63,17 @@ static int RunPlayerApplication()
 #if defined(_MSC_VER) && defined(_DEBUG) && !defined(ATOMIC_WIN32_CONSOLE)
 #if defined(_MSC_VER) && defined(_DEBUG) && !defined(ATOMIC_WIN32_CONSOLE)
 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, PSTR cmdLine, int showCmd)
 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, PSTR cmdLine, int showCmd)
 {
 {
+
+#ifdef ATOMIC_WEBVIEW
+    int exit_code = Atomic::WebMain(0, nullptr);
+
+    if (exit_code >= 0)
+    {
+        // The sub-process has completed so return here.
+        return exit_code;
+    }
+#endif
+
     _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
     _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
     Atomic::ParseArguments(GetCommandLineW());
     Atomic::ParseArguments(GetCommandLineW());
 
 
@@ -104,6 +115,16 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, PSTR cmdLine, in
 #elif defined(WIN32) && !defined(ATOMIC_WIN32_CONSOLE)
 #elif defined(WIN32) && !defined(ATOMIC_WIN32_CONSOLE)
 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, PSTR cmdLine, int showCmd)
 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance, PSTR cmdLine, int showCmd)
 {
 {
+#ifdef ATOMIC_WEBVIEW
+    int exit_code = Atomic::WebMain(0, nullptr);
+
+    if (exit_code >= 0)
+    {
+        // The sub-process has completed so return here.
+        return exit_code;
+    }
+#endif
+
     Atomic::ParseArguments(GetCommandLineW());
     Atomic::ParseArguments(GetCommandLineW());
 
 
     const Vector<String>& arguments = GetArguments();
     const Vector<String>& arguments = GetArguments();

+ 6 - 3
Source/AtomicEditor/CMakeLists.txt

@@ -32,9 +32,12 @@ else()
     include_directories (${CMAKE_SOURCE_DIR}/Source/ThirdParty/libcurl/include)
     include_directories (${CMAKE_SOURCE_DIR}/Source/ThirdParty/libcurl/include)
     add_definitions(-DCURL_STATICLIB)
     add_definitions(-DCURL_STATICLIB)
 
 
-    # We want the console for now
-    #set (EXE_TYPE WIN32)
-    add_definitions(-DATOMIC_WIN32_CONSOLE)
+    # We want a console for development builds
+    if (${ATOMIC_DEV_BUILD} EQUAL 1)
+      add_definitions(-DATOMIC_WIN32_CONSOLE)
+    else()
+      set (EXE_TYPE WIN32)
+    endif()
 
 
     set (SOURCE_FILES ${SOURCE_FILES} ${CMAKE_SOURCE_DIR}/Build/CMake/Modules/Atomic.rc)
     set (SOURCE_FILES ${SOURCE_FILES} ${CMAKE_SOURCE_DIR}/Build/CMake/Modules/Atomic.rc)