2014-04-06 01:24:12 +08:00
|
|
|
@echo off
|
|
|
|
rem ***************************************************************************
|
|
|
|
rem * _ _ ____ _
|
|
|
|
rem * Project ___| | | | _ \| |
|
|
|
|
rem * / __| | | | |_) | |
|
|
|
|
rem * | (__| |_| | _ <| |___
|
|
|
|
rem * \___|\___/|_| \_\_____|
|
|
|
|
rem *
|
2023-01-02 20:51:48 +08:00
|
|
|
rem * Copyright (C) Steve Holme, <steve_holme@hotmail.com>.
|
2014-04-06 01:24:12 +08:00
|
|
|
rem *
|
|
|
|
rem * This software is licensed as described in the file COPYING, which
|
|
|
|
rem * you should have received as part of this distribution. The terms
|
2020-11-04 21:02:01 +08:00
|
|
|
rem * are also available at https://curl.se/docs/copyright.html.
|
2014-04-06 01:24:12 +08:00
|
|
|
rem *
|
|
|
|
rem * You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
|
|
rem * copies of the Software, and permit persons to whom the Software is
|
|
|
|
rem * furnished to do so, under the terms of the COPYING file.
|
|
|
|
rem *
|
|
|
|
rem * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
rem * KIND, either express or implied.
|
2023-01-02 20:51:48 +08:00
|
|
|
rem *
|
2014-04-06 01:24:12 +08:00
|
|
|
rem * SPDX-License-Identifier: curl
|
|
|
|
rem *
|
|
|
|
rem ***************************************************************************
|
|
|
|
|
2014-11-02 21:00:31 +08:00
|
|
|
:begin
|
|
|
|
rem Check we are running on a Windows NT derived OS
|
|
|
|
if not "%OS%" == "Windows_NT" goto nodos
|
2015-02-02 05:56:59 +08:00
|
|
|
|
2015-08-08 18:09:08 +08:00
|
|
|
rem Set our variables
|
|
|
|
setlocal ENABLEEXTENSIONS
|
|
|
|
set VERSION=ALL
|
|
|
|
set MODE=GENERATE
|
|
|
|
|
2015-04-09 00:09:30 +08:00
|
|
|
rem Check we are not running on a network drive
|
|
|
|
if "%~d0."=="\\." goto nonetdrv
|
|
|
|
|
|
|
|
rem Switch to this batch file's directory
|
|
|
|
cd /d "%~0\.." 1>NUL 2>&1
|
|
|
|
|
2015-08-07 00:33:02 +08:00
|
|
|
rem Check we are running from a curl git repository
|
|
|
|
if not exist ..\GIT-INFO goto norepo
|
|
|
|
|
2014-11-02 21:00:31 +08:00
|
|
|
:parseArgs
|
2015-02-02 05:56:59 +08:00
|
|
|
if "%~1" == "" goto start
|
2014-11-02 21:00:31 +08:00
|
|
|
|
2015-08-15 03:59:48 +08:00
|
|
|
if /i "%~1" == "pre" (
|
|
|
|
set VERSION=PRE
|
2014-11-02 21:00:31 +08:00
|
|
|
) else if /i "%~1" == "vc10" (
|
2015-02-02 05:56:59 +08:00
|
|
|
set VERSION=VC10
|
2014-11-02 21:00:31 +08:00
|
|
|
) else if /i "%~1" == "vc11" (
|
2015-02-02 05:56:59 +08:00
|
|
|
set VERSION=VC11
|
2014-11-02 21:00:31 +08:00
|
|
|
) else if /i "%~1" == "vc12" (
|
2015-02-02 05:56:59 +08:00
|
|
|
set VERSION=VC12
|
2015-07-27 03:59:16 +08:00
|
|
|
) else if /i "%~1" == "vc14" (
|
|
|
|
set VERSION=VC14
|
2022-02-14 05:58:04 +08:00
|
|
|
) else if /i "%~1" == "vc14.10" (
|
|
|
|
set VERSION=VC14.10
|
|
|
|
) else if /i "%~1" == "vc14.30" (
|
|
|
|
set VERSION=VC14.30
|
2015-02-02 05:56:59 +08:00
|
|
|
) else if /i "%~1" == "-clean" (
|
|
|
|
set MODE=CLEAN
|
2015-08-08 18:04:55 +08:00
|
|
|
) else if /i "%~1" == "-?" (
|
|
|
|
goto syntax
|
|
|
|
) else if /i "%~1" == "-h" (
|
|
|
|
goto syntax
|
|
|
|
) else if /i "%~1" == "-help" (
|
|
|
|
goto syntax
|
2014-11-02 21:00:31 +08:00
|
|
|
) else (
|
|
|
|
goto unknown
|
|
|
|
)
|
2015-08-10 00:59:31 +08:00
|
|
|
|
2015-02-02 05:56:59 +08:00
|
|
|
shift & goto parseArgs
|
2018-09-24 06:24:02 +08:00
|
|
|
|
2015-02-02 05:56:59 +08:00
|
|
|
:start
|
2015-08-15 03:44:55 +08:00
|
|
|
if exist ..\buildconf.bat (
|
|
|
|
if "%MODE%" == "GENERATE" (
|
|
|
|
call ..\buildconf
|
|
|
|
) else if "%VERSION%" == "PRE" (
|
|
|
|
call ..\buildconf -clean
|
|
|
|
) else if "%VERSION%" == "ALL" (
|
|
|
|
call ..\buildconf -clean
|
|
|
|
)
|
2015-04-09 00:09:30 +08:00
|
|
|
)
|
2015-08-15 03:59:48 +08:00
|
|
|
if "%VERSION%" == "PRE" goto success
|
2015-02-02 05:56:59 +08:00
|
|
|
if "%VERSION%" == "VC10" goto vc10
|
|
|
|
if "%VERSION%" == "VC11" goto vc11
|
|
|
|
if "%VERSION%" == "VC12" goto vc12
|
2015-07-27 03:59:16 +08:00
|
|
|
if "%VERSION%" == "VC14" goto vc14
|
2022-02-14 05:58:04 +08:00
|
|
|
if "%VERSION%" == "VC14.10" goto vc14.10
|
|
|
|
if "%VERSION%" == "VC14.30" goto vc14.30
|
2014-11-02 21:00:31 +08:00
|
|
|
|
|
|
|
:vc10
|
|
|
|
echo.
|
2015-02-02 05:56:59 +08:00
|
|
|
|
|
|
|
if "%MODE%" == "GENERATE" (
|
|
|
|
echo Generating VC10 project files
|
2015-07-27 03:22:25 +08:00
|
|
|
call :generate vcxproj Windows\VC10\src\curl.tmpl Windows\VC10\src\curl.vcxproj
|
2015-02-02 05:56:59 +08:00
|
|
|
call :generate vcxproj Windows\VC10\lib\libcurl.tmpl Windows\VC10\lib\libcurl.vcxproj
|
|
|
|
) else (
|
|
|
|
echo Removing VC10 project files
|
2015-07-27 03:22:25 +08:00
|
|
|
call :clean Windows\VC10\src\curl.vcxproj
|
2015-02-02 05:56:59 +08:00
|
|
|
call :clean Windows\VC10\lib\libcurl.vcxproj
|
|
|
|
)
|
|
|
|
|
|
|
|
if not "%VERSION%" == "ALL" goto success
|
2014-11-02 21:00:31 +08:00
|
|
|
|
|
|
|
:vc11
|
|
|
|
echo.
|
2015-02-02 05:56:59 +08:00
|
|
|
|
|
|
|
if "%MODE%" == "GENERATE" (
|
|
|
|
echo Generating VC11 project files
|
2015-07-27 03:22:25 +08:00
|
|
|
call :generate vcxproj Windows\VC11\src\curl.tmpl Windows\VC11\src\curl.vcxproj
|
2015-02-02 05:56:59 +08:00
|
|
|
call :generate vcxproj Windows\VC11\lib\libcurl.tmpl Windows\VC11\lib\libcurl.vcxproj
|
|
|
|
) else (
|
|
|
|
echo Removing VC11 project files
|
2015-07-27 03:22:25 +08:00
|
|
|
call :clean Windows\VC11\src\curl.vcxproj
|
2015-02-02 05:56:59 +08:00
|
|
|
call :clean Windows\VC11\lib\libcurl.vcxproj
|
|
|
|
)
|
|
|
|
|
|
|
|
if not "%VERSION%" == "ALL" goto success
|
2014-11-02 21:00:31 +08:00
|
|
|
|
|
|
|
:vc12
|
|
|
|
echo.
|
2015-02-02 05:56:59 +08:00
|
|
|
|
|
|
|
if "%MODE%" == "GENERATE" (
|
|
|
|
echo Generating VC12 project files
|
2015-07-27 03:22:25 +08:00
|
|
|
call :generate vcxproj Windows\VC12\src\curl.tmpl Windows\VC12\src\curl.vcxproj
|
2015-02-02 05:56:59 +08:00
|
|
|
call :generate vcxproj Windows\VC12\lib\libcurl.tmpl Windows\VC12\lib\libcurl.vcxproj
|
|
|
|
) else (
|
|
|
|
echo Removing VC12 project files
|
2015-07-27 03:22:25 +08:00
|
|
|
call :clean Windows\VC12\src\curl.vcxproj
|
2015-02-02 05:56:59 +08:00
|
|
|
call :clean Windows\VC12\lib\libcurl.vcxproj
|
|
|
|
)
|
2014-11-02 21:00:31 +08:00
|
|
|
|
2015-07-27 03:59:16 +08:00
|
|
|
if not "%VERSION%" == "ALL" goto success
|
|
|
|
|
|
|
|
:vc14
|
|
|
|
echo.
|
|
|
|
|
|
|
|
if "%MODE%" == "GENERATE" (
|
|
|
|
echo Generating VC14 project files
|
|
|
|
call :generate vcxproj Windows\VC14\src\curl.tmpl Windows\VC14\src\curl.vcxproj
|
|
|
|
call :generate vcxproj Windows\VC14\lib\libcurl.tmpl Windows\VC14\lib\libcurl.vcxproj
|
|
|
|
) else (
|
|
|
|
echo Removing VC14 project files
|
|
|
|
call :clean Windows\VC14\src\curl.vcxproj
|
|
|
|
call :clean Windows\VC14\lib\libcurl.vcxproj
|
|
|
|
)
|
|
|
|
|
2017-12-23 01:58:41 +08:00
|
|
|
if not "%VERSION%" == "ALL" goto success
|
|
|
|
|
2022-02-14 05:58:04 +08:00
|
|
|
:vc14.10
|
2017-12-23 01:58:41 +08:00
|
|
|
echo.
|
|
|
|
|
|
|
|
if "%MODE%" == "GENERATE" (
|
2022-02-14 05:58:04 +08:00
|
|
|
echo Generating VC14.10 project files
|
|
|
|
call :generate vcxproj Windows\VC14.10\src\curl.tmpl Windows\VC14.10\src\curl.vcxproj
|
|
|
|
call :generate vcxproj Windows\VC14.10\lib\libcurl.tmpl Windows\VC14.10\lib\libcurl.vcxproj
|
2017-12-23 01:58:41 +08:00
|
|
|
) else (
|
2022-02-14 05:58:04 +08:00
|
|
|
echo Removing VC14.10 project files
|
|
|
|
call :clean Windows\VC14.10\src\curl.vcxproj
|
|
|
|
call :clean Windows\VC14.10\lib\libcurl.vcxproj
|
2017-12-23 01:58:41 +08:00
|
|
|
)
|
|
|
|
|
2022-02-11 19:49:11 +08:00
|
|
|
if not "%VERSION%" == "ALL" goto success
|
|
|
|
|
2022-02-14 05:58:04 +08:00
|
|
|
:vc14.30
|
2022-02-11 19:49:11 +08:00
|
|
|
echo.
|
|
|
|
|
|
|
|
if "%MODE%" == "GENERATE" (
|
2022-02-14 05:58:04 +08:00
|
|
|
echo Generating VC14.30 project files
|
|
|
|
call :generate vcxproj Windows\VC14.30\src\curl.tmpl Windows\VC14.30\src\curl.vcxproj
|
|
|
|
call :generate vcxproj Windows\VC14.30\lib\libcurl.tmpl Windows\VC14.30\lib\libcurl.vcxproj
|
2022-02-11 19:49:11 +08:00
|
|
|
) else (
|
2022-02-14 05:58:04 +08:00
|
|
|
echo Removing VC14.30 project files
|
|
|
|
call :clean Windows\VC14.30\src\curl.vcxproj
|
|
|
|
call :clean Windows\VC14.30\lib\libcurl.vcxproj
|
2022-02-11 19:49:11 +08:00
|
|
|
)
|
|
|
|
|
2014-11-02 21:00:31 +08:00
|
|
|
goto success
|
2014-04-06 01:24:12 +08:00
|
|
|
|
|
|
|
rem Main generate function.
|
|
|
|
rem
|
2022-02-14 05:58:04 +08:00
|
|
|
rem %1 - Project Type (vcxproj for VC10, VC11, VC12, VC14, VC14.10 and VC14.30)
|
2014-04-17 04:13:35 +08:00
|
|
|
rem %2 - Input template file
|
|
|
|
rem %3 - Output project file
|
2014-04-06 01:24:12 +08:00
|
|
|
rem
|
|
|
|
:generate
|
2014-04-17 04:13:35 +08:00
|
|
|
if not exist %2 (
|
2014-04-18 17:45:53 +08:00
|
|
|
echo.
|
2015-08-15 03:38:57 +08:00
|
|
|
echo Error: Cannot open %2
|
2014-04-06 01:24:12 +08:00
|
|
|
exit /B
|
|
|
|
)
|
|
|
|
|
2018-09-24 06:24:02 +08:00
|
|
|
if exist %3 (
|
2014-04-17 04:13:35 +08:00
|
|
|
del %3
|
2014-04-06 01:24:12 +08:00
|
|
|
)
|
|
|
|
|
2014-04-18 17:45:53 +08:00
|
|
|
echo * %CD%\%3
|
2014-04-27 20:57:30 +08:00
|
|
|
for /f "usebackq delims=" %%i in (`"findstr /n ^^ %2"`) do (
|
|
|
|
set "var=%%i"
|
|
|
|
setlocal enabledelayedexpansion
|
|
|
|
set "var=!var:*:=!"
|
|
|
|
|
|
|
|
if "!var!" == "CURL_SRC_C_FILES" (
|
2014-05-01 06:24:42 +08:00
|
|
|
for /f "delims=" %%c in ('dir /b ..\src\*.c') do call :element %1 src "%%c" %3
|
2014-04-27 20:57:30 +08:00
|
|
|
) else if "!var!" == "CURL_SRC_H_FILES" (
|
2014-05-01 06:24:42 +08:00
|
|
|
for /f "delims=" %%h in ('dir /b ..\src\*.h') do call :element %1 src "%%h" %3
|
2014-04-27 20:57:30 +08:00
|
|
|
) else if "!var!" == "CURL_SRC_RC_FILES" (
|
2014-05-01 06:24:42 +08:00
|
|
|
for /f "delims=" %%r in ('dir /b ..\src\*.rc') do call :element %1 src "%%r" %3
|
2014-05-23 06:05:22 +08:00
|
|
|
) else if "!var!" == "CURL_SRC_X_C_FILES" (
|
|
|
|
call :element %1 lib "strtoofft.c" %3
|
2020-08-29 18:54:30 +08:00
|
|
|
call :element %1 lib "timediff.c" %3
|
2014-05-23 06:05:22 +08:00
|
|
|
call :element %1 lib "nonblock.c" %3
|
|
|
|
call :element %1 lib "warnless.c" %3
|
2019-04-14 04:55:51 +08:00
|
|
|
call :element %1 lib "curl_multibyte.c" %3
|
2020-08-01 03:36:56 +08:00
|
|
|
call :element %1 lib "version_win32.c" %3
|
2020-09-09 21:41:25 +08:00
|
|
|
call :element %1 lib "dynbuf.c" %3
|
2014-05-23 06:05:22 +08:00
|
|
|
) else if "!var!" == "CURL_SRC_X_H_FILES" (
|
|
|
|
call :element %1 lib "config-win32.h" %3
|
|
|
|
call :element %1 lib "curl_setup.h" %3
|
|
|
|
call :element %1 lib "strtoofft.h" %3
|
2020-08-29 18:54:30 +08:00
|
|
|
call :element %1 lib "timediff.h" %3
|
2014-05-23 06:05:22 +08:00
|
|
|
call :element %1 lib "nonblock.h" %3
|
|
|
|
call :element %1 lib "warnless.h" %3
|
2018-01-31 08:12:25 +08:00
|
|
|
call :element %1 lib "curl_ctype.h" %3
|
2019-04-14 04:55:51 +08:00
|
|
|
call :element %1 lib "curl_multibyte.h" %3
|
2020-08-01 03:36:56 +08:00
|
|
|
call :element %1 lib "version_win32.h" %3
|
2020-09-09 21:41:25 +08:00
|
|
|
call :element %1 lib "dynbuf.h" %3
|
2014-04-27 20:57:30 +08:00
|
|
|
) else if "!var!" == "CURL_LIB_C_FILES" (
|
2014-05-01 06:24:42 +08:00
|
|
|
for /f "delims=" %%c in ('dir /b ..\lib\*.c') do call :element %1 lib "%%c" %3
|
2014-04-27 20:57:30 +08:00
|
|
|
) else if "!var!" == "CURL_LIB_H_FILES" (
|
2016-11-02 09:31:10 +08:00
|
|
|
for /f "delims=" %%h in ('dir /b ..\include\curl\*.h') do call :element %1 include\curl "%%h" %3
|
2014-05-01 06:24:42 +08:00
|
|
|
for /f "delims=" %%h in ('dir /b ..\lib\*.h') do call :element %1 lib "%%h" %3
|
2014-04-27 20:57:30 +08:00
|
|
|
) else if "!var!" == "CURL_LIB_RC_FILES" (
|
2014-05-01 06:24:42 +08:00
|
|
|
for /f "delims=" %%r in ('dir /b ..\lib\*.rc') do call :element %1 lib "%%r" %3
|
2015-02-27 04:43:46 +08:00
|
|
|
) else if "!var!" == "CURL_LIB_VAUTH_C_FILES" (
|
|
|
|
for /f "delims=" %%c in ('dir /b ..\lib\vauth\*.c') do call :element %1 lib\vauth "%%c" %3
|
|
|
|
) else if "!var!" == "CURL_LIB_VAUTH_H_FILES" (
|
|
|
|
for /f "delims=" %%h in ('dir /b ..\lib\vauth\*.h') do call :element %1 lib\vauth "%%h" %3
|
2019-11-17 16:08:40 +08:00
|
|
|
) else if "!var!" == "CURL_LIB_VQUIC_C_FILES" (
|
|
|
|
for /f "delims=" %%c in ('dir /b ..\lib\vquic\*.c') do call :element %1 lib\vquic "%%c" %3
|
|
|
|
) else if "!var!" == "CURL_LIB_VQUIC_H_FILES" (
|
|
|
|
for /f "delims=" %%h in ('dir /b ..\lib\vquic\*.h') do call :element %1 lib\vquic "%%h" %3
|
|
|
|
) else if "!var!" == "CURL_LIB_VSSH_C_FILES" (
|
|
|
|
for /f "delims=" %%c in ('dir /b ..\lib\vssh\*.c') do call :element %1 lib\vssh "%%c" %3
|
|
|
|
) else if "!var!" == "CURL_LIB_VSSH_H_FILES" (
|
|
|
|
for /f "delims=" %%h in ('dir /b ..\lib\vssh\*.h') do call :element %1 lib\vssh "%%h" %3
|
2014-04-27 20:57:30 +08:00
|
|
|
) else if "!var!" == "CURL_LIB_VTLS_C_FILES" (
|
2014-05-01 06:24:42 +08:00
|
|
|
for /f "delims=" %%c in ('dir /b ..\lib\vtls\*.c') do call :element %1 lib\vtls "%%c" %3
|
2014-04-27 20:57:30 +08:00
|
|
|
) else if "!var!" == "CURL_LIB_VTLS_H_FILES" (
|
2014-05-01 06:24:42 +08:00
|
|
|
for /f "delims=" %%h in ('dir /b ..\lib\vtls\*.h') do call :element %1 lib\vtls "%%h" %3
|
2014-04-06 01:24:12 +08:00
|
|
|
) else (
|
2014-04-27 20:57:30 +08:00
|
|
|
echo.!var!>> %3
|
2014-04-06 01:24:12 +08:00
|
|
|
)
|
2014-04-27 20:57:30 +08:00
|
|
|
|
|
|
|
endlocal
|
2014-04-06 01:24:12 +08:00
|
|
|
)
|
|
|
|
exit /B
|
|
|
|
|
|
|
|
rem Generates a single file xml element.
|
|
|
|
rem
|
2022-02-14 05:58:04 +08:00
|
|
|
rem %1 - Project Type (vcxproj for VC10, VC11, VC12, VC14, VC14.10 and VC14.30)
|
2019-11-17 16:08:40 +08:00
|
|
|
rem %2 - Directory (src, lib, lib\vauth, lib\vquic, lib\vssh, lib\vtls)
|
2014-04-17 04:13:35 +08:00
|
|
|
rem %3 - Source filename
|
|
|
|
rem %4 - Output project file
|
2014-04-06 01:24:12 +08:00
|
|
|
rem
|
|
|
|
:element
|
2014-04-17 04:13:35 +08:00
|
|
|
set "SPACES= "
|
2015-02-27 04:43:46 +08:00
|
|
|
if "%2" == "lib\vauth" (
|
|
|
|
set "TABS= "
|
2019-11-17 16:08:40 +08:00
|
|
|
) else if "%2" == "lib\vquic" (
|
|
|
|
set "TABS= "
|
|
|
|
) else if "%2" == "lib\vssh" (
|
|
|
|
set "TABS= "
|
2015-02-27 04:43:46 +08:00
|
|
|
) else if "%2" == "lib\vtls" (
|
2014-05-17 20:32:22 +08:00
|
|
|
set "TABS= "
|
2014-04-06 01:24:12 +08:00
|
|
|
) else (
|
2014-05-17 20:32:22 +08:00
|
|
|
set "TABS= "
|
2014-04-06 01:24:12 +08:00
|
|
|
)
|
2014-04-17 04:13:35 +08:00
|
|
|
|
2014-05-02 06:14:59 +08:00
|
|
|
call :extension %3 ext
|
|
|
|
|
2014-04-27 20:57:30 +08:00
|
|
|
if "%1" == "dsp" (
|
|
|
|
echo # Begin Source File>> %4
|
|
|
|
echo.>> %4
|
2014-05-01 06:24:42 +08:00
|
|
|
echo SOURCE=..\..\..\..\%2\%~3>> %4
|
2014-04-27 20:57:30 +08:00
|
|
|
echo # End Source File>> %4
|
2014-04-28 01:21:47 +08:00
|
|
|
) else if "%1" == "vcproj1" (
|
|
|
|
echo %TABS%^<File>> %4
|
2014-05-12 01:20:52 +08:00
|
|
|
echo %TABS% RelativePath="..\..\..\..\%2\%~3"^>>> %4
|
2014-04-28 01:21:47 +08:00
|
|
|
echo %TABS%^</File^>>> %4
|
|
|
|
) else if "%1" == "vcproj2" (
|
2014-04-18 17:45:53 +08:00
|
|
|
echo %TABS%^<File>> %4
|
2014-05-12 01:20:52 +08:00
|
|
|
echo %TABS% RelativePath="..\..\..\..\%2\%~3">> %4
|
2014-04-18 17:45:53 +08:00
|
|
|
echo %TABS%^>>> %4
|
|
|
|
echo %TABS%^</File^>>> %4
|
|
|
|
) else if "%1" == "vcxproj" (
|
2014-04-17 04:13:35 +08:00
|
|
|
if "%ext%" == "c" (
|
2014-05-01 06:24:42 +08:00
|
|
|
echo %SPACES%^<ClCompile Include=^"..\..\..\..\%2\%~3^" /^>>> %4
|
2014-04-17 04:13:35 +08:00
|
|
|
) else if "%ext%" == "h" (
|
2014-05-01 06:24:42 +08:00
|
|
|
echo %SPACES%^<ClInclude Include=^"..\..\..\..\%2\%~3^" /^>>> %4
|
2014-04-17 04:13:35 +08:00
|
|
|
) else if "%ext%" == "rc" (
|
2014-05-01 06:24:42 +08:00
|
|
|
echo %SPACES%^<ResourceCompile Include=^"..\..\..\..\%2\%~3^" /^>>> %4
|
2014-04-17 04:13:35 +08:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
exit /B
|
|
|
|
|
|
|
|
rem Returns the extension for a given filename.
|
|
|
|
rem
|
|
|
|
rem %1 - The filename
|
|
|
|
rem %2 - The return value
|
|
|
|
rem
|
|
|
|
:extension
|
2014-05-01 06:24:42 +08:00
|
|
|
set fname=%~1
|
2014-04-17 04:13:35 +08:00
|
|
|
set ename=
|
|
|
|
:loop1
|
|
|
|
if "%fname%"=="" (
|
|
|
|
set %2=
|
|
|
|
exit /B
|
|
|
|
)
|
|
|
|
|
|
|
|
if not "%fname:~-1%"=="." (
|
|
|
|
set ename=%fname:~-1%%ename%
|
|
|
|
set fname=%fname:~0,-1%
|
|
|
|
goto loop1
|
|
|
|
)
|
|
|
|
|
|
|
|
set %2=%ename%
|
2014-04-06 01:24:12 +08:00
|
|
|
exit /B
|
|
|
|
|
2015-02-02 05:56:59 +08:00
|
|
|
rem Removes the given project file.
|
|
|
|
rem
|
|
|
|
rem %1 - The filename
|
|
|
|
rem
|
|
|
|
:clean
|
|
|
|
echo * %CD%\%1
|
|
|
|
|
2018-09-24 06:24:02 +08:00
|
|
|
if exist %1 (
|
2015-02-02 05:56:59 +08:00
|
|
|
del %1
|
|
|
|
)
|
|
|
|
|
|
|
|
exit /B
|
|
|
|
|
2014-11-02 21:00:31 +08:00
|
|
|
:syntax
|
|
|
|
rem Display the help
|
|
|
|
echo.
|
2015-08-15 03:59:48 +08:00
|
|
|
echo Usage: generate [what] [-clean]
|
2014-04-06 01:24:12 +08:00
|
|
|
echo.
|
2015-08-15 03:59:48 +08:00
|
|
|
echo What to generate:
|
2014-11-02 21:00:31 +08:00
|
|
|
echo.
|
2015-08-15 03:59:48 +08:00
|
|
|
echo pre - Prerequisites only
|
2014-11-02 21:00:31 +08:00
|
|
|
echo vc10 - Use Visual Studio 2010
|
|
|
|
echo vc11 - Use Visual Studio 2012
|
|
|
|
echo vc12 - Use Visual Studio 2013
|
2015-07-27 03:59:16 +08:00
|
|
|
echo vc14 - Use Visual Studio 2015
|
2022-02-14 05:58:04 +08:00
|
|
|
echo vc14.10 - Use Visual Studio 2017
|
|
|
|
echo vc14.30 - Use Visual Studio 2022
|
2015-02-02 05:56:59 +08:00
|
|
|
echo.
|
|
|
|
echo -clean - Removes the project files
|
2014-11-02 21:00:31 +08:00
|
|
|
goto error
|
|
|
|
|
|
|
|
:unknown
|
|
|
|
echo.
|
|
|
|
echo Error: Unknown argument '%1'
|
|
|
|
goto error
|
|
|
|
|
|
|
|
:nodos
|
|
|
|
echo.
|
|
|
|
echo Error: Only a Windows NT based Operating System is supported
|
|
|
|
goto error
|
|
|
|
|
2015-04-09 00:09:30 +08:00
|
|
|
:nonetdrv
|
|
|
|
echo.
|
|
|
|
echo Error: This batch file cannot run from a network drive
|
|
|
|
goto error
|
|
|
|
|
2015-08-07 00:33:02 +08:00
|
|
|
:norepo
|
|
|
|
echo.
|
|
|
|
echo Error: This batch file should only be used from a curl git repository
|
|
|
|
goto error
|
|
|
|
|
2015-04-09 00:09:30 +08:00
|
|
|
:seterr
|
|
|
|
rem Set the caller's errorlevel.
|
|
|
|
rem %1[opt]: Errorlevel as integer.
|
|
|
|
rem If %1 is empty the errorlevel will be set to 0.
|
|
|
|
rem If %1 is not empty and not an integer the errorlevel will be set to 1.
|
|
|
|
setlocal
|
|
|
|
set EXITCODE=%~1
|
|
|
|
if not defined EXITCODE set EXITCODE=0
|
|
|
|
echo %EXITCODE%|findstr /r "[^0-9\-]" 1>NUL 2>&1
|
|
|
|
if %ERRORLEVEL% EQU 0 set EXITCODE=1
|
|
|
|
exit /b %EXITCODE%
|
|
|
|
|
2014-11-02 21:00:31 +08:00
|
|
|
:error
|
2015-08-08 18:09:08 +08:00
|
|
|
if "%OS%" == "Windows_NT" endlocal
|
2014-11-02 21:00:31 +08:00
|
|
|
exit /B 1
|
|
|
|
|
|
|
|
:success
|
|
|
|
endlocal
|
|
|
|
exit /B 0
|