Skip to content
This repository has been archived by the owner on Sep 5, 2020. It is now read-only.

Been Far Even as Decided to use CBash?

Daniel Nunes edited this page Nov 22, 2019 · 1 revision

For the modern manTM who wants CBash built with the minimum fuss. These are two scripts that can be used to build CBash - the parts that can/should be modified to your particular environment are documented.

First, the setup:

@echo off

SET CD_PREV=%CD%

REM The folders where the repos are going to be cloned
REM As it is, they'll be cloned in the same folder this script is in
REM Change as needed
SET ZLIB_ROOT=%~dp0zlib
SET BOOST_ROOT=%~dp0boost
SET CBASH_ROOT=%~dp0CBash

REM These are the minimum versions I could get it to work with
set ZLIB_VERSION=v1.2.11
set BOOST_VERSION=boost-1.71.0

REM The CBash branch to check out
set CBASH_BRANCH=dev

rd /s /q %BOOST_ROOT%
git clone https://github.com/boostorg/boost %BOOST_ROOT% -b %BOOST_VERSION%
cd %BOOST_ROOT%
git submodule init
git submodule update
cd ..

rd /s /q %ZLIB_ROOT%
git clone https://github.com/madler/zlib %ZLIB_ROOT% -b %ZLIB_VERSION%

rd /s /q %CBASH_ROOT%
git clone https://github.com/wrye-bash/CBash.git %CBASH_ROOT% -b %CBASH_BRANCH%
cd %CBASH_ROOT%
git submodule init
git submodule update

cd %CD_PREV%

Run it once (once, Boost takes aaaaaaages).

Now the goodies:

@echo off

SET CD_PREV=%CD%

REM Keep this synced with the locations in the setup!
SET ZLIB_ROOT=%~dp0zlib
SET BOOST_ROOT=%~dp0boost
SET CBASH_ROOT=%~dp0CBash

REM Either 'Debug' or 'Release'
set CONFIG=Debug

REM The path to python.exe - make sure pytest is installed
REM 'path/to/python.exe -m pip install pytest'
set PYTHON_PATH=C:\Python27\python.exe

REM Either '32' or '64'
set BIT=64

echo Compiling zlib...
cd %ZLIB_ROOT%
rd /s /q build
mkdir build && cd build
REM Add '-A Win32' for 32bit builds
cmake ..
cmake --build . --target --config %CONFIG%
copy zconf.h ..
cd ..\..
echo.
echo.

echo Compiling Boost...
cd %BOOST_ROOT%
call bootstrap.bat
call b2 --layout=versioned toolset=msvc-14.2 -sZLIB_LIBPATH=%ZLIB_ROOT% -sZLIB_INCLUDE=%ZLIB_ROOT% address-model=%BIT% link=static variant=release,debug runtime-link=shared threading=multi stage release
cd ..
echo.
echo.

echo Compiling CBash...
cd %CBASH_ROOT%
rd /s /q build
mkdir build && cd build
REM Add '-A Win32' for 32bit builds
cmake .. -DPYTHON_EXECUTABLE=%PYTHON_PATH% -DCBash_BUILD_SHARED_LIBS=ON -DBoost_NO_SYSTEM_PATHS=ON -DCBash_USE_STATIC_RUNTIME=OFF -DCBash_NO_BOOST_ZLIB=ON -DBOOST_ROOT=%BOOST_ROOT% -DBOOST_INCLUDEDIR=%BOOST_ROOT% -DBOOST_LIBRARYDIR=%BOOST_ROOT%\stage\lib -DZLIB_INCLUDE_DIR=%ZLIB_ROOT% -DZLIB_LIBRARY_RELEASE=%ZLIB_ROOT%\build\Release\zlibstatic.lib -DZLIB_LIBRARY_DEBUG=%ZLIB_ROOT%\build\Debug\zlibstaticd.lib
cmake --build . --target --config %CONFIG%

cd %CD_PREV%

Happy torture!

Clone this wiki locally