mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-11 10:22:44 +00:00
[C++][RestSDK] Windows vcpkg vs2017 support (#2751)
* Add boost-uid to vcpkg isntall command. It's required. * Add instructions for building on visual studio 2017 * Add section to support vcpkg and visual studio * Undef U on windows to stop compiler error * Update pet store sample * Move undef U to apiclient-header * Slight change to address compiler warning
This commit is contained in:
@@ -26,7 +26,7 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
|
|||||||
|
|
||||||
Install [cpprestsdk](https://github.com/Microsoft/cpprestsdk).
|
Install [cpprestsdk](https://github.com/Microsoft/cpprestsdk).
|
||||||
|
|
||||||
- Windows: `vcpkg install cpprestsdk cpprestsdk:x64-windows`
|
- Windows: `vcpkg install cpprestsdk cpprestsdk:x64-windows boost-uuid boost-uuid:x64-windows`
|
||||||
- Mac: `brew install cpprestsdk`
|
- Mac: `brew install cpprestsdk`
|
||||||
- Linux: `sudo apt-get install libcpprest-dev`
|
- Linux: `sudo apt-get install libcpprest-dev`
|
||||||
|
|
||||||
@@ -37,6 +37,21 @@ cmake -DCPPREST_ROOT=/usr -DCMAKE_CXX_FLAGS="-I/usr/local/opt/openssl/include" -
|
|||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Build on Windows with Visual Studio (VS2017)
|
||||||
|
|
||||||
|
- Right click on folder containing source code
|
||||||
|
- Select 'Open in visual studio'
|
||||||
|
- Once visual studio opens, CMake should show up in top menu bar.
|
||||||
|
- Select CMake > Build All.
|
||||||
|
|
||||||
|
*Note: If the CMake menu item doesn't show up in Visual Studio, CMake
|
||||||
|
for Visual Studio must be installed. In this case, open the 'Visual Studio
|
||||||
|
Installer' application. Select 'modify' Visual Studio 2017. Make sure
|
||||||
|
'Desktop Development with C++' is installed, and specifically that 'Visual
|
||||||
|
C++ tools for CMake' is selected in the 'Installation Details' section.
|
||||||
|
|
||||||
|
Also be sure to review the CMakeLists.txt file. Edits are likely required.*
|
||||||
|
|
||||||
## Author
|
## Author
|
||||||
|
|
||||||
{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}}
|
{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}}
|
||||||
|
|||||||
@@ -18,6 +18,10 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
#if defined (_WIN32) || defined (_WIN64)
|
||||||
|
#undef U
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <cpprest/details/basic_types.h>
|
#include <cpprest/details/basic_types.h>
|
||||||
#include <cpprest/http_client.h>
|
#include <cpprest/http_client.h>
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,15 @@ set(CPPREST_LIBRARY_DIR ${CPPREST_ROOT}/lib)
|
|||||||
|
|
||||||
include_directories(${PROJECT_SOURCE_DIR} api model ${CPPREST_INCLUDE_DIR})
|
include_directories(${PROJECT_SOURCE_DIR} api model ${CPPREST_INCLUDE_DIR})
|
||||||
|
|
||||||
|
|
||||||
|
# If using vcpkg, set include directories. Also comment out CPPREST section above since vcpkg will handle it.
|
||||||
|
# To install required vcpkg packages execute:
|
||||||
|
# > vcpkg install cpprestsdk cpprestsdk:x64-windows boost-uuid boost-uuid:x64-windows
|
||||||
|
# set(VCPKG_ROOT "C:\\vcpkg\\installed\\x64-windows")
|
||||||
|
# set(VCPKG_INCLUDE_DIR ${VCPKG_ROOT}/include)
|
||||||
|
# set(VCPKG_LIBRARY_DIR ${VCPKG_ROOT}/lib)
|
||||||
|
# include_directories(${PROJECT_SOURCE_DIR} api model ${VCPKG_INCLUDE_DIR})
|
||||||
|
|
||||||
#SUPPORTING FILES
|
#SUPPORTING FILES
|
||||||
set(SUPPORTING_FILES "ApiClient" "ApiConfiguration" "ApiException" "HttpContent" "IHttpBody" "JsonBody" "ModelBase" "MultipartFormData" "Object")
|
set(SUPPORTING_FILES "ApiClient" "ApiConfiguration" "ApiException" "HttpContent" "IHttpBody" "JsonBody" "ModelBase" "MultipartFormData" "Object")
|
||||||
#SOURCE FILES
|
#SOURCE FILES
|
||||||
|
|||||||
@@ -37,6 +37,15 @@ set(CPPREST_LIBRARY_DIR ${CPPREST_ROOT}/lib)
|
|||||||
|
|
||||||
include_directories(${PROJECT_SOURCE_DIR} api model ${CPPREST_INCLUDE_DIR})
|
include_directories(${PROJECT_SOURCE_DIR} api model ${CPPREST_INCLUDE_DIR})
|
||||||
|
|
||||||
|
|
||||||
|
# If using vcpkg, set include directories. Also comment out CPPREST section above since vcpkg will handle it.
|
||||||
|
# To install required vcpkg packages execute:
|
||||||
|
# > vcpkg install cpprestsdk cpprestsdk:x64-windows boost-uuid boost-uuid:x64-windows
|
||||||
|
# set(VCPKG_ROOT "C:\\vcpkg\\installed\\x64-windows")
|
||||||
|
# set(VCPKG_INCLUDE_DIR ${VCPKG_ROOT}/include)
|
||||||
|
# set(VCPKG_LIBRARY_DIR ${VCPKG_ROOT}/lib)
|
||||||
|
# include_directories(${PROJECT_SOURCE_DIR} api model ${VCPKG_INCLUDE_DIR})
|
||||||
|
|
||||||
#SUPPORTING FILES
|
#SUPPORTING FILES
|
||||||
set(SUPPORTING_FILES "ApiClient" "ApiConfiguration" "ApiException" "HttpContent" "IHttpBody" "JsonBody" "ModelBase" "MultipartFormData" "Object")
|
set(SUPPORTING_FILES "ApiClient" "ApiConfiguration" "ApiException" "HttpContent" "IHttpBody" "JsonBody" "ModelBase" "MultipartFormData" "Object")
|
||||||
#SOURCE FILES
|
#SOURCE FILES
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat
|
|||||||
|
|
||||||
Install [cpprestsdk](https://github.com/Microsoft/cpprestsdk).
|
Install [cpprestsdk](https://github.com/Microsoft/cpprestsdk).
|
||||||
|
|
||||||
- Windows: `vcpkg install cpprestsdk cpprestsdk:x64-windows`
|
- Windows: `vcpkg install cpprestsdk cpprestsdk:x64-windows boost-uuid boost-uuid:x64-windows`
|
||||||
- Mac: `brew install cpprestsdk`
|
- Mac: `brew install cpprestsdk`
|
||||||
- Linux: `sudo apt-get install libcpprest-dev`
|
- Linux: `sudo apt-get install libcpprest-dev`
|
||||||
|
|
||||||
@@ -29,6 +29,21 @@ cmake -DCPPREST_ROOT=/usr -DCMAKE_CXX_FLAGS="-I/usr/local/opt/openssl/include" -
|
|||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Build on Windows with Visual Studio (VS2017)
|
||||||
|
|
||||||
|
- Right click on folder containing source code
|
||||||
|
- Select 'Open in visual studio'
|
||||||
|
- Once visual studio opens, CMake should show up in top menu bar.
|
||||||
|
- Select CMake > Build All.
|
||||||
|
|
||||||
|
*Note: If the CMake menu item doesn't show up in Visual Studio, CMake
|
||||||
|
for Visual Studio must be installed. In this case, open the 'Visual Studio
|
||||||
|
Installer' application. Select 'modify' Visual Studio 2017. Make sure
|
||||||
|
'Desktop Development with C++' is installed, and specifically that 'Visual
|
||||||
|
C++ tools for CMake' is selected in the 'Installation Details' section.
|
||||||
|
|
||||||
|
Also be sure to review the CMakeLists.txt file. Edits are likely required.*
|
||||||
|
|
||||||
## Author
|
## Author
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,10 @@
|
|||||||
#include <cpprest/details/basic_types.h>
|
#include <cpprest/details/basic_types.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _WIN32 | _WIN64
|
||||||
|
#undef U
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
|
|
||||||
namespace org {
|
namespace org {
|
||||||
|
|||||||
@@ -26,6 +26,10 @@
|
|||||||
#include <cpprest/details/basic_types.h>
|
#include <cpprest/details/basic_types.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _WIN32 | _WIN64
|
||||||
|
#undef U
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
|
|
||||||
namespace org {
|
namespace org {
|
||||||
|
|||||||
@@ -26,6 +26,10 @@
|
|||||||
#include <cpprest/details/basic_types.h>
|
#include <cpprest/details/basic_types.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _WIN32 | _WIN64
|
||||||
|
#undef U
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
|
|
||||||
namespace org {
|
namespace org {
|
||||||
|
|||||||
Reference in New Issue
Block a user