Pārlūkot izejas kodu

Close Windows gap. No pun intended.

- Fix document build on Windows platform as Windows "shell" failed to perform the file name expansion (globbing) as expected.
- Refactor batch files to they can be invoked from any directory (similar to their shell script counterparts).
- Sort header files for generating event list so the output remains the same accross different scandir implementation.
Yao Wei Tjong 姚伟忠 12 gadi atpakaļ
vecāks
revīzija
e97eedb771

+ 23 - 13
Bin/UpdateDocument.bat

@@ -1,18 +1,28 @@
 @echo off
 @echo off
-cd ..\Docs
-echo "Dumping AngelScript API..."
+SETLOCAL ENABLEDELAYEDEXPANSION
+pushd %~dp0\..\Docs
+echo Dumping AngelScript API...
 ..\Bin\ScriptCompiler -dumpapi ScriptAPI.dox AngelScriptAPI.h
 ..\Bin\ScriptCompiler -dumpapi ScriptAPI.dox AngelScriptAPI.h
 if errorlevel 1 exit /B 1
 if errorlevel 1 exit /B 1
-lua -v 1>nul 2>&1
-if %errorlevel%== 0 (
-    echo "Dumping LuaScript API..."
-    set "out=%cd%\LuaScriptAPI.dox"
-    pushd ..\Source\Engine\LuaScript\pkgs
-    lua pkgToDox.lua %out% *.pkg
-    if errorlevel 1 exit /B 1
-    popd
-)
+set "dumpluaapi="
+for %%l in (luajit lua) do call :dumpluaapi %%l
 if not "%1" == "-a" exit /B 0
 if not "%1" == "-a" exit /B 0
-echo "Converting Doxygen files to HTML..."
+echo Converting Doxygen files to HTML...
 doxygen Doxyfile 1>nul
 doxygen Doxyfile 1>nul
-echo "Finish."
+echo Finish.
+popd
+goto :eof
+
+:dumpluaapi
+if "%dumpluaapi%" == "1" goto :eof
+%~dp0\%1 -v 1>nul 2>&1
+if not %errorlevel% == 0 goto :eof
+echo Dumping LuaScript API...
+set "out=%CD%\LuaScriptAPI.dox"
+pushd ..\Source\Engine\LuaScript\pkgs
+set "pkglist="
+for %%f in (*.pkg) do set pkglist=!pkglist! "%%f"
+%~dp0\%1 pkgToDox.lua %out% %pkglist%
+if errorlevel 1 exit /B 1
+popd
+set "dumpluaapi=1"

+ 14 - 8
Bin/UpdateDocument.sh

@@ -1,16 +1,22 @@
-cd $( dirname $0 )/../Docs
-echo "Dumping AngelScript API..."
-../Bin/ScriptCompiler -dumpapi ScriptAPI.dox AngelScriptAPI.h
-if [ $? -ne 0 ]; then exit 1; fi
-lua -v 1>/dev/null 2>&1
-if [ $? -eq 0 ]; then
+dumpluaapi() {
+    $CD/$1 -v 1>/dev/null 2>&1
+    if [ $? -ne 0 ]; then return 1; fi
     echo "Dumping LuaScript API..."
     echo "Dumping LuaScript API..."
     out=`pwd`/LuaScriptAPI.dox
     out=`pwd`/LuaScriptAPI.dox
     pushd ../Source/Engine/LuaScript/pkgs >/dev/null
     pushd ../Source/Engine/LuaScript/pkgs >/dev/null
-    lua pkgToDox.lua $out *.pkg
+    $CD/$1 pkgToDox.lua $out *.pkg
     if [ $? -ne 0 ]; then exit 1; fi
     if [ $? -ne 0 ]; then exit 1; fi
     popd >/dev/null
     popd >/dev/null
-fi
+    return 0
+}
+
+cd $( dirname $0 )
+CD=`pwd`
+cd $CD/../Docs
+echo "Dumping AngelScript API..."
+../Bin/ScriptCompiler -dumpapi ScriptAPI.dox AngelScriptAPI.h
+if [ $? -ne 0 ]; then exit 1; fi
+for l in luajit lua; do dumpluaapi $l && break; done
 if [ "$1" != "-a" ]; then exit 0; fi
 if [ "$1" != "-a" ]; then exit 0; fi
 echo "Converting Doxygen files to HTML..."
 echo "Converting Doxygen files to HTML..."
 doxygen Doxyfile 1>/dev/null
 doxygen Doxyfile 1>/dev/null

+ 6 - 1
Docs/CMakeLists.txt

@@ -58,8 +58,13 @@ if (DOXYGEN_FOUND)
         set (jit jit)
         set (jit jit)
     endif ()
     endif ()
     if (TARGET lua${jit}_interpreter AND NOT CMAKE_CROSSCOMPILING)
     if (TARGET lua${jit}_interpreter AND NOT CMAKE_CROSSCOMPILING)
+        if (WIN32)
+            file (GLOB pkglist ${PROJECT_ROOT_DIR}/Source/Engine/LuaScript/pkgs/*.pkg)
+        else ()
+            set (pkglist *.pkg)
+        endif ()
         add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LuaScriptAPI.dox
         add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/LuaScriptAPI.dox
-            COMMAND ${PROJECT_ROOT_DIR}/Bin/lua${jit} pkgToDox.lua ${CMAKE_CURRENT_SOURCE_DIR}/LuaScriptAPI.dox *.pkg
+            COMMAND ${PROJECT_ROOT_DIR}/Bin/lua${jit} pkgToDox.lua ${CMAKE_CURRENT_SOURCE_DIR}/LuaScriptAPI.dox ${pkglist}
             DEPENDS Urho3D lua${jit}_interpreter
             DEPENDS Urho3D lua${jit}_interpreter
             WORKING_DIRECTORY ${PROJECT_ROOT_DIR}/Source/Engine/LuaScript/pkgs
             WORKING_DIRECTORY ${PROJECT_ROOT_DIR}/Source/Engine/LuaScript/pkgs
             COMMENT "Dumping LuaScript API to LuaScriptAPI.dox")
             COMMENT "Dumping LuaScript API to LuaScriptAPI.dox")

+ 7 - 6
Docs/ScriptAPI.dox

@@ -7292,6 +7292,7 @@ Properties:
 - uint DEBUGHUD_SHOW_MODE
 - uint DEBUGHUD_SHOW_MODE
 - uint DEBUGHUD_SHOW_PROFILER
 - uint DEBUGHUD_SHOW_PROFILER
 - uint DEBUGHUD_SHOW_ALL
 - uint DEBUGHUD_SHOW_ALL
+
 \page EventList Event list
 \page EventList Event list
 
 
 ## %Core events
 ## %Core events
@@ -7380,6 +7381,12 @@ Properties:
 - %Scene : Scene pointer
 - %Scene : Scene pointer
 - %Camera : Camera pointer
 - %Camera : Camera pointer
 
 
+## %IO events
+
+### LogMessage
+- %Message : String
+- %Level : int
+
 ## %Input events
 ## %Input events
 
 
 ### MouseButtonDown
 ### MouseButtonDown
@@ -7470,12 +7477,6 @@ Properties:
 
 
 ### ExitRequested
 ### ExitRequested
 
 
-## %IO events
-
-### LogMessage
-- %Message : String
-- %Level : int
-
 ## %Network events
 ## %Network events
 
 
 ### ServerConnected
 ### ServerConnected

+ 4 - 1
Source/Engine/Script/Script.cpp

@@ -456,7 +456,10 @@ void Script::DumpAPI(DumpMode mode)
         
         
         fileSystem->ScanDir(headerFiles, path, "*.h", SCAN_FILES, true);
         fileSystem->ScanDir(headerFiles, path, "*.h", SCAN_FILES, true);
         if (!headerFiles.Empty())
         if (!headerFiles.Empty())
-            Log::WriteRaw("\\page EventList Event list\n");
+        {
+            Log::WriteRaw("\n\\page EventList Event list\n");
+            Sort(headerFiles.Begin(), headerFiles.End());
+        }
         
         
         for (unsigned i = 0; i < headerFiles.Size(); ++i)
         for (unsigned i = 0; i < headerFiles.Size(); ++i)
         {
         {

+ 2 - 0
cmake_android.bat

@@ -21,6 +21,7 @@
 ::
 ::
 
 
 @echo off
 @echo off
+pushd %~dp0
 :: Define USE_MKLINK to 1 to enable out-of-source build and symbolic linking of resources from Bin directory
 :: Define USE_MKLINK to 1 to enable out-of-source build and symbolic linking of resources from Bin directory
 set "build=Source\Android"
 set "build=Source\Android"
 set "source=.."
 set "source=.."
@@ -49,3 +50,4 @@ if "%use_mklink%" == "1" (
 ) 
 ) 
 echo on
 echo on
 cmake -E chdir %build% cmake -G "Unix Makefiles" -DANDROID=1 -DCMAKE_TOOLCHAIN_FILE=%source%\CMake\Toolchains\android.toolchain.cmake -DLIBRARY_OUTPUT_PATH_ROOT=.  %* %source%
 cmake -E chdir %build% cmake -G "Unix Makefiles" -DANDROID=1 -DCMAKE_TOOLCHAIN_FILE=%source%\CMake\Toolchains\android.toolchain.cmake -DLIBRARY_OUTPUT_PATH_ROOT=.  %* %source%
+@popd

+ 3 - 0
cmake_clean.bat

@@ -21,6 +21,7 @@
 ::
 ::
 
 
 @echo off
 @echo off
+pushd %~dp0
 
 
 :: Clean all the CMake cache
 :: Clean all the CMake cache
 if exist Build\CMakeCache.txt. del /F Build\CMakeCache.txt
 if exist Build\CMakeCache.txt. del /F Build\CMakeCache.txt
@@ -31,3 +32,5 @@ if exist Source\Android\CMakeCache.txt. del /F Source\Android\CMakeCache.txt
 if exist Build\CMakeFiles. rd /S /Q Build\CMakeFiles
 if exist Build\CMakeFiles. rd /S /Q Build\CMakeFiles
 if exist android-Build\CMakeFiles. rd /S /Q android-Build\CMakeFiles
 if exist android-Build\CMakeFiles. rd /S /Q android-Build\CMakeFiles
 if exist Source\Android\CMakeFiles. rd /S /Q Source\Android\CMakeFiles
 if exist Source\Android\CMakeFiles. rd /S /Q Source\Android\CMakeFiles
+
+popd

+ 2 - 0
cmake_mingw.bat

@@ -21,6 +21,8 @@
 ::
 ::
 
 
 @echo off
 @echo off
+pushd %~dp0
 cmake -E make_directory Build
 cmake -E make_directory Build
 echo on
 echo on
 cmake -E chdir Build cmake -G "MinGW Makefiles" %* ..\Source
 cmake -E chdir Build cmake -G "MinGW Makefiles" %* ..\Source
+@popd

+ 2 - 0
cmake_vs2008.bat

@@ -21,6 +21,7 @@
 ::
 ::
 
 
 @echo off
 @echo off
+pushd %~dp0
 cmake -E make_directory Build
 cmake -E make_directory Build
 set "arch="
 set "arch="
 set "version=9 2008"
 set "version=9 2008"
@@ -36,3 +37,4 @@ if not "%1" == "" (
 )
 )
 echo on
 echo on
 cmake -E chdir Build cmake -G "Visual Studio %version%%arch%" %* ..\Source
 cmake -E chdir Build cmake -G "Visual Studio %version%%arch%" %* ..\Source
+@popd

+ 1 - 1
cmake_vs2010.bat

@@ -20,4 +20,4 @@
 :: THE SOFTWARE.
 :: THE SOFTWARE.
 ::
 ::
 
 
-@cmake_vs2008.bat VERSION=10 %*
+@%~dp0\cmake_vs2008.bat VERSION=10 %*

+ 1 - 1
cmake_vs2012.bat

@@ -20,4 +20,4 @@
 :: THE SOFTWARE.
 :: THE SOFTWARE.
 ::
 ::
 
 
-@cmake_vs2008.bat VERSION=11 %*
+@%~dp0\cmake_vs2008.bat VERSION=11 %*

+ 1 - 1
cmake_vs2013.bat

@@ -20,4 +20,4 @@
 :: THE SOFTWARE.
 :: THE SOFTWARE.
 ::
 ::
 
 
-@cmake_vs2008.bat VERSION=12 %*
+@%~dp0\cmake_vs2008.bat VERSION=12 %*