-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.bat
80 lines (69 loc) · 3.01 KB
/
setup.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
@echo off
title Setup for mongo-driver-godot
setlocal ENABLEDELAYEDEXPANSION
set build_target="%~1"
set target=%~2
echo Building using %build_target% compiler and %target% target
if not exist "bin/godot-cpp" mkdir "bin/godot-cpp"
if not exist "bin/mongo-c-driver" mkdir "bin/mongo-c-driver"
if not exist "bin/mongo-cxx-driver" mkdir "bin/mongo-cxx-driver"
if not exist "addons/mongo-driver-godot/bin/win64" mkdir "addons/mongo-driver-godot/bin/win64"
pushd %CD%
cd "bin/godot-cpp"
set bin_godot_cpp_dir=%CD%
popd
pushd %CD%
cd "bin/mongo-c-driver"
set bin_mongo_c_driver_dir=%CD%
popd
pushd %CD%
cd "bin/mongo-cxx-driver"
set bin_mongo_cxx_driver_dir=%CD%
popd
pushd %CD%
cd addons/mongo-driver-godot/bin/win64
set project_bin_win_dir=%CD%
popd
set godot_target=release
if %TARGET%==debug (set godot_target=debug)
@REM Check if godot-cpp is built
IF EXIST "bin/godot-cpp/libgodot-cpp.windows.%TARGET%.64.lib" (
echo Found godot-cpp %TARGET% lib
) ELSE (
echo Builing godot-cpp %TARGET% lib
pushd %CD%
cd thirdparty/godot-cpp
scons platform=windows target=%godot_target% generate_bindings=yes -j8
move /Y ".\bin\libgodot-cpp.windows.%godot_target%.64.lib" %bin_godot_cpp_dir%
popd
)
REM Installation instructions from:
REM http://mongoc.org/libmongoc/current/installing.html#preparing-a-build-from-a-git-repository-clone
echo Installing mongo-c-driver
pushd %CD%
cd thirdparty/mongo-c-driver
@REM python -u build/calc_release_version.py > VERSION_CURRENT
mkdir cmake-build
cd cmake-build
set mongoc_target="Release"
if %TARGET%==debug (set mongoc_target="Debug")
cmake -G %build_target% -DENABLE_EXAMPLES=OFF -DENABLE_TESTS=OFF -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DCMAKE_BUILD_TYPE=%mongoc_target% -DCMAKE_INSTALL_PREFIX=%bin_mongo_c_driver_dir% -DCMAKE_PREFIX_PATH=%bin_mongo_c_driver_dir% ..
set mongoc_config_type="RelWithDebInfo"
if %TARGET%=="debug" (set mongoc_config_type="Debug")
cmake --build . --config MinSizeRel --target install
popd
REM Installation instructions from:
REM http://mongocxx.org/mongocxx-v3/installation/windows/#step-4-configure-the-driver
echo Installing mongo-cxx-driver
pushd %CD%
cd thirdparty/mongo-cxx-driver/build
set mongocxx_target="Release"
if %TARGET%==debug (set mongocxx_target="Debug")
cmake -G %build_target% -DCMAKE_CXX_STANDARD=17 -DCMAKE_CXX_FLAGS="/Zc:__cplusplus" -DENABLE_TESTS=OFF -DCMAKE_BUILD_TYPE=%mongocxx_target% -DLIBMONGOC_DIR==%bin_mongo_c_driver_dir% -DLIBBSON_DIR==%bin_mongo_c_driver_dir% -DCMAKE_PREFIX_PATH=%bin_mongo_c_driver_dir% -DCMAKE_INSTALL_PREFIX=%bin_mongo_cxx_driver_dir% ..
set mongocxx_config_type="RelWithDebInfo"
if %TARGET%==debug (set mongocxx_config_type="Debug")
cmake --build . --config %mongocxx_config_type% --target install
popd
echo Copying dlls to project
(robocopy %bin_mongo_c_driver_dir%\bin %project_bin_win_dir% /NFL /NDL /NJH /NJS /nc /ns /np /IS /IT) ^& IF %ERRORLEVEL% LSS 8 SET ERRORLEVEL = 0
(robocopy %bin_mongo_cxx_driver_dir%\bin %project_bin_win_dir% /NFL /NDL /NJH /NJS /nc /ns /np /IS /IT) ^& IF %ERRORLEVEL% LSS 8 SET ERRORLEVEL = 0