|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setlocal ENABLEDELAYEDEXPANSION |
|
|
|
set CMAKE_GENERATOR="Visual Studio 16 2019" |
|
set CONFIGURATION=RelWithDebInfo |
|
set CRC32C_INSTALL_PREFIX=%cd%\build\%CONFIGURATION% |
|
|
|
|
|
set cmake=cmake |
|
|
|
|
|
set PYTHON_VERSION=%1 |
|
if "%PYTHON_VERSION%"=="" ( |
|
echo "Python version was not provided, using Python 3.9" |
|
set PYTHON_VERSION=3.9 |
|
|
|
) |
|
|
|
if "%PYTHON_VERSION%"=="3.10-dev" ( |
|
set PYTHON_VERSION=3.10 |
|
) |
|
|
|
py -0 |
|
py -%PYTHON_VERSION% -m pip install cmake |
|
|
|
git submodule update --init --recursive |
|
|
|
FOR %%V IN (32,64) DO ( |
|
set TARGET_PLATFORM="x64" |
|
|
|
if "%%V"=="32" ( |
|
set TARGET_PLATFORM="Win32" |
|
) |
|
echo "Target Platform: !TARGET_PLATFORM!" |
|
|
|
pushd google_crc32c |
|
|
|
|
|
git reset --hard |
|
git clean -fxd |
|
|
|
del /s /q CMakeFiles\ |
|
del CMakeCache.txt |
|
|
|
mkdir build |
|
cd build |
|
|
|
echo "Running cmake with Generator: %CMAKE_GENERATOR%, Platform: !TARGET_PLATFORM!, Install Prefix: %CRC32C_INSTALL_PREFIX%" |
|
|
|
%cmake% -G %CMAKE_GENERATOR% -A !TARGET_PLATFORM! -DCMAKE_BUILD_TYPE=Release -DCRC32C_BUILD_BENCHMARKS=no -DCRC32C_BUILD_TESTS=no -DBUILD_SHARED_LIBS=yes -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=yes -DCRC32C_USE_GLOG=0 -DCMAKE_INSTALL_PREFIX:PATH=%CRC32C_INSTALL_PREFIX% .. |
|
|
|
%cmake% --build . --config "%CONFIGURATION%" --target install |
|
|
|
dir %CRC32C_INSTALL_PREFIX% /b /s |
|
popd |
|
|
|
dir %CRC32C_INSTALL_PREFIX%\bin |
|
echo "Copying Binary to root: %CRC32C_INSTALL_PREFIX%\bin\crc32c.dll" |
|
copy %CRC32C_INSTALL_PREFIX%\bin\crc32c.dll . |
|
|
|
py -%PYTHON_VERSION%-%%V -m pip install --upgrade pip setuptools wheel |
|
echo "Building C extension" |
|
py -%PYTHON_VERSION%-%%V setup.py build_ext --include-dirs=%CRC32C_INSTALL_PREFIX%\include --library-dirs=%CRC32C_INSTALL_PREFIX%\lib |
|
echo "Building Wheel" |
|
py -%PYTHON_VERSION%-%%V -m pip wheel . --wheel-dir wheels/ |
|
) |
|
|