un-nest curl

This commit is contained in:
2025-08-16 11:22:44 -04:00
parent 77186c88dd
commit 58cabadc44
5586 changed files with 310 additions and 310 deletions

View File

@@ -0,0 +1,152 @@
<!--
Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
-->
Building via IDE Project Files
==============================
This document describes how to compile, build and install curl and libcurl
from sources using legacy versions of Visual Studio 2010 - 2013.
You need to generate the project files before using them. Please run "generate
-help" for usage details.
To generate project files for recent versions of Visual Studio instead, use
cmake. Refer to INSTALL-CMAKE.md in the docs directory.
Another way to build curl using Visual Studio is without project files. Refer
to README in the winbuild directory.
## Directory Structure
The following directory structure is used for the legacy project files:
somedirectory\
|_curl
|_projects
|_<platform>
|_<ide>
|_lib
|_src
This structure allows for side-by-side compilation of curl on the same machine
using different versions of a given compiler (for example VC10 and VC12) and
allows for your own application or product to be compiled against those
variants of libcurl for example.
Note: Typically this side-by-side compilation is generally only required when
a library is being compiled against dynamic runtime libraries.
## Dependencies
The projects files also support build configurations that require third party
dependencies such as OpenSSL and libssh2. If you wish to support these, you
also need to download and compile those libraries as well.
To support compilation of these libraries using different versions of
compilers, the following directory structure has been used for both the output
of curl and libcurl as well as these dependencies.
somedirectory\
|_curl
| |_ build
| |_<architecture>
| |_<ide>
| |_<configuration>
| |_lib
| |_src
|
|_openssl
| |_ build
| |_<architecture>
| |_VC <version>
| |_<configuration>
|
|_libssh2
|_ build
|_<architecture>
|_VC <version>
|_<configuration>
As OpenSSL does not support side-by-side compilation when using different
versions of Visual Studio, a helper batch file has been provided to assist
with this. Please run `build-openssl -help` for usage details.
## Building with Visual C++
To build with VC++, you have to first install VC++ which is part of Visual
Studio.
Once you have VC++ installed you should launch the application and open one of
the solution or workspace files. The VC directory names are based on the
version of Visual C++ that you use. Each version of Visual Studio has a
default version of Visual C++. We offer these versions:
- VC10 (Visual Studio 2010 Version 10.0)
- VC11 (Visual Studio 2012 Version 11.0)
- VC12 (Visual Studio 2013 Version 12.0)
Separate solutions are provided for both libcurl and the curl command line
tool as well as a solution that includes both projects. libcurl.sln, curl.sln
and curl-all.sln, respectively. We recommend using curl-all.sln to build both
projects.
For example, if you are using Visual Studio 2010 then you should be able to
use `VC10\curl-all.sln` to build curl and libcurl.
## Running DLL based configurations
If you are a developer and plan to run the curl tool from Visual Studio with
any third-party libraries (such as OpenSSL or libssh2) then you need to add
the search path of these DLLs to the configuration's PATH environment. To do
that:
1. Open the 'curl-all.sln' or 'curl.sln' solutions
2. Right-click on the 'curl' project and select Properties
3. Navigate to 'Configuration Properties > Debugging > Environment'
4. Add `PATH='Path to DLL';C:\Windows\System32;C:\Windows;C:\Windows\System32\Wbem`
... where 'Path to DLL` is the configuration specific path. For example the
following configurations in Visual Studio 2010 might be:
DLL Debug - DLL OpenSSL (Win32):
PATH=..\..\..\..\..\openssl\build\Win32\VC10\DLL Debug;C:\Windows\System32;
C:\Windows;C:\Windows\System32\Wbem
DLL Debug - DLL OpenSSL (x64):
PATH=..\..\..\..\..\openssl\build\Win64\VC10\DLL Debug;C:\Windows\System32;
C:\Windows;C:\Windows\System32\Wbem
If you are using a configuration that uses multiple third-party library DLLs
(such as DLL Debug - DLL OpenSSL - DLL libssh2) then 'Path to DLL' need to
contain the path to both of these.
## Notes
The following keywords have been used in the directory hierarchy:
- `<platform>` - The platform (For example: Windows)
- `<ide>` - The IDE (For example: VC10)
- `<architecture>` - The platform architecture (For example: Win32, Win64)
- `<configuration>` - The target configuration (For example: DLL Debug, LIB
Release - LIB OpenSSL)
Should you wish to help out with some of the items on the TODO list, or find
bugs in the project files that need correcting, and would like to submit
updated files back then please note that, whilst the solution files can be
edited directly, the templates for the project files (which are stored in the
git repository) need to be modified rather than the generated project files
that Visual Studio uses.
## Legacy Windows and SSL
Some of the project configurations use Schannel (Windows SSPI), the native SSL
library that comes with the Windows OS. Schannel in Windows 8 and earlier is
not able to connect to servers that no longer support the legacy handshakes
and algorithms used by those versions. If you are using curl in one of those
earlier versions of Windows you should choose another SSL backend like
OpenSSL.

View File

@@ -0,0 +1,338 @@
@echo off
rem ***************************************************************************
rem * _ _ ____ _
rem * Project ___| | | | _ \| |
rem * / __| | | | |_) | |
rem * | (__| |_| | _ <| |___
rem * \___|\___/|_| \_\_____|
rem *
rem * Copyright (C) Steve Holme, <steve_holme@hotmail.com>.
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
rem * are also available at https://curl.se/docs/copyright.html.
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.
rem *
rem * SPDX-License-Identifier: curl
rem *
rem ***************************************************************************
:begin
rem Check we are running on a Windows NT derived OS
if not "%OS%" == "Windows_NT" goto nodos
rem Set our variables
setlocal ENABLEEXTENSIONS
set VERSION=ALL
set MODE=GENERATE
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
rem Check we are running from a curl git repository
if not exist ..\GIT-INFO.md goto norepo
:parseArgs
if "%~1" == "" goto start
if /i "%~1" == "pre" (
set VERSION=PRE
) else if /i "%~1" == "vc10" (
set VERSION=VC10
) else if /i "%~1" == "vc11" (
set VERSION=VC11
) else if /i "%~1" == "vc12" (
set VERSION=VC12
) else if /i "%~1" == "-clean" (
set MODE=CLEAN
) else if /i "%~1" == "-?" (
goto syntax
) else if /i "%~1" == "/?" (
goto syntax
) else if /i "%~1" == "-h" (
goto syntax
) else if /i "%~1" == "-help" (
goto syntax
) else if /i "%~1" == "--help" (
goto syntax
) else (
goto unknown
)
shift & goto parseArgs
:start
if "%VERSION%" == "PRE" goto success
if "%VERSION%" == "VC10" goto vc10
if "%VERSION%" == "VC11" goto vc11
if "%VERSION%" == "VC12" goto vc12
:vc10
echo.
if "%MODE%" == "GENERATE" (
echo Generating VC10 project files
call :generate vcxproj Windows\VC10\src\curl.tmpl Windows\VC10\src\curl.vcxproj
call :generate vcxproj Windows\VC10\lib\libcurl.tmpl Windows\VC10\lib\libcurl.vcxproj
) else (
echo Removing VC10 project files
call :clean Windows\VC10\src\curl.vcxproj
call :clean Windows\VC10\lib\libcurl.vcxproj
)
if not "%VERSION%" == "ALL" goto success
:vc11
echo.
if "%MODE%" == "GENERATE" (
echo Generating VC11 project files
call :generate vcxproj Windows\VC11\src\curl.tmpl Windows\VC11\src\curl.vcxproj
call :generate vcxproj Windows\VC11\lib\libcurl.tmpl Windows\VC11\lib\libcurl.vcxproj
) else (
echo Removing VC11 project files
call :clean Windows\VC11\src\curl.vcxproj
call :clean Windows\VC11\lib\libcurl.vcxproj
)
if not "%VERSION%" == "ALL" goto success
:vc12
echo.
if "%MODE%" == "GENERATE" (
echo Generating VC12 project files
call :generate vcxproj Windows\VC12\src\curl.tmpl Windows\VC12\src\curl.vcxproj
call :generate vcxproj Windows\VC12\lib\libcurl.tmpl Windows\VC12\lib\libcurl.vcxproj
) else (
echo Removing VC12 project files
call :clean Windows\VC12\src\curl.vcxproj
call :clean Windows\VC12\lib\libcurl.vcxproj
)
goto success
rem Main generate function.
rem
rem %1 - Project Type (vcxproj for VC10, VC11, VC12, VC14, VC14.10, VC14.20 and VC14.30)
rem %2 - Input template file
rem %3 - Output project file
rem
:generate
if not exist %2 (
echo.
echo Error: Cannot open %2
exit /B
)
if exist %3 (
del %3
)
echo * %CD%\%3
for /f "usebackq delims=" %%i in (`"findstr /n ^^ %2"`) do (
set "var=%%i"
setlocal enabledelayedexpansion
set "var=!var:*:=!"
if "!var!" == "CURL_SRC_C_FILES" (
for /f "delims=" %%c in ('dir /b ..\src\*.c') do (
if /i "%%c" NEQ "curlinfo.c" call :element %1 src "%%c" %3
)
) else if "!var!" == "CURL_SRC_H_FILES" (
for /f "delims=" %%h in ('dir /b ..\src\*.h') do call :element %1 src "%%h" %3
) else if "!var!" == "CURL_SRC_RC_FILES" (
for /f "delims=" %%r in ('dir /b ..\src\*.rc') do call :element %1 src "%%r" %3
) else if "!var!" == "CURL_SRC_X_H_FILES" (
call :element %1 lib "config-win32.h" %3
call :element %1 lib "curl_setup.h" %3
) else if "!var!" == "CURL_LIB_C_FILES" (
for /f "delims=" %%c in ('dir /b ..\lib\*.c') do call :element %1 lib "%%c" %3
) else if "!var!" == "CURL_LIB_H_FILES" (
for /f "delims=" %%h in ('dir /b ..\include\curl\*.h') do call :element %1 include\curl "%%h" %3
for /f "delims=" %%h in ('dir /b ..\lib\*.h') do call :element %1 lib "%%h" %3
) else if "!var!" == "CURL_LIB_RC_FILES" (
for /f "delims=" %%r in ('dir /b ..\lib\*.rc') do call :element %1 lib "%%r" %3
) else if "!var!" == "CURL_LIB_CURLX_C_FILES" (
for /f "delims=" %%c in ('dir /b ..\lib\curlx\*.c') do call :element %1 lib\curlx "%%c" %3
) else if "!var!" == "CURL_LIB_CURLX_H_FILES" (
for /f "delims=" %%h in ('dir /b ..\lib\curlx\*.h') do call :element %1 lib\curlx "%%h" %3
) 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
) 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
) else if "!var!" == "CURL_LIB_VTLS_C_FILES" (
for /f "delims=" %%c in ('dir /b ..\lib\vtls\*.c') do call :element %1 lib\vtls "%%c" %3
) else if "!var!" == "CURL_LIB_VTLS_H_FILES" (
for /f "delims=" %%h in ('dir /b ..\lib\vtls\*.h') do call :element %1 lib\vtls "%%h" %3
) else (
echo.!var!>> %3
)
endlocal
)
exit /B
rem Generates a single file xml element.
rem
rem %1 - Project Type (vcxproj for VC10, VC11, VC12, VC14, VC14.10, VC14.20 and VC14.30)
rem %2 - Directory (src, lib, lib\vauth, lib\vquic, lib\vssh, lib\vtls)
rem %3 - Source filename
rem %4 - Output project file
rem
:element
set "SPACES= "
if "%2" == "lib\vauth" (
set "TABS= "
) else if "%2" == "lib\vquic" (
set "TABS= "
) else if "%2" == "lib\vssh" (
set "TABS= "
) else if "%2" == "lib\vtls" (
set "TABS= "
) else if "%2" == "lib\curlx" (
set "TABS= "
) else (
set "TABS= "
)
call :extension %3 ext
if "%1" == "dsp" (
echo # Begin Source File>> %4
echo.>> %4
echo SOURCE=..\..\..\..\%2\%~3>> %4
echo # End Source File>> %4
) else if "%1" == "vcproj1" (
echo %TABS%^<File>> %4
echo %TABS% RelativePath="..\..\..\..\%2\%~3"^>>> %4
echo %TABS%^</File^>>> %4
) else if "%1" == "vcproj2" (
echo %TABS%^<File>> %4
echo %TABS% RelativePath="..\..\..\..\%2\%~3">> %4
echo %TABS%^>>> %4
echo %TABS%^</File^>>> %4
) else if "%1" == "vcxproj" (
if "%ext%" == "c" (
echo %SPACES%^<ClCompile Include=^"..\..\..\..\%2\%~3^" /^>>> %4
) else if "%ext%" == "h" (
echo %SPACES%^<ClInclude Include=^"..\..\..\..\%2\%~3^" /^>>> %4
) else if "%ext%" == "rc" (
echo %SPACES%^<ResourceCompile Include=^"..\..\..\..\%2\%~3^" /^>>> %4
)
)
exit /B
rem Returns the extension for a given filename.
rem
rem %1 - The filename
rem %2 - The return value
rem
:extension
set fname=%~1
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%
exit /B
rem Removes the given project file.
rem
rem %1 - The filename
rem
:clean
echo * %CD%\%1
if exist %1 (
del %1
)
exit /B
:syntax
rem Display the help
echo.
echo Usage: generate [what] [-clean]
echo.
echo What to generate:
echo.
echo pre - Prerequisites only
echo vc10 - Use Visual Studio 2010
echo vc11 - Use Visual Studio 2012
echo vc12 - Use Visual Studio 2013
echo.
echo Only legacy Visual Studio project files can be generated.
echo.
echo To generate recent versions of Visual Studio project files use cmake.
echo Refer to INSTALL-CMAKE.md in the docs directory.
echo.
echo -clean - Removes the project files
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
:nonetdrv
echo.
echo Error: This batch file cannot run from a network drive
goto error
:norepo
echo.
echo Error: This batch file should only be used from a curl git repository
goto error
: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%
:error
if "%OS%" == "Windows_NT" endlocal
exit /B 1
:success
endlocal
exit /B 0