2
0
Эх сурвалжийг харах

Bake compiler defines used by the database subsystem.
The auto-discovered variables are removed as build options from cmake-gui when it is invoked by Urho3D downstream projects.
Still, ensure the auto-discovered variables prevail over conflicting values potentially specified by user manually or via CLI.

Yao Wei Tjong 姚伟忠 10 жил өмнө
parent
commit
108705d0e2

+ 30 - 26
CMake/Modules/FindUrho3D.cmake

@@ -32,10 +32,13 @@
 #  URHO3D_INCLUDE_DIRS
 #  URHO3D_INCLUDE_DIRS
 #  URHO3D_LIBRARIES
 #  URHO3D_LIBRARIES
 #  URHO3D_VERSION
 #  URHO3D_VERSION
-#  URHO3D_64BIT (may be used as input variable for multilib-capable compilers; must be anyway specified for MSVC due to CMake/VS generator limitation)
+#  URHO3D_64BIT (may be used as input variable for multilib-capable compilers; must be anyway specified as input variable for MSVC due to CMake/VS generator limitation)
 #  URHO3D_LIB_TYPE (may be used as input variable as well to limit the search of library type)
 #  URHO3D_LIB_TYPE (may be used as input variable as well to limit the search of library type)
 #  URHO3D_OPENGL
 #  URHO3D_OPENGL
 #  URHO3D_SSE
 #  URHO3D_SSE
+#  URHO3D_DATABASE
+#  URHO3D_DATABASE_ODBC
+#  URHO3D_DATABASE_SQLITE
 #
 #
 # WIN32 only:
 # WIN32 only:
 #  URHO3D_LIBRARIES_REL
 #  URHO3D_LIBRARIES_REL
@@ -161,6 +164,7 @@ else ()
     if (NOT URHO3D_LIB_TYPE)
     if (NOT URHO3D_LIB_TYPE)
         set (URHO3D_LIB_TYPE_WAS_UNDEFINED TRUE)    # We need this to undefine the auto-discovered URHO3D_LIB_TYPE variable before looping
         set (URHO3D_LIB_TYPE_WAS_UNDEFINED TRUE)    # We need this to undefine the auto-discovered URHO3D_LIB_TYPE variable before looping
     endif ()
     endif ()
+    set (AUTO_DISCOVER_VARS URHO3D_OPENGL URHO3D_D3D11 URHO3D_SSE URHO3D_DATABASE URHO3D_DATABASE_ODBC URHO3D_DATABASE_SQLITE)
     foreach (ABI_64BIT RANGE ${URHO3D_64BIT} 0)
     foreach (ABI_64BIT RANGE ${URHO3D_64BIT} 0)
         # Break if the compiler is not multilib-capable and the ABI is not its native
         # Break if the compiler is not multilib-capable and the ABI is not its native
         if ((MSVC OR MINGW OR ANDROID OR RPI OR EMSCRIPTEN) AND NOT ABI_64BIT EQUAL URHO3D_DEFAULT_64BIT)
         if ((MSVC OR MINGW OR ANDROID OR RPI OR EMSCRIPTEN) AND NOT ABI_64BIT EQUAL URHO3D_DEFAULT_64BIT)
@@ -208,16 +212,14 @@ else ()
             endif ()
             endif ()
         endif ()
         endif ()
         # For shared library type, also initialize the URHO3D_DLL variable for later use
         # For shared library type, also initialize the URHO3D_DLL variable for later use
-        if (WIN32)
-            if (URHO3D_LIB_TYPE STREQUAL SHARED AND URHO3D_HOME)
-                find_file (URHO3D_DLL_REL Urho3D.dll HINTS ${URHO3D_HOME}/bin NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH DOC "Urho3D release DLL")
-                if (URHO3D_DLL_REL)
-                    list (APPEND URHO3D_DLL ${URHO3D_DLL_REL})
-                endif ()
-                find_file (URHO3D_DLL_DBG Urho3D_d.dll HINTS ${URHO3D_HOME}/bin NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH DOC "Urho3D debug DLL")
-                if (URHO3D_DLL_DBG)
-                    list (APPEND URHO3D_DLL ${URHO3D_DLL_DBG})
-                endif ()
+        if (WIN32 AND URHO3D_LIB_TYPE STREQUAL SHARED AND URHO3D_HOME)
+            find_file (URHO3D_DLL_REL Urho3D.dll HINTS ${URHO3D_HOME}/bin NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH DOC "Urho3D release DLL")
+            if (URHO3D_DLL_REL)
+                list (APPEND URHO3D_DLL ${URHO3D_DLL_REL})
+            endif ()
+            find_file (URHO3D_DLL_DBG Urho3D_d.dll HINTS ${URHO3D_HOME}/bin NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH DOC "Urho3D debug DLL")
+            if (URHO3D_DLL_DBG)
+                list (APPEND URHO3D_DLL ${URHO3D_DLL_DBG})
             endif ()
             endif ()
         endif ()
         endif ()
         # Ensure the module has found the library with the right ABI for the chosen compiler and URHO3D_64BIT build option (if specified)
         # Ensure the module has found the library with the right ABI for the chosen compiler and URHO3D_64BIT build option (if specified)
@@ -238,7 +240,7 @@ else ()
                 endforeach ()
                 endforeach ()
             endif ()
             endif ()
             # Since in cross-compiling mode we cannot run the test target executable and auto-discover the build options used by the found library,
             # Since in cross-compiling mode we cannot run the test target executable and auto-discover the build options used by the found library,
-            # the next best thing is evaluate the found export header indirectly (assuming the found library was built using the same export header)
+            # the next best thing is to evaluate the found export header indirectly (assuming the found library was built using the same export header)
             if (CMAKE_CROSSCOMPILING)
             if (CMAKE_CROSSCOMPILING)
                 set (URHO3D_RUN_RESULT 0)
                 set (URHO3D_RUN_RESULT 0)
                 file (READ ${URHO3D_BASE_INCLUDE_DIR}/Urho3D.h URHO3D_RUN_RESULT__TRYRUN_OUTPUT)
                 file (READ ${URHO3D_BASE_INCLUDE_DIR}/Urho3D.h URHO3D_RUN_RESULT__TRYRUN_OUTPUT)
@@ -252,22 +254,14 @@ else ()
                 # Auto-discover build options used by the found library
                 # Auto-discover build options used by the found library
                 set (URHO3D_64BIT ${ABI_64BIT} CACHE BOOL "Enable 64-bit build, the value is auto-discovered based on the found Urho3D library" FORCE) # Force it as it is more authoritative than user-specified option
                 set (URHO3D_64BIT ${ABI_64BIT} CACHE BOOL "Enable 64-bit build, the value is auto-discovered based on the found Urho3D library" FORCE) # Force it as it is more authoritative than user-specified option
                 set (URHO3D_LIB_TYPE ${URHO3D_LIB_TYPE} CACHE BOOL "Urho3D library type, the value is auto-discovered based on the found Urho3D library" FORCE) # Use the Force, Luke
                 set (URHO3D_LIB_TYPE ${URHO3D_LIB_TYPE} CACHE BOOL "Urho3D library type, the value is auto-discovered based on the found Urho3D library" FORCE) # Use the Force, Luke
-                if (TRY_RUN_OUT MATCHES "#define URHO3D_OPENGL")
-                    set (URHO3D_OPENGL 1 CACHE INTERNAL "Auto-discovered URHO3D_OPENGL build option" FORCE)
-                    unset (URHO3D_D3D11 CACHE)
-                    unset (URHO3D_D3D11)
-                else ()
-                    if (TRY_RUN_OUT MATCHES "#define URHO3D_D3D11")
-                        set (URHO3D_D3D11 1 CACHE INTERNAL "Auto-discovered URHO3D_D3D11 build option" FORCE)
+                foreach (VAR ${AUTO_DISCOVER_VARS})
+                    if (TRY_RUN_OUT MATCHES "#define ${VAR}")
+                        set (AUTO_DISCOVERED_${VAR} 1)
                     else ()
                     else ()
-                        unset (URHO3D_D3D11 CACHE)
-                        unset (URHO3D_D3D11)
+                        set (AUTO_DISCOVERED_${VAR} 0)
                     endif ()
                     endif ()
-                endif ()
-                if (TRY_RUN_OUT MATCHES "#define URHO3D_SSE")
-                    set (AUTO_DISCOVERED_SSE 1)
-                endif ()
-                set (URHO3D_SSE ${AUTO_DISCOVERED_SSE} CACHE INTERNAL "Auto-discovered URHO3D_SSE build option" FORCE)
+                    set (AUTO_DISCOVERED_${VAR} ${AUTO_DISCOVERED_${VAR}} CACHE INTERNAL "Auto-discovered ${VAR} build option")
+                endforeach ()
                 break ()
                 break ()
             else ()
             else ()
                 # Prepare for the second attempt by resetting the variables as necessary
                 # Prepare for the second attempt by resetting the variables as necessary
@@ -282,6 +276,16 @@ else ()
             endif ()
             endif ()
         endif ()
         endif ()
     endforeach ()
     endforeach ()
+    # Ensure auto-discovered variables always prefail over user settings in all the subsequent cmake rerun (even without redoing try_run)
+    foreach (VAR ${AUTO_DISCOVER_VARS})
+        if (DEFINED ${VAR} AND DEFINED AUTO_DISCOVERED_${VAR})  # Cannot combine these two ifs due to variable expansion error when it is not defined
+            if ((${VAR} AND NOT ${AUTO_DISCOVERED_${VAR}}) OR (NOT ${VAR} AND ${AUTO_DISCOVERED_${VAR}}))
+                message (WARNING "Conflicting ${VAR} build option is ignored.")
+                unset (${VAR} CACHE)
+            endif ()
+        endif ()
+        set (${VAR} ${AUTO_DISCOVERED_${VAR}})
+    endforeach ()
     # Restore CMake global settings
     # Restore CMake global settings
     if (CMAKE_FIND_LIBRARY_SUFFIXES_SAVED)
     if (CMAKE_FIND_LIBRARY_SUFFIXES_SAVED)
         set (CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SAVED})
         set (CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SAVED})

+ 32 - 34
CMake/Modules/Urho3D-CMake-common.cmake

@@ -109,45 +109,13 @@ option (URHO3D_LUA "Enable additional Lua scripting support" TRUE)
 cmake_dependent_option (URHO3D_LUAJIT "Enable Lua scripting support using LuaJIT (check LuaJIT's CMakeLists.txt for more options)" FALSE "NOT EMSCRIPTEN" FALSE)
 cmake_dependent_option (URHO3D_LUAJIT "Enable Lua scripting support using LuaJIT (check LuaJIT's CMakeLists.txt for more options)" FALSE "NOT EMSCRIPTEN" FALSE)
 option (URHO3D_NAVIGATION "Enable navigation support" TRUE)
 option (URHO3D_NAVIGATION "Enable navigation support" TRUE)
 cmake_dependent_option (URHO3D_NETWORK "Enable networking support" TRUE "NOT EMSCRIPTEN" FALSE)
 cmake_dependent_option (URHO3D_NETWORK "Enable networking support" TRUE "NOT EMSCRIPTEN" FALSE)
-cmake_dependent_option (URHO3D_DATABASE_ODBC "Enable Database support with ODBC, requires vendor-specific ODBC driver" FALSE "NOT IOS AND NOT ANDROID AND NOT EMSCRIPTEN" FALSE)
 option (URHO3D_PHYSICS "Enable physics support" TRUE)
 option (URHO3D_PHYSICS "Enable physics support" TRUE)
 option (URHO3D_URHO2D "Enable 2D graphics and physics support" TRUE)
 option (URHO3D_URHO2D "Enable 2D graphics and physics support" TRUE)
-if (NOT DEFINED URHO3D_DEFAULT_SSE)
-    # Set the default to true for all the platforms that support SSE except the following
-    set (URHO3D_DEFAULT_SSE TRUE)
-    if (MINGW)
-        # Certain MinGW versions fail to compile SSE code. This is the initial guess for known "bad" version range, and can be tightened later
-        execute_process (COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION ERROR_QUIET)
-        if (GCC_VERSION VERSION_LESS 4.9.1)
-            message (WARNING "Disabling SSE by default due to MinGW version. It is recommended to upgrade to MinGW with GCC >= 4.9.1. You can also try to re-enable SSE with CMake option -DURHO3D_SSE=1, but this may result in compile errors.")
-            set (URHO3D_DEFAULT_SSE FALSE)
-        endif ()
-    elseif (EMSCRIPTEN)
-        # In Emscripten, default to false for targeting SSE2, since the SIMD.js specification is not yet widely adopted in browsers
-        set (URHO3D_DEFAULT_SSE FALSE)
-    endif ()
-    set (URHO3D_DEFAULT_SSE ${URHO3D_DEFAULT_SSE} CACHE INTERNAL "Default value for URHO3D_SSE build option")
-endif ()
-cmake_dependent_option (URHO3D_SSE "Enable SSE2 instruction set (HTML5 and Intel platforms only including Android on Intel Atom); default to true on Intel and false on HTML5; the effective SSE level could be higher, see also URHO3D_DEPLOYMENT_TARGET and CMAKE_OSX_DEPLOYMENT_TARGET build options" ${URHO3D_DEFAULT_SSE} "NOT ARM" FALSE)
 if (IOS OR (RPI AND "${RPI_ABI}" MATCHES NEON))    # Stringify in case RPI_ABI is not set explicitly
 if (IOS OR (RPI AND "${RPI_ABI}" MATCHES NEON))    # Stringify in case RPI_ABI is not set explicitly
     # The 'NEON' CMake variable is already set by android.toolchain.cmake when the chosen ANDROID_ABI uses NEON
     # The 'NEON' CMake variable is already set by android.toolchain.cmake when the chosen ANDROID_ABI uses NEON
     set (NEON TRUE)
     set (NEON TRUE)
 endif ()
 endif ()
 cmake_dependent_option (URHO3D_NEON "Enable NEON instruction set (ARM platforms with NEON only)" TRUE "NEON" FALSE)
 cmake_dependent_option (URHO3D_NEON "Enable NEON instruction set (ARM platforms with NEON only)" TRUE "NEON" FALSE)
-# The URHO3D_OPENGL option is not available on non-Windows platforms as they should always use OpenGL, i.e. URHO3D_OPENGL variable will always be forced to TRUE
-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
-    set (DEFAULT_OPENGL FALSE)
-else ()
-    # 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
-    set (DEFAULT_OPENGL TRUE)
-endif ()
-cmake_dependent_option (URHO3D_OPENGL "Use OpenGL instead of Direct3D (Windows platform only)" ${DEFAULT_OPENGL} "WIN32" TRUE)      # Force the variable to TRUE when not WIN32
-# On Windows platform Direct3D11 can be optionally chosen
-# Using Direct3D11 on non-MSVC compiler may require copying and renaming Microsoft official libraries (.lib to .a), else link failures or non-functioning graphics may result
-cmake_dependent_option (URHO3D_D3D11 "Use Direct3D11 instead of Direct3D9 (Windows platform only); overrides URHO3D_OPENGL option" FALSE "WIN32" FALSE)
 if (CMAKE_HOST_WIN32)
 if (CMAKE_HOST_WIN32)
     if (NOT DEFINED URHO3D_MKLINK)
     if (NOT DEFINED URHO3D_MKLINK)
         # Test whether the host system is capable of setting up symbolic link
         # Test whether the host system is capable of setting up symbolic link
@@ -177,6 +145,37 @@ if (RPI)
 endif ()
 endif ()
 if (CMAKE_PROJECT_NAME STREQUAL Urho3D)
 if (CMAKE_PROJECT_NAME STREQUAL Urho3D)
     set (URHO3D_LIB_TYPE STATIC CACHE STRING "Specify Urho3D library type, possible values are STATIC (default) and SHARED")
     set (URHO3D_LIB_TYPE STATIC CACHE STRING "Specify Urho3D library type, possible values are STATIC (default) and SHARED")
+    # The URHO3D_OPENGL option is not available on non-Windows platforms as they should always use OpenGL, i.e. URHO3D_OPENGL variable will always be forced to TRUE
+    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
+        set (DEFAULT_OPENGL FALSE)
+    else ()
+        # 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
+        set (DEFAULT_OPENGL TRUE)
+    endif ()
+    cmake_dependent_option (URHO3D_OPENGL "Use OpenGL instead of Direct3D (Windows platform only)" ${DEFAULT_OPENGL} "WIN32" TRUE)      # Force the variable to TRUE when not WIN32
+    # On Windows platform Direct3D11 can be optionally chosen
+    # Using Direct3D11 on non-MSVC compiler may require copying and renaming Microsoft official libraries (.lib to .a), else link failures or non-functioning graphics may result
+    cmake_dependent_option (URHO3D_D3D11 "Use Direct3D11 instead of Direct3D9 (Windows platform only); overrides URHO3D_OPENGL option" FALSE "WIN32" FALSE)
+    if (NOT DEFINED URHO3D_DEFAULT_SSE)
+        # Set the default to true for all the platforms that support SSE except the following
+        set (URHO3D_DEFAULT_SSE TRUE)
+        if (MINGW)
+            # Certain MinGW versions fail to compile SSE code. This is the initial guess for known "bad" version range, and can be tightened later
+            execute_process (COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION ERROR_QUIET)
+            if (GCC_VERSION VERSION_LESS 4.9.1)
+                message (WARNING "Disabling SSE by default due to MinGW version. It is recommended to upgrade to MinGW with GCC >= 4.9.1. You can also try to re-enable SSE with CMake option -DURHO3D_SSE=1, but this may result in compile errors.")
+                set (URHO3D_DEFAULT_SSE FALSE)
+            endif ()
+        elseif (EMSCRIPTEN)
+            # In Emscripten, default to false for targeting SSE2, since the SIMD.js specification is not yet widely adopted in browsers
+            set (URHO3D_DEFAULT_SSE FALSE)
+        endif ()
+        set (URHO3D_DEFAULT_SSE ${URHO3D_DEFAULT_SSE} CACHE INTERNAL "Default value for URHO3D_SSE build option")
+    endif ()
+    cmake_dependent_option (URHO3D_SSE "Enable SSE2 instruction set (HTML5 and Intel platforms only including Android on Intel Atom); default to true on Intel and false on HTML5; the effective SSE level could be higher, see also URHO3D_DEPLOYMENT_TARGET and CMAKE_OSX_DEPLOYMENT_TARGET build options" ${URHO3D_DEFAULT_SSE} "NOT ARM" FALSE)
     cmake_dependent_option (URHO3D_LUAJIT_AMALG "Enable LuaJIT amalgamated build (LuaJIT only)" FALSE "URHO3D_LUAJIT" FALSE)
     cmake_dependent_option (URHO3D_LUAJIT_AMALG "Enable LuaJIT amalgamated build (LuaJIT only)" FALSE "URHO3D_LUAJIT" FALSE)
     cmake_dependent_option (URHO3D_SAFE_LUA "Enable Lua C++ wrapper safety checks (Lua/LuaJIT only)" FALSE "URHO3D_LUA OR URHO3D_LUAJIT" FALSE)
     cmake_dependent_option (URHO3D_SAFE_LUA "Enable Lua C++ wrapper safety checks (Lua/LuaJIT only)" FALSE "URHO3D_LUA OR URHO3D_LUAJIT" FALSE)
     if (CMAKE_BUILD_TYPE STREQUAL Release OR CMAKE_CONFIGURATION_TYPES)
     if (CMAKE_BUILD_TYPE STREQUAL Release OR CMAKE_CONFIGURATION_TYPES)
@@ -195,6 +194,7 @@ if (CMAKE_PROJECT_NAME STREQUAL Urho3D)
     option (URHO3D_DOCS "Generate documentation as part of normal build")
     option (URHO3D_DOCS "Generate documentation as part of normal build")
     option (URHO3D_DOCS_QUIET "Generate documentation as part of normal build, suppress generation process from sending anything to stdout")
     option (URHO3D_DOCS_QUIET "Generate documentation as part of normal build, suppress generation process from sending anything to stdout")
     option (URHO3D_PCH "Enable PCH support" TRUE)
     option (URHO3D_PCH "Enable PCH support" TRUE)
+    cmake_dependent_option (URHO3D_DATABASE_ODBC "Enable Database support with ODBC, requires vendor-specific ODBC driver" FALSE "NOT IOS AND NOT ANDROID AND NOT EMSCRIPTEN" FALSE)
     option (URHO3D_DATABASE_SQLITE "Enable Database support with SQLite embedded")
     option (URHO3D_DATABASE_SQLITE "Enable Database support with SQLite embedded")
     cmake_dependent_option (URHO3D_MINIDUMPS "Enable minidumps on crash (VS only)" TRUE "MSVC" FALSE)
     cmake_dependent_option (URHO3D_MINIDUMPS "Enable minidumps on crash (VS only)" TRUE "MSVC" FALSE)
     option (URHO3D_FILEWATCHER "Enable filewatcher support" TRUE)
     option (URHO3D_FILEWATCHER "Enable filewatcher support" TRUE)
@@ -477,11 +477,9 @@ if (URHO3D_DATABASE_ODBC)
     find_package (ODBC REQUIRED)
     find_package (ODBC REQUIRED)
     set (URHO3D_C++11 1)
     set (URHO3D_C++11 1)
     set (URHO3D_DATABASE 1)
     set (URHO3D_DATABASE 1)
-    add_definitions (-DURHO3D_DATABASE -DURHO3D_DATABASE_ODBC)
 endif ()
 endif ()
 if (URHO3D_DATABASE_SQLITE)
 if (URHO3D_DATABASE_SQLITE)
     set (URHO3D_DATABASE 1)
     set (URHO3D_DATABASE 1)
-    add_definitions (-DURHO3D_DATABASE -DURHO3D_DATABASE_SQLITE)
 endif ()
 endif ()
 
 
 # Find Direct3D include & library directories in MS Windows SDK or DirectX SDK. They may also be required by SDL
 # Find Direct3D include & library directories in MS Windows SDK or DirectX SDK. They may also be required by SDL

+ 3 - 0
CMake/Modules/exportheader.cmake.in

@@ -27,6 +27,9 @@
 #cmakedefine URHO3D_OPENGL
 #cmakedefine URHO3D_OPENGL
 #cmakedefine URHO3D_D3D11
 #cmakedefine URHO3D_D3D11
 #cmakedefine URHO3D_SSE
 #cmakedefine URHO3D_SSE
+#cmakedefine URHO3D_DATABASE
+#cmakedefine URHO3D_DATABASE_ODBC
+#cmakedefine URHO3D_DATABASE_SQLITE
 
 
 #ifdef @STATIC_DEFINE@
 #ifdef @STATIC_DEFINE@
 #  define @EXPORT_MACRO_NAME@
 #  define @EXPORT_MACRO_NAME@

+ 1 - 1
Source/Urho3D/Database/DbConnection.h

@@ -24,7 +24,7 @@
 
 
 #ifdef URHO3D_DATABASE_ODBC
 #ifdef URHO3D_DATABASE_ODBC
 #include "ODBC/ODBCConnection.h"
 #include "ODBC/ODBCConnection.h"
-#elif URHO3D_DATABASE_SQLITE
+#elif defined(URHO3D_DATABASE_SQLITE)
 #include "SQLite/SQLiteConnection.h"
 #include "SQLite/SQLiteConnection.h"
 #else
 #else
 #error "Database subsystem not enabled"
 #error "Database subsystem not enabled"

+ 1 - 1
Source/Urho3D/Database/DbResult.h

@@ -24,7 +24,7 @@
 
 
 #ifdef URHO3D_DATABASE_ODBC
 #ifdef URHO3D_DATABASE_ODBC
 #include "ODBC/ODBCResult.h"
 #include "ODBC/ODBCResult.h"
-#elif URHO3D_DATABASE_SQLITE
+#elif defined(URHO3D_DATABASE_SQLITE)
 #include "SQLite/SQLiteResult.h"
 #include "SQLite/SQLiteResult.h"
 #else
 #else
 #error "Database subsystem not enabled"
 #error "Database subsystem not enabled"

+ 8 - 0
Source/Urho3D/LibraryInfo.cpp

@@ -43,6 +43,14 @@ const char* GetCompilerDefines()
 #endif
 #endif
 #ifdef URHO3D_SSE
 #ifdef URHO3D_SSE
     "#define URHO3D_SSE\n"
     "#define URHO3D_SSE\n"
+#endif
+#ifdef URHO3D_DATABASE
+    "#define URHO3D_DATABASE\n"
+#endif
+#ifdef URHO3D_DATABASE_ODBC
+    "#define URHO3D_DATABASE_ODBC\n"
+#elif defined(URHO3D_DATABASE_SQLITE)
+    "#define URHO3D_DATABASE_SQLITE\n"
 #endif
 #endif
     ;
     ;
 }
 }