Skip to content

Commit

Permalink
Merge branch 'release/v0.8.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
jpbarrette committed Mar 7, 2017
2 parents 471a69c + 8611ca9 commit 592552a
Show file tree
Hide file tree
Showing 10 changed files with 162 additions and 322 deletions.
91 changes: 47 additions & 44 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,44 +1,47 @@
*.Po
*.o
*.a
*.la
*.lo
*.Plo
*.dylib
*.lai
Makefile
*~

build/
m4/
CMakeFiles/

examples/example01
examples/example02
examples/example03
examples/example04
examples/example05
examples/example06
examples/example07
examples/example08
examples/example09
examples/example10
examples/example11
examples/example12
examples/example13
examples/example14
examples/example15
examples/example16
examples/example17
examples/example18
examples/example19
examples/example20
examples/example21
examples/example22
examples/example23
examples/example24
examples/example25

*.exe
CMakeCache.txt

*.Po
*.o
*.a
*.la
*.lo
*.Plo
*.dylib
*.lai
Makefile
*~

build/
m4/
CMakeFiles/

examples/example01
examples/example02
examples/example03
examples/example04
examples/example05
examples/example06
examples/example07
examples/example08
examples/example09
examples/example10
examples/example11
examples/example12
examples/example13
examples/example14
examples/example15
examples/example16
examples/example17
examples/example18
examples/example19
examples/example20
examples/example21
examples/example22
examples/example23
examples/example24
examples/example25

*.exe
CMakeCache.txt

conanbuildinfo.cmake
conaninfo.txt
bin/
136 changes: 73 additions & 63 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,61 +1,54 @@
project(curlpp)

if(WIN32)
# cmake 3.4 is required for CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS
cmake_minimum_required(VERSION 3.4)
else()
cmake_minimum_required(VERSION 3.0)
endif()

set(CMAKE_CXX_STANDARD 11) # C++11...
set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11

set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin")
set(CURLPP_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(CURLPP_BINARY_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})

# In response to CMake 3.0 generating warnings regarding policy CMP0042,
# the OSX RPATH settings have been updated per recommendations found
# in the CMake Wiki:
# http://www.cmake.org/Wiki/CMake_RPATH_handling#Mac_OS_X_and_the_RPATH
if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW) # MACOSX_RPATH
set(CMAKE_MACOSX_RPATH TRUE)
endif()

#########################################################################################
# Root folders
set(ProjectRootDir ${${PROJECT_NAME}_SOURCE_DIR}/)
message(STATUS "\tUsing Sources From: ${ProjectRootDir}")
# for unix platform, define install directories.
include(GNUInstallDirs)

set(ProjectBinaryDir ${${PROJECT_NAME}_BINARY_DIR}/)
message(STATUS "\tPutting all major output in: ${ProjectBinaryDir}")
if(WIN32)
# cmake 3.4 is required for CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS
cmake_minimum_required(VERSION 3.4)

# Source Subfolders
set(SrcFolder ${ProjectRootDir}src/)
message(STATUS "\tInputs of type .cpp at: ${SrcFolder}")
# c++ 11 support from cmake 3.4 or newer
set(CMAKE_CXX_STANDARD 11) # C++11...
set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11

set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
else()
if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_LESS 3.1)
cmake_minimum_required(VERSION 2.8)
# c++11 support for cmake 2.8.12 - 3.0.x
#
# for non-windows platform we try to keep cmake 2.8 support
# since entreprise distribution tends to have 2.8 version.
add_compile_options(-std=c++11)
else()
# c++ 11 support from cmake 3.1 or newer
set(CMAKE_CXX_STANDARD 11) # C++11...
set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11
endif()
endif()

set(IncludeFolder ${ProjectRootDir}include/)
message(STATUS "\tInputs of type .h and .hpp at: ${IncludeFolder}")

set(ExamplesFolder ${ProjectRootDir}examples/)
message(STATUS "\tInputs to be built as standalone examples are at: ${ExamplesFolder}")
# Conan.io integration
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/conanbuildinfo.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
endif()

# extra (pkg-config-related files)
add_subdirectory(extras)

#########################################################################################
# For more verbose displays
function(DisplayList Header ListToShow)
message(STATUS "\t${Header}")
foreach(ListItem ${ListToShow})
message(STATUS "\t\t${ListItem}")
endforeach(ListItem ${ListToShow})
endfunction(DisplayList)

#########################################################################################
# File Lists
file(GLOB_RECURSE HeaderFileList "${IncludeFolder}*")
install(DIRECTORY include/utilspp/ DESTINATION "include/utilspp")
install(DIRECTORY include/curlpp/ DESTINATION "include/curlpp")
DisplayList("Using Header Files:" "${HeaderFileList}")

file(GLOB_RECURSE SourceFileList "${SrcFolder}*")
DisplayList("Using Source Files:" "${SourceFileList}")

#########################################################################################
# Look for dependencies

Expand All @@ -64,40 +57,57 @@ DisplayList("Using Source Files:" "${SourceFileList}")

message(STATUS "Looking for CURL")
include(FindCURL)
cmake_minimum_required(VERSION 3.0)
find_package(CURL REQUIRED)

if(${CURL_FOUND})
if(CURL_FOUND)
message(STATUS "Found CURL version: ${CURL_VERSION_STRING}")
message(STATUS "Using CURL include dir(s): ${CURL_INCLUDE_DIRS}")
message(STATUS "Using CURL lib(s): ${CURL_LIBRARIES}")
else(${CURL_FOUND})
else()
message(FATAL_ERROR "Could not find CURL")
endif(${CURL_FOUND})
endif()

# All following targets should search these directories for headers
include_directories(
${IncludeFolder}
${CMAKE_CURRENT_SOURCE_DIR}/include
${CURL_INCLUDE_DIRS}
)

#########################################################################################
# Connect all the found parts
# Define Targets

# Define main library
message(STATUS
"Defining the shared library for ${PROJECT_NAME} including "
"all source and header files not in examples."
)
# If building on windows, install path will be in build/winbuild
if(CMAKE_SYSTEM MATCHES "Windows")
set(CMAKE_INSTALL_PREFIX "winbuild")
endif()

file(GLOB_RECURSE HeaderFileList "${CMAKE_CURRENT_SOURCE_DIR}/include/*")
file(GLOB_RECURSE SourceFileList "${CMAKE_CURRENT_SOURCE_DIR}/src/*")
add_library(${PROJECT_NAME} SHARED ${HeaderFileList} ${SourceFileList})
target_link_libraries(${PROJECT_NAME} ${CURL_LIBRARIES})
target_link_libraries(${PROJECT_NAME} ${CURL_LIBRARIES} ${CONAN_LIBS})
set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION 1 VERSION 1.0.0)

add_library(${PROJECT_NAME}_static STATIC ${HeaderFileList} ${SourceFileList})
target_link_libraries(${PROJECT_NAME}_static ${CURL_LIBRARIES})

# Make sure that on unix-platforms shared and static libraries have
# the same root name, but different suffixes.
#
# (solution taken from https://cmake.org/Wiki/CMake_FAQ#How_do_I_make_my_shared_and_static_libraries_have_the_same_root_name.2C_but_different_suffixes.3F)
#
# Making shared and static libraries have the same root name, but different suffixes
SET_TARGET_PROPERTIES(${PROJECT_NAME}_static PROPERTIES OUTPUT_NAME ${PROJECT_NAME})
# Now the library target "curlpp_static" will be named "curlpp.lib" with MS tools.
# This conflicts with the "curlpp.lib" import library corresponding to "curlpp.dll",
# so we add a "lib" prefix (which is default on other platforms anyway):
SET_TARGET_PROPERTIES(${PROJECT_NAME}_static PROPERTIES PREFIX "lib")
target_link_libraries(${PROJECT_NAME}_static ${CURL_LIBRARIES} ${CONAN_LIBS})

# install headers
install(DIRECTORY include/utilspp/ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/utilspp")
install(DIRECTORY include/curlpp/ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/curlpp")

install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_static
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/static)
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

61 changes: 5 additions & 56 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Beerpay](https://beerpay.io/jpbarrette/curlpp/badge.svg?style=beer-square)](https://beerpay.io/jpbarrette/curlpp) [![Beerpay](https://beerpay.io/jpbarrette/curlpp/make-wish.svg?style=flat-square)](https://beerpay.io/jpbarrette/curlpp?focus=wish) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Travis CI](https://img.shields.io/travis/jpbarrette/curlpp.svg)](https://travis-ci.org/jpbarrette/curlpp)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Travis CI](https://img.shields.io/travis/jpbarrette/curlpp.svg)](https://travis-ci.org/jpbarrette/curlpp) [![AppVeyor CI](https://img.shields.io/appveyor/ci/jpbarrette/curlpp.svg)](https://ci.appveyor.com/project/jpbarrette/curlpp)

# Description

Expand All @@ -24,62 +24,11 @@ First, I need to quote Daniel Stenberg, the maintener of libcURL:
* It is exception safe.
* It is type safe.

# Documentation

The programming guide for the 0.5.x and newer versions is [here](https://github.com/jpbarrette/curlpp/tree/master/doc/guide.pdf). This guide is greatly inspired by the libcURL guide, that I strongly suggest to read. There's also some examples in the "[examples](http://github.com/jpbarrette/curlpp/tree/master/examples)/" source directory of cURLpp.

# Development history

## The original code (versions up to 0.3x)

This project was branched over the project began by Eric Lavigne. It's no longer active.

## The refactor over the original code (0.5.x and newer)

This version is a complete re-factorization of cURLpp against 0.3.x and older versions. This re-factorization was made for the following reasons:

* cURLpp was difficult to maintain.
* cURLpp wasn't flexible.

Those two points are in fact related. cURLpp was difficult to maintain because each libcURL's option change needed a change in cURLpp; the design didn't allow those changes to be automatically taken in charge. Because I don't monitor libcURL project carefully, those changes were only applied 2-3 months after the release. It wasn't flexible because it didn't allowed the user to change cURLpp's behavior without risking to break previously made applications.

But in fact, the real problem is that I DO read feature requests, but do not necessarily program them (You can send your complains to my university/job/girlfriend). So, this design is, in fact, "Ze" one that is compatible with my laziness.

Seriously, here's the advantages of this new design:

* Allow you to change cURLpp's C++ wrapping behavior, without requiring its recompilation.
* Allow you to retrieve the option values already set on the handle.
* For more details, see the guide. Note that, as you probably deduced, this version is NOT compatible against 0.3.x and older versions.
# Download

## Development Plans
Latest version is available on GitHub [here](https://github.com/jpbarrette/curlpp/releases/latest).

So, what's next? I have some ideas for future releases. If you want to suggest some feature, don't be shy and send me an email.

### Version 0.6.0 (Out)

Exception safe feature. What's exactly the matter? Isn't supposed to be already exception safe? Well, the problem is when you work with C++ callbacks that are called within C code. What will happen if the callback throw an exception? The exception will go through the C code. This will completely break the C code. So, you need to be sure that it's impossible that an exception is thrown, without being handled in your callback. So, I want to add some code that will handle any exception thrown and rethrow it in the C++ code, meaning in the cURLpp::Easy::perform function. Then, you'll be able to throw exceptions, without being scared to break libcURL's execution.

Functors. At this time we use plain functions as callbacks. However, if you want to use a member function, you need to create a function that will cast your data (that you previously set on the handle), and then call your member function. I want to use functors instead. If you don't know what are functors, check this.

### Version 0.7.0 (Out)

Multi interface. We need to add the Multi interface. Here's the description from libcURL's documentation:
The multi interface is the asynchronous brother in the family and it also offers multiple transfers using a single thread and more. The multi interface introduces several new abilities that the easy interface refuses to offer. They are mainly:

* Enable a "pull" interface. The application that uses libcurl decides where and when to ask libcurl to get/send data.
* Enable multiple simultaneous transfers in the same thread without making it complicated for the application.
* Enable the application to select() on its own file descriptors and curl's file descriptors simultaneous easily.

### Version 0.8.0

Share interface. Right now, we don't provide any wrapping for the Share interface. Mostly, this wrapping will depend on the functor feature. This is the description from the libcURL documentation: The share interface was added to enable sharing of data between curl "handles". You can have multiple easy handles share data between them. Have them update and use the same cookie database or DNS cache! This way, each single transfer will take advantage from data updates made by the other transfer(s).

# Compilers

cURLpp is meant to be portable, but I can't maintain, all by myself, a project file for every platform that exists. Here's the environnements that I maintain, or will maintain personally:
# Documentation

* Max OS X/GCC 2.95/GCC 3.x/GCC 4.x
* Linux/GCC 2.95/GCC 3.x/GCC 4.x
* Cygwin/GCC 2.95/GCC 3.x/GCC 4.x
* I know there's some people who wants a VC++ project file. I don't want to maintain those VC++ files. I don't want to because I don't have any licence of VC++ and I don't want to buy one. The only way I will make available some Win32 binaries(DLL), is with MinGW. However, if someone is willing to maintain thoses files, it will be my pleasure to make them available.
The programming guide is [here](https://github.com/jpbarrette/curlpp/tree/master/doc/guide.pdf). This guide is greatly inspired by the libcURL guide, that I strongly suggest to read. There's also some examples in the "[examples](http://github.com/jpbarrette/curlpp/tree/master/examples)/" source directory of cURLpp.

20 changes: 16 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,39 @@ environment:
- PRJ_GEN: "Visual Studio 11 2012 Win64"
BDIR: msvc2012
PRJ_CFG: Release
PRJ_GEN_VERSION: 11
- PRJ_GEN: "Visual Studio 12 2013 Win64"
BDIR: msvc2013
PRJ_CFG: Release
PRJ_GEN_VERSION: 12
- PRJ_GEN: "Visual Studio 14 2015 Win64"
BDIR: msvc2015
PRJ_CFG: Release
PRJ_GEN_VERSION: 14
- PRJ_GEN: "Visual Studio 11 2012 Win64"
BDIR: msvc2012
PRJ_CFG: Release
PRJ_CFG: Debug
PRJ_GEN_VERSION: 11
- PRJ_GEN: "Visual Studio 12 2013 Win64"
BDIR: msvc2013
PRJ_CFG: Release
PRJ_CFG: Debug
PRJ_GEN_VERSION: 12
- PRJ_GEN: "Visual Studio 14 2015 Win64"
BDIR: msvc2015
PRJ_CFG: Release
PRJ_CFG: Debug
PRJ_GEN_VERSION: 14

install:
- cinst curl
- cmd: echo "Downloading conan..."
- cmd: set PATH=%PATH%;%PYTHON%/Scripts/
- cmd: pip.exe install conan
- cmd: conan user # Create the conan data directory
- cmd: conan --version

build_script:
- mkdir build.%BDIR%
- IF %PRJ_GEN_VERSION% == 11 call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\vsvars32.bat"
- conan install --build=missing -s compiler="Visual Studio" -s compiler.version=%PRJ_GEN_VERSION% -s build_type=%PRJ_CFG% .
- cd build.%BDIR%
- cmake .. -G"%PRJ_GEN%"
- cmake --build . --config %PRJ_CFG% --clean-first
Expand Down
5 changes: 5 additions & 0 deletions conanfile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[requires]
libcurl/7.50.3@lasote/stable

[generators]
cmake
Loading

0 comments on commit 592552a

Please sign in to comment.