Implementing libcurl: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (mmmm saving it)
m (mmmm saving it)
Line 18: Line 18:


Back in the your recently extracted curl folder browse to curl-#.##.#\include and copy the curl folder into your modname\src\libcurl folder.
Back in the your recently extracted curl folder browse to curl-#.##.#\include and copy the curl folder into your modname\src\libcurl folder.
Now include the modname\src\libcurl\curl include files into your client project.


In VS right click your solution, select Add -> Existing Project. Select modname\src\libcurl\libcurl.vcproj.
In VS right click your solution, select Add -> Existing Project. Select modname\src\libcurl\libcurl.vcproj.
Line 29: Line 31:
   CURL_STATICLIB
   CURL_STATICLIB


Go to Configuration Properties -> Linker -> Input, Open "Ignore Specific Library" and add the following to the bottom of the list.
  msvcrt


Open your libcurl projects properties, go to Configuration Properties -> C/C++ -> Code Generation, Change "Runtime Library" to
Multi-threaded (/MT)


Open the properties for your libcurl project.
Go to Configuration Properties -> C/C++ -> Preprocessor, Open "Preprocessor Definitions" and add the following to the bottom of the list.
 
CURL_STATICLIB
Now include the modname\src\libcurl\curl include files into your client project.
HTTP_ONLY
And remove the following from the list.
_USRDLL


You are now ready to build libcurl.


Once its done building navigate to modname\src\libcurl\Release and copy libcurl.lib over to modname\src\lib\public.





Revision as of 18:35, 5 September 2010

What is libcurl?

libcurl is a free and easy-to-use client-side URL transfer library that allows you to transfer files across the internet through various protocols such as HTTP. It is the base of cURL a very popular command line tool for transferring data.

A few examples of the things that you could do by implementing libcurl into your source engine mod would be to set up an in game poll, download game content, upload player data. The possibilities are endless.

The Installation

You will need to download the latest version of cURL. You can do this by visiting the Download page on their website.

Proceed to extract the zip and open your mod folder, and your mods solution in VS.

In your modname\src\ folder create a new folder named libcurl.

Open the curl folder that you just extracted, browse to curl-#.##.#\lib and copy all of the files in there.

Paste them into your new modname\src\libcurl folder.

Back in the your recently extracted curl folder browse to curl-#.##.#\include and copy the curl folder into your modname\src\libcurl folder.

Now include the modname\src\libcurl\curl include files into your client project.

In VS right click your solution, select Add -> Existing Project. Select modname\src\libcurl\libcurl.vcproj.

VS2008 and 2010 only: Run through the conversion wizard.

Open your client projects properties, go to Configuration Properties -> C/C++ -> General, Open "Additional Include Directories" and add the following to the bottom of the list.

..\..\libcurl\curl

Go to Configuration Properties -> C/C++ -> Preprocessor, Open "Preprocessor Definitions" and add the following to the bottom of the list.

 CURL_STATICLIB

Go to Configuration Properties -> Linker -> Input, Open "Ignore Specific Library" and add the following to the bottom of the list.

 msvcrt

Open your libcurl projects properties, go to Configuration Properties -> C/C++ -> Code Generation, Change "Runtime Library" to

Multi-threaded (/MT)

Go to Configuration Properties -> C/C++ -> Preprocessor, Open "Preprocessor Definitions" and add the following to the bottom of the list.

CURL_STATICLIB
HTTP_ONLY

And remove the following from the list.

_USRDLL

You are now ready to build libcurl.

Once its done building navigate to modname\src\libcurl\Release and copy libcurl.lib over to modname\src\lib\public.




The curl license

libcurl is licensed under a MIT/X derivative license

COPYRIGHT AND PERMISSION NOTICE

Copyright (c) 1996 - 2010, Daniel Stenberg, <daniel@haxx.se>.

All rights reserved.

Permission to use, copy, modify, and distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright
notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of a copyright holder shall not
be used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization of the copyright holder.