-
Notifications
You must be signed in to change notification settings - Fork 1
/
build_mlpack.bat
executable file
·45 lines (39 loc) · 1.83 KB
/
build_mlpack.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
rem Build mlpack's Python bindings on a Windows system.
pip install cython delvewheel wheel setuptools
rem Pandas 2.1.0 and newer aren't supported on Win32 anymore, so we use an old
rem version. We also need to use numpy 1.x.
if "%WIN_ARCH%" == "Win32" pip install "numpy<2" "pandas==%PANDAS_VER%"
if not "%WIN_ARCH%" == "Win32" pip install numpy pandas
python -c "import pandas; print(pandas.__version__)"
rem This is needed later for copying libopenblas.dll to the right place.
set rootdir=%cd%
rem Clean any old build directory.
cd mlpack/
rmdir /s /q build
mkdir build
cd build/
rem Configure CMake and build the Python bindings.
cmake -G "%VS_GENERATOR%" ^
-A %WIN_ARCH% ^
-DBLAS_LIBRARIES:FILEPATH="%OPENBLAS_LIB%" ^
-DLAPACK_LIBRARIES:FILEPATH="%OPENBLAS_LIB%" ^
-DARMADILLO_INCLUDE_DIR="%rootdir%\armadillo-11.4.1\tmp\include" ^
-DARMADILLO_LIBRARY="%rootdir%\armadillo-11.4.1\Release\armadillo.lib" ^
-DCEREAL_INCLUDE_DIR="%rootdir%\cereal-1.3.2\include" ^
-DENSMALLEN_INCLUDE_DIR="%rootdir%\ensmallen-2.19.0\include" ^
-DSTB_IMAGE_INCLUDE_DIR="%rootdir%\stb\include" ^
-DBUILD_CLI_EXECUTABLES=OFF ^
-DBUILD_JULIA_BINDINGS=OFF ^
-DBUILD_PYTHON_BINDINGS=ON ^
-DBUILD_SHARED_LIBS=OFF ^
-DCMAKE_BUILD_TYPE=Release ..
cmake --build . --target python --config Release -- -verbosity:detailed
rem The tests cannot be run correctly by cibuildwheel because libopenblas.dll
rem must be in the right directory; so, we copy libopenblas.dll to the right
rem place and manually run a simple test here to ensure that everything is
rem working.
cd src\mlpack\bindings\python\mlpack
cp %OPENBLAS_DLL% .
set PYTHONPATH=%PYTHONPATH%;%rootdir%\mlpack\build\src\mlpack\bindings\python
cd ..
python -c "import mlpack; import numpy as np; x = np.random.rand(100, 10); o = mlpack.pca(input_=x, new_dimensionality=5, verbose=True)"