Skip to content

Commit

Permalink
Merge 3a5f915 into 567c7ca
Browse files Browse the repository at this point in the history
  • Loading branch information
Don Goodman-Wilson committed Jun 2, 2016
2 parents 567c7ca + 3a5f915 commit fa22e05
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ _site/

# Vim
.ycm_extra_conf.py*

# Compiled conanfile
conanfile.pyc
15 changes: 14 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,25 @@ cpr_option(USE_SYSTEM_GTEST
cpr_option(CMAKE_USE_OPENSSL "Use OpenSSL code. Experimental" ON)
message(STATUS "=======================================================")

if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/build/conanbuildinfo.cmake) # Building the library with the help of conan (in project dirs)
message(STATUS "Using Conan dependency manager")
include(${CMAKE_CURRENT_SOURCE_DIR}/build/conanbuildinfo.cmake)
conan_basic_setup()
elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/conanbuildinfo.cmake) # Building the conan package (in .conan/data storage)
message(STATUS "Using Conan dependency manager")
include(${CMAKE_CURRENT_SOURCE_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
else()
message("NOT USING CONAN!")
endif()


if(BUILD_CPR_TESTS)
enable_testing()
endif()

add_subdirectory(opt)
add_subdirectory(cpr)
if(BUILD_CPR_TESTS)
if(BUILD_CPR_TESTS)
add_subdirectory(test)
endif()
40 changes: 40 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from conans import ConanFile, CMake
import os


class CPRConan(ConanFile):
name = "cpr"
version = "1.2.0"
url = "https://github.com/whoshuu/cpr.git"
license = "MIT"
requires = "libcurl/7.47.1@lasote/stable"
settings = "os", "compiler", "build_type", "arch"
options = {"insecure_curl": [True, False],
"use_ssl": [True, False]}
default_options = "libcurl:with_ldap=False", "libcurl:shared=False", "insecure_curl=False", "use_ssl=True"
generators = "cmake"
exports = ["*"] # Useful while develop, get the code from the current project directory

def config(self):
if self.options.use_ssl:
self.options["libcurl"].with_openssl = True
else:
self.options["libcurl"].with_openssl = False

def build(self):
if not os.path.exists("./build"):
os.mkdir("./build")
os.chdir("./build")
cmake = CMake(self.settings)
insecure_curl = "-DINSECURE_CURL=ON" if self.options.insecure_curl else ""
self.output.warn("Building in directory: %s" % self.conanfile_directory)
self.run('cmake -DCONAN=ON -DUSE_SYSTEM_CURL=ON -DBUILD_CPR_TESTS=OFF -DGENERATE_COVERAGE=OFF %s "%s" %s' % (insecure_curl, self.conanfile_directory, cmake.command_line))
self.run('cmake --build . %s' % cmake.build_config)

def package(self):
self.copy("*.h", dst="include", src="include")
self.copy("*.lib", dst="lib", src="build/lib")
self.copy("*.a", dst="lib", src="build/lib")

def package_info(self):
self.cpp_info.libs = ["cpr"]

0 comments on commit fa22e05

Please sign in to comment.