forked from michellab/Sire
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile_sire.bat
111 lines (105 loc) · 3.51 KB
/
compile_sire.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
@echo off
set OPTIND=0
set OPTION_h=
set OPTION_help=
set OPTION_install=
set OPTION_G=
set OPTION_clean=
:_loop_args
set _getopt_arg=%1
if defined _getopt_arg (
call :parse_arg %_getopt_arg%
if not errorlevel 1 (
shift /1
set /a OPTIND+=1
goto :_loop_args
)
)
set _getopt_arg=
set _getopt_opt=
set _getopt_value=
set _getopt_bool=
goto :main
:parse_arg
set _getopt_opt=
set _getopt_value=%~1
set _getopt_bool=1
if not "%_getopt_value:~0,1%"=="/" goto :_parse_arg_ret
set _getopt_value=%_getopt_value:~1%
:_loop_arg_chars
if not defined _getopt_value goto :_parse_arg_ret
if "%_getopt_value:~0,1%"==":" (
set _getopt_bool=
set _getopt_value=%_getopt_value:~1%
goto :_parse_arg_ret
) else (
set _getopt_opt=%_getopt_opt%%_getopt_value:~0,1%
set _getopt_value=%_getopt_value:~1%
)
goto :_loop_arg_chars
:_parse_arg_ret
if not defined _getopt_opt exit /B 1
if defined _getopt_bool (
call :set_opt %_getopt_opt% %_getopt_bool%
) else (
call :set_opt %_getopt_opt% %_getopt_value%
)
exit /B 0
:set_opt
set OPTION_%1=%~2
exit /B 0
:main
if defined OPTION_h set OPTION_help=1
if defined OPTION_help (
echo compile_sire.bat /h or /help shows help. 1>&2
echo compile_sire.bat /install:\path\to\sire.app will install Sire in \path\to\sire.app 1>&2
echo compile_sire.bat /clean completely cleans the build directory. 1>&2
exit /B 0
)
if not defined OPTION_install set OPTION_install=C:\sire.app
if not defined OPTION_G set "OPTION_G=Visual Studio 15 2017 Win64"
set "GENERATOR=%OPTION_G%"
set "INSTALL_SIRE_DIR=%OPTION_install%"
if defined OPTION_clean (
echo rmdir /S /Q build/miniconda.sh build\corelib build\wrapper
echo del Miniconda3-*-Windows-*.exe
rmdir 2> NUL /S /Q build/miniconda.sh build\corelib build\wrapper
del 2> NUL Miniconda3-*-Windows-*.exe
echo ...all clean
exit /B 0
)
set "MINICONDA_VERSION=4.7.10"
if [%processor_architecture%]==[AMD64] set MINICONDA_ARCH=x86_64
if [%processor_architecture%]==[x86] set MINICONDA_ARCH=x86
if not defined MINICONDA_ARCH (
echo Unsupported architecture.
exit /B 1
)
echo Running an install under Windows
set MINICONDA_INSTALLER=Miniconda3-%MINICONDA_VERSION%-Windows-%MINICONDA_ARCH%.exe
set MINICONDA=https://repo.continuum.io/miniconda/%MINICONDA_INSTALLER%
if exist "%INSTALL_SIRE_DIR%\" (
echo Install directory "%INSTALL_SIRE_DIR%" already exists. Assuming that miniconda is already installed here.
) else (
if not exist build\%MINICONDA_INSTALLER% (
echo ** Downloading miniconda from %MINICONDA%... **
powershell -Command "Invoke-WebRequest '%MINICONDA%' -OutFile 'build\%MINICONDA_INSTALLER%'"
)
echo ** Installing miniconda **
build\%MINICONDA_INSTALLER% /InstallationType=JustMe /AddToPath=0 /RegisterPython=0 /NoRegistry=1 /S /D=%INSTALL_SIRE_DIR%
)
if exist "%INSTALL_SIRE_DIR%\python.exe" (
echo ** Running the Python install script... **
echo ** "%INSTALL_SIRE_DIR%\python.exe" build\build_sire.py -G "%GENERATOR%" **
call "%INSTALL_SIRE_DIR%\Scripts\activate.bat
"%INSTALL_SIRE_DIR%\python.exe" build\build_sire.py -W Boost_NO_BOOST_CMAKE=ON -G "%GENERATOR%"
call conda.bat deactivate
set PROMPT=$P$G
exit /B 0
) else (
echo ** FATAL **
echo ** Cannot find "%INSTALL_SIRE_DIR%\python.exe" **
echo ** Something went wrong with the miniconda install! **
echo ** Remove "%INSTALL_SIRE_DIR%", then run compile_sire.bat --clean, then try again **
exit /B 1
)