Commit 47b497ed authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

uploading working build with relocatable libs



Signed-off-by: Mccaskey, Alex's avatarAlex McCaskey <mccaskeyaj@ornl.gov>
parent 5ad3225e
......@@ -19,6 +19,10 @@ message(STATUS "C++ version ${CXX_STANDARD} configured.")
# Make sure all build libraries have reference to their dependents
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
IF("${isSystemDir}" STREQUAL "-1")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
ENDIF("${isSystemDir}" STREQUAL "-1")
include(ExternalProject)
......@@ -48,6 +52,8 @@ endif()
message(STATUS "${BoldGreen}Installing XACC to ${CMAKE_INSTALL_PREFIX}. Override with -DCMAKE_INSTALL_PREFIX=...${ColorReset}")
enable_testing()
function(add_tests tests test_include_dirs test_libs)
add_tests_with_flags("${tests}" "${test_include_dirs}" "${test_libs}" "")
endfunction()
......@@ -102,21 +108,19 @@ ExternalProject_Add(cppmicroservices
# Install Curl For People
set(USE_SYSTEM_CURL ON CACHE BOOL "" FORCE)
set(BUILD_CPR_TESTS OFF CACHE BOOL "" FORCE)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
add_subdirectory(tpls/cpr)
include_directories(${CPR_INCLUDE_DIRS})
include_directories(${CMAKE_INSTALL_PREFIX}/include/cppmicroservices3)
include_directories(${CMAKE_INSTALL_PREFIX}/include/boost)
include_directories(${XACC_ROOT}/tpls/spdlog)
include_directories(${XACC_ROOT}/tpls/eigen)
set(CppMicroServices_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include/cppmicroservices3)
set(CppMicroServices_LIBRARY_DIR ${CMAKE_INSTALL_PREFIX}/lib)
include_directories(${CMAKE_SOURCE_DIR}/tpls/spdlog)
include_directories(${CMAKE_SOURCE_DIR}/tpls/eigen)
set(CppRSDK_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include)
set(CppRSDK_LIBRARY_DIR ${CMAKE_INSTALL_PREFIX}/lib)
link_directories(${CMAKE_INSTALL_PREFIX}/lib)
ExternalProject_Add(boost
DEPENDS cppmicroservices cpr
URL https://downloads.sourceforge.net/project/boost/boost/1.61.0/boost_1_61_0.tar.gz
UPDATE_COMMAND ./bootstrap.sh --prefix=${CMAKE_INSTALL_PREFIX} --without-libraries=python,mpi,atomic,container,context,coroutine,coroutine2,date_time,exception,iostreams,locale,log,math,metaparse,random,serialization,signals,thread,type_erasure,wave
CONFIGURE_COMMAND ""
......@@ -132,6 +136,8 @@ ExternalProject_Add(boost
set(BOOST_ROOT ${CMAKE_INSTALL_PREFIX})
add_subdirectory(xacc)
add_subdirectory(quantum)
add_subdirectory(python)
#ExternalProject_Add(xacc-core
# DEPENDS cppmicroservices restclient-cpp boost
......
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
project(xacc-python LANGUAGES CXX)
set(CMAKE_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 11)
message(STATUS "C++ version ${CXX_STANDARD} configured.")
find_package(PythonLibs REQUIRED)
# Make sure all build libraries have reference to their dependents
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CppMicroServices_DIR "${CPPUS_LIBRARY_DIR}/../share/cppmicroservices3/cmake")
set(CppMicroServices_DIR "${CMAKE_INSTALL_PREFIX}/share/cppmicroservices3/cmake")
# Modify our CMAKE_MODULE_PATH
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${XACC_ROOT}/cmake/Modules")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CppMicroServices_DIR}")
include(tests)
include(CppMicroServicesConfig)
include(tests)
include(CppMicroServicesConfig)
find_package(Boost COMPONENTS system program_options filesystem chrono REQUIRED)
set(BOOST_ROOT ${CMAKE_INSTALL_PREFIX})
find_package(Boost COMPONENTS system program_options filesystem chrono regex graph REQUIRED)
include_directories(${CMAKE_SOURCE_DIR}/xacc)
include_directories(${CMAKE_SOURCE_DIR}/quantum/gate)
include_directories(${CMAKE_SOURCE_DIR}/quantum/aqc)
include_directories(${CMAKE_INSTALL_PREFIX}/include)
include_directories(${CMAKE_BINARY_DIR})
include_directories(${CMAKE_SOURCE_DIR}/xacc)
include_directories(${CMAKE_SOURCE_DIR}/xacc/ir)
include_directories(${CMAKE_SOURCE_DIR}/xacc/compiler)
include_directories(${CMAKE_SOURCE_DIR}/xacc/program)
include_directories(${CMAKE_SOURCE_DIR}/xacc/accelerator)
include_directories(${CMAKE_SOURCE_DIR}/xacc/utils)
include_directories(${CMAKE_SOURCE_DIR}/tpls/rapidjson/include)
include_directories(${CMAKE_SOURCE_DIR}/tpls/exprtk)
include_directories(${CMAKE_SOURCE_DIR}/tpls/spdlog)
include_directories(${CMAKE_SOURCE_DIR}/tpls/eigen)
include_directories(${XACC_INCLUDE_DIR}/xacc)
include_directories(${XACC_INCLUDE_DIR}/quantum/gate)
include_directories(${XACC_INCLUDE_DIR}/quantum/aqc)
include_directories(${CPPUS_INCLUDE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/quantum/gate/ir)
include_directories(${CMAKE_SOURCE_DIR}/quantum/gate/ir/instructions)
include_directories(${CMAKE_SOURCE_DIR}/quantum/gate/utils)
include_directories(${Boost_INCLUDE_DIRS})
include_directories(${XACC_ROOT}/tpls/rapidjson/include)
include_directories(${XACC_ROOT}/tpls/eigen)
include_directories(${XACC_ROOT}/tpls/exprtk)
include_directories(${XACC_ROOT}/tpls/pybind11/include)
include_directories(${XACC_ROOT}/tpls/spdlog)
include_directories(${XACC_PYTHON_INCLUDE_DIR})
link_directories(${XACC_LIBRARY_DIR})
link_directories(${CMAKE_INSTALL_PREFIX}/lib)
include_directories(${PYTHON_INCLUDE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/tpls/pybind11/include)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing -O2 -g -pipe -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wformat -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv")
if(APPLE)
......@@ -41,26 +42,22 @@ if(APPLE)
endif(APPLE)
add_library(pyxacc SHARED xacc-py.cpp)
set_target_properties(pyxacc PROPERTIES PREFIX "")
link_directories(${CPPUS_LIBRARY_DIR})
link_directories(${Boost_LIBRARY_DIR})
#find_library(cppus_has_d_suffix CppMicroServicesd)
#if (NOT cppus_has_d_suffix)
# set(CppUsLib CppMicroServices)
#endif()
target_link_libraries(pyxacc xacc xacc-quantum-gate xacc-quantum-aqc CppMicroServices ${Boost_LIBRARIES} restclient-cpp) #cpprest ${OPENSSL_LIBRARIES})
add_dependencies(pyxacc xacc xacc-quantum-gate xacc-quantum-aqc)
if (APPLE)
add_custom_command(TARGET pyxacc
POST_BUILD COMMAND
${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_INSTALL_PREFIX}/lib/librestclient-cpp.1.dylib" "@rpath/librestclient-cpp.1.dylib" $<TARGET_FILE:pyxacc>)
set_target_properties(pyxacc PROPERTIES PREFIX "")
set(CppUsLib CppMicroServicesd)
find_library(cppus_has_d_suffix CppMicroServicesd)
if (NOT cppus_has_d_suffix)
set(CppUsLib CppMicroServices)
endif()
target_link_libraries(pyxacc ${CppUsLib} xacc xacc-quantum-gate ${Boost_LIBRARIES} cpr) #xacc xacc-quantum-gate xacc-quantum-aqc CppMicroServices ${Boost_LIBRARIES} restclient-cpp) #cpprest ${OPENSSL_LIBRARIES})
if(APPLE)
set_target_properties(pyxacc PROPERTIES INSTALL_RPATH "@loader_path/lib")
set_target_properties(pyxacc PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
else()
set_target_properties(pyxacc PROPERTIES INSTALL_RPATH "$ORIGIN/lib;$ORIGIN/plugins")
set_target_properties(pyxacc PROPERTIES INSTALL_RPATH "$ORIGIN/lib")
set_target_properties(pyxacc PROPERTIES LINK_FLAGS "-shared")
endif()
......
......@@ -10,43 +10,26 @@
# Contributors:
# Alexander J. McCaskey - initial API and implementation
# *******************************************************************************/
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
project(xacc-quantum LANGUAGES CXX)
set(CMAKE_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 11)
message(STATUS "C++ version ${CXX_STANDARD} configured.")
# Make sure all build libraries have reference to their dependents
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CppMicroServices_DIR "${CPPUS_LIBRARY_DIR}/../share/cppmicroservices3/cmake")
# Modify our CMAKE_MODULE_PATH
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${XACC_ROOT}/cmake/Modules")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CppMicroServices_DIR}")
include(tests)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_INSTALL_PREFIX}/share/cppmicroservices3/cmake")
include(CppMicroServicesConfig)
# We require Boost without MPI
find_package(Boost COMPONENTS system program_options filesystem chrono regex REQUIRED)
#endif()
set(BOOST_ROOT ${CMAKE_INSTALL_PREFIX})
find_package(Boost COMPONENTS system program_options regex filesystem chrono graph REQUIRED)
include_directories(${XACC_INCLUDE_DIR})
include_directories(${XACC_ROOT}/tpls/rapidjson/include)
include_directories(${XACC_ROOT}/tpls/exprtk)
include_directories(${Boost_INCLUDE_DIRS})
include_directories(${XACC_ROOT}/tpls/spdlog)
include_directories(${XACC_ROOT}/tpls/eigen)
include_directories(${CPPUS_INCLUDE_DIR})
include_directories(${CMAKE_INSTALL_PREFIX}/include)
include_directories(${CMAKE_BINARY_DIR})
link_directories(${XACC_LIBRARY_DIR})
link_directories(${CPPUS_LIBRARY_DIR})
#include_directories(${OPENSSL_INCLUDE_DIR})
#include_directories(${CppRSDK_INCLUDE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/xacc)
include_directories(${CMAKE_SOURCE_DIR}/xacc/ir)
include_directories(${CMAKE_SOURCE_DIR}/xacc/compiler)
include_directories(${CMAKE_SOURCE_DIR}/xacc/program)
include_directories(${CMAKE_SOURCE_DIR}/xacc/accelerator)
include_directories(${CMAKE_SOURCE_DIR}/xacc/utils)
include_directories(${CMAKE_SOURCE_DIR}/tpls/rapidjson/include)
include_directories(${CMAKE_SOURCE_DIR}/tpls/exprtk)
include_directories(${CMAKE_SOURCE_DIR}/tpls/spdlog)
include_directories(${CMAKE_SOURCE_DIR}/tpls/eigen)
link_directories(${CMAKE_INSTALL_PREFIX}/lib)
add_subdirectory(gate)
add_subdirectory(aqc)
......@@ -10,9 +10,6 @@
# Contributors:
# Alexander J. McCaskey - initial API and implementation
# *******************************************************************************/
set (PACKAGE_NAME "XACC Adiabatic Quantum Computing and Quantum Annealing Runtime")
set (PACKAGE_DESCIPTION "Runtime library for aqc and qa")
set (LIBRARY_NAME xacc-quantum-aqc)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ir)
......@@ -30,6 +27,7 @@ usFunctionGenerateBundleInit(TARGET ${LIBRARY_NAME} OUT SRC)
#----
add_library(${LIBRARY_NAME} SHARED ${SRC})
add_dependencies(${LIBRARY_NAME} xacc)
set(_bundle_name xacc_quantum_aqc)
set_target_properties(${LIBRARY_NAME} PROPERTIES
......@@ -60,12 +58,14 @@ find_library(cppus_has_d_suffix CppMicroServicesd)
if (NOT cppus_has_d_suffix)
set(CppUsLib CppMicroServices)
endif()
target_link_libraries(${LIBRARY_NAME} ${Boost_LIBRARIES} ${CppUsLib} xacc restclient-cpp) #cpprest ${OPENSSL_LIBRARIES})
#target_link_libraries(${LIBRARY_NAME} ${CppUsLib}) #${Boost_LIBRARIES} ${CppUsLib} xacc restclient-cpp) #cpprest ${OPENSSL_LIBRARIES})
if (APPLE)
add_custom_command(TARGET xacc-quantum-aqc
POST_BUILD COMMAND
${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_INSTALL_PREFIX}/lib/librestclient-cpp.1.dylib" "@rpath/librestclient-cpp.1.dylib" $<TARGET_FILE:xacc-quantum-aqc>)
if(APPLE)
set_target_properties(xacc-quantum-aqc PROPERTIES INSTALL_RPATH "@loader_path")
set_target_properties(xacc-quantum-aqc PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
else()
set_target_properties(xacc-quantum-aqc PROPERTIES INSTALL_RPATH "$ORIGIN")
set_target_properties(xacc-quantum-aqc PROPERTIES LINK_FLAGS "-shared")
endif()
add_subdirectory(ir)
......
......@@ -12,5 +12,4 @@
# *******************************************************************************/
# Gather tests
file (GLOB test_files tests/*.cpp)
add_tests("${test_files}" "${CMAKE_CURRENT_SOURCE_DIR}" "${LIBRARY_NAME};${Boost_LIBRARIES};dl;pthread;xacc-quantum-aqc;xacc;restclient-cpp")#rest;${OPENSSL_LIBRARIES}")
add_tests("${test_files}" "${CMAKE_CURRENT_SOURCE_DIR}" "${LIBRARY_NAME};${Boost_LIBRARIES};dl;pthread;xacc-quantum-aqc;xacc;${CppUsLib};cpr")
......@@ -12,5 +12,4 @@
# *******************************************************************************/
# Gather tests
file (GLOB test_files tests/*.cpp)
add_tests("${test_files}" "${CMAKE_CURRENT_SOURCE_DIR}" "${Boost_LIBRARIES};xacc;restclient-cpp")#rest;${OPENSSL_LIBRARIES}")
add_tests("${test_files}" "${CMAKE_CURRENT_SOURCE_DIR}" "${Boost_LIBRARIES};xacc;xacc-quantum-aqc;${CppUsLib};cpr")
......@@ -10,9 +10,6 @@
# Contributors:
# Alexander J. McCaskey - initial API and implementation
# *******************************************************************************/
set (PACKAGE_NAME "XACC Gate Model Quantum Computing Runtime")
set (PACKAGE_DESCIPTION "Runtime library for gate model quantum computing")
set (LIBRARY_NAME xacc-quantum-gate)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/utils)
......@@ -32,6 +29,7 @@ usFunctionGetResourceSource(TARGET ${LIBRARY_NAME} OUT SRC)
usFunctionGenerateBundleInit(TARGET ${LIBRARY_NAME} OUT SRC)
add_library(${LIBRARY_NAME} SHARED ${SRC})
add_dependencies(${LIBRARY_NAME} xacc)
set(_bundle_name xacc_quantum_gate)
set_target_properties(${LIBRARY_NAME} PROPERTIES
......@@ -56,20 +54,21 @@ usFunctionEmbedResources(TARGET ${LIBRARY_NAME}
manifest.json
)
link_directories(${Boost_LIBRARY_DIR})
set(CppUsLib CppMicroServicesd)
link_directories(${CPPUS_LIBRARY_DIR})
find_library(cppus_has_d_suffix CppMicroServicesd)
if (NOT cppus_has_d_suffix)
set(CppUsLib CppMicroServices)
endif()
target_link_libraries(${LIBRARY_NAME} ${Boost_LIBRARIES} xacc ${CppUsLib} restclient-cpp) #cpprest ${OPENSSL_LIBRARIES})
if (APPLE)
add_custom_command(TARGET xacc-quantum-gate
POST_BUILD COMMAND
${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_INSTALL_PREFIX}/lib/librestclient-cpp.1.dylib" "@rpath/librestclient-cpp.1.dylib" $<TARGET_FILE:xacc-quantum-gate>)
#target_link_libraries(${LIBRARY_NAME} ${CppUsLib}) #${Boost_LIBRARIES} xacc ${CppUsLib} restclient-cpp) #cpprest ${OPENSSL_LIBRARIES})
if(APPLE)
set_target_properties(xacc-quantum-gate PROPERTIES INSTALL_RPATH "@loader_path")
set_target_properties(xacc-quantum-gate PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
else()
set_target_properties(xacc-quantum-gate PROPERTIES INSTALL_RPATH "$ORIGIN")
set_target_properties(xacc-quantum-gate PROPERTIES LINK_FLAGS "-shared")
endif()
add_subdirectory(compiler)
......
......@@ -12,5 +12,4 @@
# *******************************************************************************/
# Gather tests
file (GLOB test_files tests/*.cpp)
add_tests("${test_files}" "${CMAKE_CURRENT_SOURCE_DIR}" "${Boost_LIBRARIES};xacc-quantum-gate;xacc;restclient-cpp")#rest;${OPENSSL_LIBRARIES}")
add_tests("${test_files}" "${CMAKE_CURRENT_SOURCE_DIR}" "${Boost_LIBRARIES};xacc-quantum-gate;xacc;${CppUsLib};cpr")
......@@ -13,5 +13,4 @@
# Gather tests
file (GLOB test_files tests/*.cpp)
add_tests("${test_files}" "${CMAKE_CURRENT_SOURCE_DIR}" "${LIBRARY_NAME};${Boost_LIBRARIES};xacc;xacc-quantum-gate;restclient-cpp")#rest;${OPENSSL_LIBRARIES}")
add_tests("${test_files}" "${CMAKE_CURRENT_SOURCE_DIR}" "${LIBRARY_NAME};${Boost_LIBRARIES};xacc;xacc-quantum-gate;${CppUsLib};cpr")
......@@ -14,6 +14,5 @@ include_directories(${CMAKE_SOURCE_DIR}/tpls/eigen)
# Gather tests
file (GLOB test_files tests/*.cpp)
add_tests("${test_files}" "${CMAKE_CURRENT_SOURCE_DIR}" "${Boost_LIBRARIES};xacc;xacc-quantum-gate;restclient-cpp")#rest;${OPENSSL_LIBRARIES}")
add_tests("${test_files}" "${CMAKE_CURRENT_SOURCE_DIR}" "${Boost_LIBRARIES};xacc;xacc-quantum-gate;${CppUsLib};cpr")
......@@ -23,12 +23,12 @@ configure_file("${CMAKE_SOURCE_DIR}/cmake/xacc_config.hpp.in" "${CMAKE_BINARY_DI
install(FILES "${CMAKE_BINARY_DIR}/xacc_config.hpp" DESTINATION include/xacc)
include_directories(${CMAKE_BINARY_DIR})
include_directories(${CMAKE_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/ir)
include_directories(${CMAKE_SOURCE_DIR}/compiler)
include_directories(${CMAKE_SOURCE_DIR}/program)
include_directories(${CMAKE_SOURCE_DIR}/accelerator)
include_directories(${CMAKE_SOURCE_DIR}/utils)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/ir)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/compiler)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/program)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/accelerator)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/utils)
file (GLOB HEADERS
XACC.hpp
......@@ -63,8 +63,14 @@ endif()
# Get the test files
file(GLOB test_files utils/tests/*Tester.cpp accelerator/tests/*Tester.cpp)
set(CppUsLib CppMicroServicesd)
find_library(cppus_has_d_suffix CppMicroServicesd)
if (NOT cppus_has_d_suffix)
set(CppUsLib CppMicroServices)
endif()
# Add the tests
add_tests("${test_files}" "${CMAKE_CURRENT_SOURCE_DIR}/utils" "${Boost_LIBRARIES};xacc")
add_tests("${test_files}" "${CMAKE_CURRENT_SOURCE_DIR}/utils" "${Boost_LIBRARIES};xacc;${CppUsLib};boost_program_options;boost_unit_test_framework;boost_system;cpr;boost_filesystem;boost_graph")
install(FILES ${HEADERS} DESTINATION include/xacc)
install(TARGETS ${LIBRARY_NAME} DESTINATION lib)
install(TARGETS xacc DESTINATION lib)
......@@ -12,38 +12,50 @@
*******************************************************************************/
#include "RemoteAccelerator.hpp"
#include <cpr/cpr.h>
namespace xacc {
const std::string Client::post(const std::string& remoteUrl,
const std::string& path, const std::string& postStr,
std::map<std::string, std::string> headers) {
using namespace RestClient;
init();
Connection* conn = new Connection(remoteUrl);
HeaderFields _headers;
if (headers.empty()) {
headers.insert(std::make_pair("Content-type", "application/json"));
headers.insert(std::make_pair("Connection", "keep-alive"));
headers.insert(std::make_pair("Accept", "*/*"));
}
cpr::Header cprHeaders;
for (auto& kv : headers) {
_headers[kv.first] = kv.second;
cprHeaders.insert({kv.first, kv.second});
}
conn->SetHeaders(headers);
Response r = conn->post(path, postStr);
if (r.code != 200) throw std::runtime_error("HTTP POST Error");
delete conn;
disable();
return r.body;
auto r = cpr::Post(cpr::Url{remoteUrl+"/"+path}, cpr::Body(postStr), cprHeaders);
if (r.status_code != 200) throw std::runtime_error("HTTP POST Error");
return r.text;
}
const std::string Client::get(const std::string& remoteUrl,
const std::string& path, std::map<std::string, std::string> headers) {
if (headers.empty()) {
headers.insert(std::make_pair("Content-type", "application/json"));
headers.insert(std::make_pair("Connection", "keep-alive"));
headers.insert(std::make_pair("Accept", "*/*"));
}
cpr::Header cprHeaders;
for (auto& kv : headers) {
cprHeaders.insert({kv.first, kv.second});
}
auto r = cpr::Get(cpr::Url{remoteUrl+"/"+path}, cprHeaders);
if (r.status_code != 200) throw std::runtime_error("HTTP POST Error");
using namespace RestClient;
Response r = RestClient::get(remoteUrl+path);
if (r.code != 200) throw std::runtime_error("HTTP GET Error");
return r.body;
return r.text;
}
void RemoteAccelerator::execute(std::shared_ptr<AcceleratorBuffer> buffer,
......
......@@ -15,8 +15,6 @@
#include "Accelerator.hpp"
#include "XACC.hpp"
#include "restclient-cpp/connection.h"
#include "restclient-cpp/restclient.h"
namespace xacc {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment