Skip to content

Commit

Permalink
Updated Windows scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
mwydmuch committed Sep 30, 2021
1 parent 4449cfb commit 425cab0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 48 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ ImportExecutables.cmake
*.cbp

# MSVC
.vs
*.sln
*.suo
*.sdf
*.vcxproj
*.vcxproj.filters
*.vcxproj.user
*.vcxproj*
*.cmd

# Python
*.pyd
Expand Down
49 changes: 14 additions & 35 deletions cmake_all.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ setlocal enabledelayedexpansion

:: %%% Set build config
set PYTHON=ON
set LUA=OFF
set JAVA=OFF
set CMAKE_GENERATOR_NAME=Visual Studio 15 2017 Win64

:: %%% Set your Visual Studio version
set CMAKE_GENERATOR_NAME=Visual Studio 16 2019

:: %%% Set path to folder with libraries and clone/copy https://github.com/mwydmuch/ViZDoomWinDepBin to it.
set LIB_DIR=C:\libs
Expand All @@ -22,11 +22,10 @@ set BOOST_INCLUDEDIR=%BOOST_ROOT%
set BOOST_LIBRARYDIR=%BOOST_ROOT%\libs

:: Python
:: %%% Set Python version (27, 35, 36, 37) or change paths for other distributions
:: %%% Set Python version (35, 36, 37, 38, 39) or change paths for other distributions
:: %%% Python for Windows can be downloaded from https://www.python.org/downloads/windows/
set PYTHON_LOCATION=C:
set PYTHON_VERSION=37
set PYTHON_BIG_VERSION=%PYTHON_VERSION:~0,1%
set PYTHON_VERSION=39
set PYTHON_EXECUTABLE=%PYTHON_LOCATION%\Python%PYTHON_VERSION%\python.exe
set PYTHON_INCLUDE_DIR=%PYTHON_LOCATION%\Python%PYTHON_VERSION%\include
set PYTHON_LIBRARY=%PYTHON_LOCATION%\Python%PYTHON_VERSION%\libs\python%PYTHON_VERSION%.lib
Expand All @@ -42,46 +41,26 @@ set NUMPY_INCLUDES=%PYTHON_LOCATION%\Python%PYTHON_VERSION%\Lib\site-packages\nu
:: Rest of the script
::--------------------------------------------------------------------------------------------------------------------

:: Lua
set LUA_INCLUDE_DIR=%LIB_DIR%\lua\include
set LUA_LIBRARY=%LIB_DIR%\lua\lua5.1.lib

:: ZDoom dependencies
set FMOD_INCLUDE_DIR=%LIB_DIR%\fmod\inc
set FMOD_LIBRARY=%LIB_DIR%\fmod\lib\fmodex64.lib
set MPG123_INCLUDE_DIR=%LIB_DIR%\libmpg123
set MPG123_LIBRARIES=%LIB_DIR%\libmpg123\libmpg123-0.lib
set SNDFILE_INCLUDE_DIR=%LIB_DIR%\libsndfile\include
set SNDFILE_LIBRARY=%LIB_DIR%\libsndfile\lib\libsndfile-1.lib
set OPENAL_INCLUDE_DIR=%LIB_DIR%\openal\include
set OPENAL_LIBRARY=%LIB_DIR%\openal\libs\openal32.lib
set YASM_PATH=%LIB_DIR%\yasm.exe
:: set OPENAL_INCLUDE_DIR=%LIB_DIR%\openal-soft\include\AL
:: set OPENAL_LIBRARY=%LIB_DIR%\openal-soft\libs\Win64\OpenAL32.lib
set OPENALDIR=%LIB_DIR%\openal-soft

:: CMake command
set CMAKE_CMD=-G "%CMAKE_GENERATOR_NAME%" -DCMAKE_BUILD_TYPE=Release -DBOOST_INCLUDEDIR="%BOOST_INCLUDEDIR%" -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" -DBOOST_ROOT="%BOOST_ROOT%" -DFMOD_INCLUDE_DIR="%FMOD_INCLUDE_DIR%" -DFMOD_LIBRARY="%FMOD_LIBRARY%" -DMPG123_INCLUDE_DIR="%MPG123_INCLUDE_DIR%" -DMPG123_LIBRARIES="%MPG123_LIBRARIES%" -DSNDFILE_INCLUDE_DIR="%SNDFILE_INCLUDE_DIR%" -DSNDFILE_LIBRARY="%SNDFILE_LIBRARY%" -DOPENAL_INCLUDE_DIR="%OPENAL_INCLUDE_DIR%" -DOPENAL_LIBRARY="%OPENAL_LIBRARY%" -DNO_ASM=ON
:: -DYASM_PATH="%YASM_PATH%"

if "%LUA%"=="ON" (
set CMAKE_CMD=!CMAKE_CMD! -DBUILD_LUA=ON -DLUA_INCLUDE_DIR="%LUA_INCLUDE_DIR%" -DLUA_LIBRARY="%LUA_LIBRARY%"
)
:: %%% Minimal version
set CMAKE_CMD=-G "%CMAKE_GENERATOR_NAME%" -DCMAKE_BUILD_TYPE=Release -DBOOST_INCLUDEDIR="%BOOST_INCLUDEDIR%" -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" -DBOOST_ROOT="%BOOST_ROOT%" -DNO_ASM=ON

if "%JAVA%"=="ON" (
set CMAKE_CMD=!CMAKE_CMD! -DBUILD_JAVA=ON
)
:: %%% Version with all additional sound deps
:: set CMAKE_CMD=-G "%CMAKE_GENERATOR_NAME%" -DCMAKE_BUILD_TYPE=Release -DBOOST_INCLUDEDIR="%BOOST_INCLUDEDIR%" -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" -DBOOST_ROOT="%BOOST_ROOT%" -DMPG123_INCLUDE_DIR="%MPG123_INCLUDE_DIR%" -DMPG123_LIBRARIES="%MPG123_LIBRARIES%" -DSNDFILE_INCLUDE_DIR="%SNDFILE_INCLUDE_DIR%" -DOPENAL_LIBRARY="%OPENAL_LIBRARY%" -DNO_ASM=ON -DFMOD_INCLUDE_DIR="%FMOD_INCLUDE_DIR%" -DFMOD_LIBRARY="%FMOD_LIBRARY%"

if "%PYTHON%"=="ON" (
if %PYTHON_BIG_VERSION% equ 2 (
set CMAKE_CMD=!CMAKE_CMD! -DBUILD_PYTHON=ON
)

if %PYTHON_BIG_VERSION% equ 3 (
set CMAKE_CMD=!CMAKE_CMD! -DBUILD_PYTHON3=ON
)

set CMAKE_CMD=!CMAKE_CMD! -DPYTHON_EXECUTABLE="%PYTHON_EXECUTABLE%" -DPYTHON_INCLUDE_DIR="%PYTHON_INCLUDE_DIR%" -DPYTHON_LIBRARY="%PYTHON_LIBRARY%" -DNUMPY_INCLUDES=%NUMPY_INCLUDES%
if "%PYTHON%"=="ON" (
set CMAKE_CMD=!CMAKE_CMD! -DBUILD_PYTHON=ON -DPYTHON_EXECUTABLE="%PYTHON_EXECUTABLE%" -DPYTHON_INCLUDE_DIR="%PYTHON_INCLUDE_DIR%" -DPYTHON_LIBRARY="%PYTHON_LIBRARY%" -DNUMPY_INCLUDES=%NUMPY_INCLUDES%
)

del CMakeCache.txt
echo cmake !CMAKE_CMD!
cmake !CMAKE_CMD!

18 changes: 8 additions & 10 deletions scripts/assemble_pip_package.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ set PYTHON_VERSION=%1
set BIN_PATH=%2
set SRC_PATH=%3

:: Replace back-slashes with forward-slashes
set "BIN_PATH=%BIN_PATH:/=\%"
set "SRC_PATH=%SRC_PATH:/=\%"

set PACKAGE_DEST_DIRECTORY=%BIN_PATH%\python%PYTHON_VERSION%
set PACKAGE_DEST_PATH=%PACKAGE_DEST_DIRECTORY%\pip_package
set PACKAGE_DEST_PATH=%PACKAGE_DEST_DIRECTORY%\vizdoom
set PACAKGE_INIT_FILE_SRC=%SRC_PATH%\src\lib_python\__init__.py

set VIZDOOM_EXEC_PATH=%BIN_PATH%\vizdoom.exe
set VIZDOOM_PK3_PATH=%BIN_PATH%\vizdoom.pk3
dir dir %BIN_PATH%\python%PYTHON_VERSION%\vizdoom*.pyd /b /s > %PACKAGE_DEST_DIRECTORY%\tmp.txt
set /p PYTHON_BIN_PATH=<%PACKAGE_DEST_DIRECTORY%\tmp.txt
del %PACKAGE_DEST_DIRECTORY%\tmp.txt
set PYTHON_BIN_DEST_PATH=%PACKAGE_DEST_PATH%\vizdoom.pyd

set FREEDOOM_PATH=%SRC_PATH%\src\freedoom2.wad
set SCENARIOS_DEST_DIR=%PACKAGE_DEST_PATH%\scenarios
set SCENARIOS_PATH=%SRC_PATH%\scenarios
set EXAMPLES_DEST_DIR=%PACKAGE_DEST_PATH%\examples
set EXAMPLES_PATH=%SRC_PATH%\examples\python

if not exist "%PYTHON_BIN_PATH%" (
if not exist "%BIN_PATH%\python%PYTHON_VERSION%\vizdoom*.pyd" (
echo "Library for specified Python version does not exist. Aborting."
exit /B 2
)
Expand All @@ -37,15 +37,13 @@ if not exist "%VIZDOOM_PK3_PATH%" (
exit /B 3
)

del %PACKAGE_DEST_PATH%
rmdir /Q /S %PACKAGE_DEST_PATH%
md %PACKAGE_DEST_PATH%

copy "%PACAKGE_INIT_FILE_SRC%" "%PACKAGE_DEST_PATH%"
copy "%PYTHON_BIN_PATH%" "%PYTHON_BIN_DEST_PATH%"
copy "%VIZDOOM_EXEC_PATH%" "%PACKAGE_DEST_PATH%"
copy "%VIZDOOM_PK3_PATH%" "%PACKAGE_DEST_PATH%"
copy "%BIN_PATH%\*.pyd" "%PACKAGE_DEST_PATH%"
copy "%FREEDOOM_PATH%" "%PACKAGE_DEST_PATH%"
copy "%BIN_PATH%\python%PYTHON_VERSION%\vizdoom*.pyd" "%PACKAGE_DEST_PATH%"
copy "%FREEDOOM_PATH%" "%PACKAGE_DEST_PATH%"
md "%SCENARIOS_DEST_DIR%
copy "%SCENARIOS_PATH%\*.wad" "%SCENARIOS_DEST_DIR%"
Expand Down

0 comments on commit 425cab0

Please sign in to comment.