Skip to content

Commit e650de5

Browse files
committed
Squashed 'src/cpprestsdk/cpprestsdk/' content from commit 122d0954
git-subtree-dir: src/cpprestsdk/cpprestsdk git-subtree-split: 122d09549201da5383321d870bed45ecb9e168c5
0 parents  commit e650de5

File tree

460 files changed

+119486
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

460 files changed

+119486
-0
lines changed

.clang-format

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# https://releases.llvm.org/7.0.0/tools/clang/docs/ClangFormatStyleOptions.html
2+
3+
---
4+
Language: Cpp
5+
6+
BasedOnStyle: WebKit
7+
8+
AlignAfterOpenBracket: Align
9+
AlignOperands: true
10+
AlignTrailingComments: true
11+
AllowAllParametersOfDeclarationOnNextLine: true
12+
AllowShortBlocksOnASingleLine: false
13+
AllowShortCaseLabelsOnASingleLine: true
14+
AllowShortFunctionsOnASingleLine: All
15+
AllowShortIfStatementsOnASingleLine: true
16+
AllowShortLoopsOnASingleLine: false
17+
AlwaysBreakTemplateDeclarations: true
18+
BinPackArguments: false
19+
BinPackParameters: false
20+
BreakBeforeBinaryOperators: None
21+
BreakBeforeBraces: Allman
22+
BreakConstructorInitializersBeforeComma: true
23+
ColumnLimit: 120
24+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
25+
Cpp11BracedListStyle: true
26+
FixNamespaceComments: true
27+
IncludeBlocks: Regroup
28+
IncludeCategories:
29+
- Regex: '^["<](stdafx|pch)\.h[">]$'
30+
Priority: -1
31+
- Regex: '^<Windows\.h>$'
32+
Priority: 3
33+
- Regex: '^<(WinIoCtl|winhttp|Shellapi)\.h>$'
34+
Priority: 4
35+
- Regex: '.*'
36+
Priority: 2
37+
IndentCaseLabels: true
38+
IndentWidth: 4
39+
KeepEmptyLinesAtTheStartOfBlocks: false
40+
MaxEmptyLinesToKeep: 2
41+
NamespaceIndentation: None
42+
PenaltyReturnTypeOnItsOwnLine: 1000
43+
PointerAlignment: Left
44+
SpaceAfterTemplateKeyword: false
45+
Standard: Cpp11
46+
UseTab: Never

.gitignore

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Visual Studio files
2+
*.o
3+
*.d
4+
*.so
5+
*.[Oo]bj
6+
*.user
7+
*.aps
8+
*.pch
9+
*.vspscc
10+
*.vssscc
11+
*_i.c
12+
*_p.c
13+
*.ncb
14+
*.suo
15+
*.tlb
16+
*.tlh
17+
*.bak
18+
*.[Cc]ache
19+
*.ilk
20+
*.log
21+
*.lib
22+
*.sbr
23+
*.sdf
24+
*.sdf
25+
*.opensdf
26+
*.pdb
27+
*.idb
28+
*.res
29+
*.unsuccessfulbuild
30+
*.lastbuildstate
31+
*.tlog
32+
*.intermediate
33+
*.dll
34+
*.exp
35+
*.exe
36+
*.manifest
37+
*.rc
38+
*~
39+
ipch/
40+
obj/
41+
# OSX files
42+
*.xccheckout
43+
*.pbxuser
44+
*.mode1v3
45+
*.mode2v3
46+
*.perspective3
47+
!default.pbxuser
48+
!default.mode1v3
49+
!default.mode2v3
50+
!default.perspective3
51+
xcuserdata
52+
*.xcuserstate
53+
.DS_Store
54+
.Trashes
55+
*.swp
56+
*.lock
57+
*~.nib
58+
*.resfiles
59+
[Bb]in
60+
Binaries/
61+
Intermediate/
62+
# The packages folder can be ignored because of Package Restore
63+
**/packages/*
64+
# except build/, which is used as an MSBuild target.
65+
!**/packages/build/
66+
.vs/
67+
# Ignore cmake building directories
68+
build.*/
69+
docs/
70+
# Ignore NuGet artifacts
71+
.nuget/
72+
Build_android/build/
73+
Generated Files/
74+
# Ignore iOS temp build directories
75+
Build_iOS/Apple-Boost-BuildScript
76+
77+
/out/

.gitmodules

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[submodule "vcpkg"]
2+
path = vcpkg
3+
url = https://github.com/Microsoft/vcpkg
4+
[submodule "websocketpp"]
5+
path = Release/libs/websocketpp
6+
url = https://github.com/zaphoyd/websocketpp
7+
fetchRecurseSubmodules = false

.vscode/launch.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "(Windows) Launch Debug Tests",
9+
"type": "cppvsdbg",
10+
"request": "launch",
11+
"program": "${workspaceFolder}/build.debug/Release/Binaries/test_runner.exe",
12+
"args": ["*testd.dll"],
13+
"stopAtEntry": false,
14+
"cwd": "${workspaceFolder}/build.debug/Release/Binaries",
15+
"environment": [],
16+
"externalConsole": true
17+
}
18+
]
19+
}

.vscode/settings.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"files.watcherExclude": {
3+
"**/.git/objects/**": true,
4+
"**/.git/subtree-cache/**": true,
5+
"**/node_modules/*/**": true,
6+
"**/vcpkg/**": true,
7+
"build.x86.debug": true,
8+
"build.x86.release": true,
9+
"build.x64.debug": true,
10+
"build.x64.release": true,
11+
"out": true,
12+
},
13+
"cSpell.words": [
14+
"XPLATSTR",
15+
"blittable",
16+
"pplx",
17+
"rdpos",
18+
"rgpsz"
19+
]
20+
}

Build_android/configure.sh

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
#!/bin/bash
2+
# Copyright (C) Microsoft. All rights reserved.
3+
# Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
4+
# =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
5+
#
6+
# configure.sh
7+
#
8+
# Build script for casablanca on android
9+
#
10+
# For the latest on this and related APIs, please see: https://github.com/Microsoft/cpprestsdk
11+
#
12+
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
13+
14+
set -e
15+
16+
# The Android NDK r10e or later may work, but we test with r18b. To download, see the following link:
17+
# https://developer.android.com/ndk/downloads/index.html
18+
19+
# -----------------
20+
# Parse args
21+
# -----------------
22+
23+
DO_BOOST=1
24+
DO_OPENSSL=1
25+
DO_CMAKE=1
26+
DO_CPPRESTSDK=1
27+
28+
BOOSTVER=1.70.0
29+
OPENSSLVER=1.1.0j
30+
CMAKEVER=3.14.0
31+
32+
API=15
33+
STL=c++_shared
34+
35+
function usage {
36+
echo "Usage: $0 [--skip-boost] [--skip-openssl] [--skip-cpprestsdk] [-h] [--ndk <android-ndk>]"
37+
echo ""
38+
echo " --skip-boost Skip fetching and compiling boost"
39+
echo " --skip-openssl Skip fetching and compiling openssl"
40+
echo " --skip-cpprestsdk Skip compiling cpprestsdk"
41+
echo " --boost <version> Override the Boost version to build (default is ${BOOSTVER})"
42+
echo " --openssl <version> Override the OpenSSL version to build (default is ${OPENSSLVER})"
43+
echo " --ndk <android-ndk> If specified, overrides the ANDROID_NDK environment variable"
44+
echo " -h,--help,-? Display this information"
45+
}
46+
47+
while [[ $# > 0 ]]
48+
do
49+
case $1 in
50+
"--skip-boost")
51+
DO_BOOST=0
52+
;;
53+
"--skip-openssl")
54+
DO_OPENSSL=0
55+
;;
56+
"--skip-cmake")
57+
DO_CMAKE=0
58+
;;
59+
"--skip-cpprestsdk")
60+
DO_CPPRESTSDK=0
61+
;;
62+
"--boost")
63+
shift
64+
DO_BOOST=1
65+
BOOSTVER=$1
66+
;;
67+
"--cmake")
68+
shift
69+
DO_CMAKE=1
70+
CMAKEVER=$1
71+
;;
72+
"--openssl")
73+
shift
74+
DO_OPENSSL=1
75+
OPENSSLVER=$1
76+
;;
77+
"--ndk")
78+
shift
79+
export ANDROID_NDK=$1
80+
;;
81+
"-?"|"-h"|"--help")
82+
usage
83+
exit
84+
;;
85+
*)
86+
usage
87+
exit 1
88+
;;
89+
esac
90+
shift
91+
done
92+
93+
# Variables setup
94+
95+
unset BOOST_ROOT
96+
97+
if [ ! -e "${ANDROID_NDK}/ndk-build" ]
98+
then
99+
echo "ANDROID_NDK does not point to a valid NDK."
100+
echo "(current setting: '${ANDROID_NDK}')"
101+
exit 1
102+
fi
103+
NDK_DIR=`cd "${ANDROID_NDK}" && pwd`
104+
SRC_DIR=`pwd`
105+
106+
if [ -z "$NCPU" ]; then
107+
NCPU=4
108+
if uname -s | grep -i "linux" > /dev/null ; then
109+
NCPU=`cat /proc/cpuinfo | grep -c -i processor`
110+
fi
111+
fi
112+
113+
# -----------------------
114+
# Identify the script dir
115+
# -----------------------
116+
117+
# source:
118+
# http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
119+
120+
SOURCE="${BASH_SOURCE[0]}"
121+
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
122+
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
123+
SOURCE="$(readlink "$SOURCE")"
124+
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
125+
done
126+
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
127+
128+
if [ "$SRC_DIR" == "$DIR" ]
129+
then
130+
echo "You must use a separate directory for building."
131+
echo "(try 'mkdir build; cd build; ../configure.sh')"
132+
exit 1
133+
fi
134+
135+
# -------
136+
# Openssl
137+
# -------
138+
139+
# This steps are based on the official openssl build instructions
140+
# http://wiki.openssl.org/index.php/Android
141+
if [ "${DO_OPENSSL}" == "1" ]; then (
142+
if [ ! -d "openssl" ]; then mkdir openssl; fi
143+
cd openssl
144+
cp -af "${DIR}/openssl/." .
145+
make all ANDROID_NDK="${NDK_DIR}" ANDROID_TOOLCHAIN=clang ANDROID_ABI=armeabi-v7a OPENSSL_PREFIX=armeabi-v7a OPENSSL_VERSION=$OPENSSLVER -j $NCPU
146+
make all ANDROID_NDK="${NDK_DIR}" ANDROID_TOOLCHAIN=clang ANDROID_ABI=x86 OPENSSL_PREFIX=x86 OPENSSL_VERSION=$OPENSSLVER -j $NCPU
147+
) fi
148+
149+
# -----
150+
# Boost
151+
# -----
152+
# Uses the build script from Moritz Wundke (formerly MysticTreeGames)
153+
# https://github.com/moritz-wundke/Boost-for-Android
154+
# (plus the patch https://github.com/o01eg/Boost-for-Android/tree/ndk-bump-21)
155+
156+
if [ "${DO_BOOST}" == "1" ]; then (
157+
if [ ! -d 'Boost-for-Android' ]; then git clone https://github.com/o01eg/Boost-for-Android/; fi
158+
cd Boost-for-Android
159+
git checkout 7626dd6f7cab7866dce20e685d4a1b11194366a7
160+
PATH="$PATH:$NDK_DIR" \
161+
CXXFLAGS="-std=gnu++11" \
162+
./build-android.sh \
163+
--boost=$BOOSTVER \
164+
--arch=armeabi-v7a,x86 \
165+
--with-libraries=atomic,random,date_time,filesystem,system,thread,chrono \
166+
"${NDK_DIR}" || exit 1
167+
) fi
168+
169+
# ------
170+
# CMake
171+
# ------
172+
# We update CMake because the version included with Ubuntu is too old to handle Boost 1.69.
173+
174+
if [ "${DO_CMAKE}" == "1" ]; then (
175+
if [ ! -d "cmake-${CMAKEVER}" ]; then wget https://github.com/Kitware/CMake/releases/download/v${CMAKEVER}/cmake-${CMAKEVER}-Linux-x86_64.sh; fi
176+
chmod +x cmake-${CMAKEVER}-Linux-x86_64.sh
177+
rm -rf cmake-${CMAKEVER}
178+
mkdir cmake-${CMAKEVER}
179+
cd cmake-${CMAKEVER}
180+
../cmake-${CMAKEVER}-Linux-x86_64.sh --skip-license
181+
) fi
182+
183+
# ----------
184+
# casablanca
185+
# ----------
186+
187+
if [ "${DO_CPPRESTSDK}" == "1" ]; then
188+
# Use the builtin CMake toolchain configuration that comes with the NDK
189+
function build_cpprestsdk { (
190+
rm -rf $1
191+
./cmake-${CMAKEVER}/bin/cmake \
192+
-DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" \
193+
-DANDROID_NDK="${ANDROID_NDK}" \
194+
-DANDROID_TOOLCHAIN=clang \
195+
-DANDROID_ABI=$2 \
196+
-DBOOST_VERSION="${BOOSTVER}" \
197+
-DCPPREST_EXCLUDE_WEBSOCKETS=ON \
198+
-DCMAKE_BUILD_TYPE=$3 \
199+
-S "${DIR}/.." \
200+
-B $1
201+
make -j $NCPU -C $1
202+
) }
203+
204+
# Build the cpprestsdk for each target configuration
205+
build_cpprestsdk build.armv7.debug armeabi-v7a Debug
206+
build_cpprestsdk build.armv7.release armeabi-v7a Release
207+
build_cpprestsdk build.x86.debug x86 Debug
208+
build_cpprestsdk build.x86.release x86 Release
209+
fi

0 commit comments

Comments
 (0)