Explorar o código

Further clean up on URHO3D_OPENGL build option.

Yao Wei Tjong 姚伟忠 %!s(int64=11) %!d(string=hai) anos
pai
achega
8ca1ee6096
Modificáronse 1 ficheiros con 10 adicións e 11 borrados
  1. 10 11
      Source/CMake/Modules/Urho3D-CMake-common.cmake

+ 10 - 11
Source/CMake/Modules/Urho3D-CMake-common.cmake

@@ -71,9 +71,14 @@ if (URHO3D_TESTING)
 else ()
     unset (URHO3D_TEST_TIME_OUT CACHE)
 endif ()
+# The URHO3D_OPENGL option is not defined on non-Windows platforms as they should always use OpenGL
 if (MSVC)
+    # On MSVC compiler, default to false (i.e. prefers Direct3D)
+    # OpenGL can be manually enabled with -DURHO3D_OPENGL=1, but Windows graphics card drivers are usually better optimized for Direct3D
     option (URHO3D_OPENGL "Use OpenGL instead of Direct3D (Windows platform only)")
 elseif (WIN32)
+    # On non-MSVC compiler on Windows platform, default to true to enable use of OpenGL instead of Direct3D
+    # Direct3D can be manually enabled with -DURHO3D_OPENGL=0, but it is likely to fail unless the MinGW-w64 distribution is used due to dependency to Direct3D headers and libs
     option (URHO3D_OPENGL "Use OpenGL instead of Direct3D (Windows platform only)" TRUE)
 endif ()
 cmake_dependent_option (URHO3D_MKLINK "Use mklink command to create symbolic links (Windows Vista and above only)" FALSE "WIN32" FALSE)
@@ -147,23 +152,17 @@ if (URHO3D_LOGGING)
     add_definitions (-DURHO3D_LOGGING)
 endif ()
 
-# If not on MSVC, enable use of OpenGL instead of Direct3D9 (either not compiling on Windows or
-# with a compiler that may not have an up-to-date DirectX SDK). This can also be unconditionally
-# enabled, but Windows graphics card drivers are usually better optimized for Direct3D. Direct3D can
-# be manually enabled for MinGW with -DURHO3D_OPENGL=0, but is likely to fail due to missing headers
-# and libraries, unless the MinGW-w64 distribution is used.
-if (NOT WIN32 OR NOT DEFINED URHO3D_OPENGL)  # This option is only defined on Windows platform
+# If not on Windows platform, enable Unix mode for kNet library and OpenGL graphic back-end
+if (NOT WIN32)
+    add_definitions (-DUNIX)
     set (URHO3D_OPENGL 1)
 endif ()
+
+# Add definition for OpenGL
 if (URHO3D_OPENGL)
     add_definitions (-DURHO3D_OPENGL)
 endif ()
 
-# If not on Windows, enable Unix mode for kNet library.
-if (NOT WIN32)
-    add_definitions (-DUNIX)
-endif ()
-
 # Add definitions for GLEW
 if (NOT IOS AND NOT ANDROID AND NOT RASPI AND URHO3D_OPENGL)
     add_definitions (-DGLEW_STATIC -DGLEW_NO_GLU)