From 1a29dba4ca2aac7f19f9e9de535baae83523f6ae Mon Sep 17 00:00:00 2001 From: Jason Hartman Date: Tue, 23 Jul 2019 12:37:03 -0700 Subject: [PATCH 1/9] On isolated_components: Add option to build components in isolated libraries fixup includes from not using a common precompiled header - separate windows header config to be usable outside of pch --- Release/CMakeLists.txt | 10 +- .../include/cpprest/details/web_utilities.h | 1 + Release/include/pplx/pplxlinux.h | 4 + Release/include/pplx/pplxwin.h | 4 + Release/src/CMakeLists.txt | 194 +++++++++++++++--- Release/src/internal/windows_config.h | 40 ++++ Release/src/json/json.cpp | 2 + Release/src/json/json_parsing.cpp | 3 + Release/src/json/json_serialization.cpp | 3 + Release/src/nopch/stdafx.h | 17 ++ Release/src/pch/stdafx.h | 25 +-- Release/src/pplx/pplxwin.cpp | 9 +- Release/src/pplx/threadpool.cpp | 6 +- Release/src/streams/fileio_win32.cpp | 6 +- Release/src/utilities/asyncrt_utils.cpp | 4 + Release/src/utilities/web_utilities.cpp | 11 +- .../tests/common/UnitTestpp/CMakeLists.txt | 2 +- Release/tests/functional/json/CMakeLists.txt | 6 +- .../functional/pplx/pplx_test/CMakeLists.txt | 2 +- .../tests/functional/streams/CMakeLists.txt | 2 +- Release/tests/functional/utils/CMakeLists.txt | 2 +- Release/tests/functional/utils/macro_test.cpp | 1 + Release/tests/functional/utils/stdafx.h | 1 - azure-pipelines.yml | 30 ++- 24 files changed, 315 insertions(+), 70 deletions(-) create mode 100644 Release/src/internal/windows_config.h create mode 100644 Release/src/nopch/stdafx.h diff --git a/Release/CMakeLists.txt b/Release/CMakeLists.txt index 65d2114063..f7a557aa1b 100644 --- a/Release/CMakeLists.txt +++ b/Release/CMakeLists.txt @@ -23,6 +23,7 @@ set(CPPREST_EXPORT_DIR cpprestsdk CACHE STRING "Directory to install CMake confi option(CPPREST_FORCE_NARROW_STRINGS "Keep strings narrow/UTF8 (even if WIN32)" OFF) set(CPPREST_INSTALL_HEADERS ON CACHE BOOL "Install header files.") set(CPPREST_INSTALL ON CACHE BOOL "Add install commands.") +option(CPPREST_ISOLATE_COMPONENTS "Build cpprest components as individual libraries" OFF) if(IOS OR ANDROID) set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries") @@ -235,7 +236,8 @@ if(NOT PARENT_DIR STREQUAL "") endif() # Finally, the tests all use the same style declaration to build themselves, so we use a function -function(add_casablanca_test NAME SOURCES_VAR) +# Tests that don't specify IMPLEMENTATION_TARGETS are assumed to depend on whole of cpprest. +function(add_casablanca_test NAME SOURCES_VAR) # [optional] IMPLEMENTATION_TARGETS... add_library(${NAME} ${TEST_LIBRARY_TARGET_TYPE} ${${SOURCES_VAR}}) message("-- Added test library ${NAME}") if(TEST_LIBRARY_TARGET_TYPE STREQUAL "OBJECT") @@ -244,8 +246,12 @@ function(add_casablanca_test NAME SOURCES_VAR) target_compile_definitions(${NAME} PRIVATE $) endforeach() else() + set(IMPLEMENTATION_TARGETS cpprest) + if(CPPREST_ISOLATE_COMPONENTS AND ${ARGC} GREATER 2) + set(IMPLEMENTATION_TARGETS ${ARGN}) + endif() target_link_libraries(${NAME} PRIVATE - cpprest + ${IMPLEMENTATION_TARGETS} common_utilities unittestpp ${ANDROID_LIBS} diff --git a/Release/include/cpprest/details/web_utilities.h b/Release/include/cpprest/details/web_utilities.h index d7c7fdb36b..f697add4f8 100644 --- a/Release/include/cpprest/details/web_utilities.h +++ b/Release/include/cpprest/details/web_utilities.h @@ -12,6 +12,7 @@ #include "cpprest/asyncrt_utils.h" #include "cpprest/uri.h" +#include "pplx/pplxtasks.h" #include namespace web diff --git a/Release/include/pplx/pplxlinux.h b/Release/include/pplx/pplxlinux.h index 5aca316e45..7a0027b0f3 100644 --- a/Release/include/pplx/pplxlinux.h +++ b/Release/include/pplx/pplxlinux.h @@ -17,6 +17,10 @@ #error This file must not be included for Visual Studio #endif +#if !defined(_PPLX_H) +#error Include pplx.h instead of pplxlinux.h directly. +#endif + #ifndef _WIN32 #include "cpprest/details/cpprest_compat.h" diff --git a/Release/include/pplx/pplxwin.h b/Release/include/pplx/pplxwin.h index 95a23b3158..c52098a87a 100644 --- a/Release/include/pplx/pplxwin.h +++ b/Release/include/pplx/pplxwin.h @@ -13,6 +13,10 @@ #pragma once +#if !defined(_PPLX_H) +#error Include pplx.h instead of pplxwin.h directly. +#endif + #if !defined(_WIN32) || _MSC_VER < 1800 || CPPREST_FORCE_PPLX #include "cpprest/details/cpprest_compat.h" diff --git a/Release/src/CMakeLists.txt b/Release/src/CMakeLists.txt index 79af527c73..66feb7534b 100644 --- a/Release/src/CMakeLists.txt +++ b/Release/src/CMakeLists.txt @@ -15,13 +15,6 @@ set(SOURCES ${HEADERS_PPLX} ${HEADERS_DETAILS} pch/stdafx.h - json/json.cpp - json/json_parsing.cpp - json/json_serialization.cpp - utilities/asyncrt_utils.cpp - utilities/base64.cpp - utilities/string_utils.cpp - utilities/web_utilities.cpp ) if(NOT CPPREST_EXCLUDE_HTTP_NARROW_STRING_WIP) @@ -45,15 +38,149 @@ LIST(APPEND SOURCES ) endif() +# Targets for properties common to all cpprestsdk libraries +add_library(cpprest_interface_PUBLIC INTERFACE) +target_include_directories(cpprest_interface_PUBLIC + INTERFACE + $ +) +add_library(cpprest_interface_PRIVATE INTERFACE) +target_include_directories(cpprest_interface_PRIVATE + INTERFACE + $ +) + add_library(cpprest ${SOURCES}) target_include_directories(cpprest PUBLIC - $ $ + $ PRIVATE pch ) +target_link_libraries(cpprest PUBLIC cpprest_interface_PUBLIC PRIVATE cpprest_interface_PRIVATE) +set(CPPREST_TARGETS cpprest cpprest_interface_PUBLIC) ## Sub-components + +# add_sub_component(name sources...) +# When CPPREST_ISOLATE_COMPONENTS is ON: +# Creates library ${name} using given sources. Then adds respective +# object files to cpprest. +# Otherwise sources are added to cpprest directly. +function(add_sub_component name) # sources... + set(COMPONENT_SOURCES ${ARGN}) + + # cpprest and this new library inherit these properties publicly. + add_library(${name}_properties_PUBLIC INTERFACE) + target_link_libraries(${name}_properties_PUBLIC INTERFACE cpprest_interface_PUBLIC) + # cpprest and this new library inherit these properties privately. + add_library(${name}_properties_PRIVATE INTERFACE) + target_link_libraries(${name}_properties_PRIVATE INTERFACE cpprest_interface_PRIVATE) + + if(CPPREST_ISOLATE_COMPONENTS) + # isolated components are built as OBJECT_LIBRARY so that cpprest library + # may be self contained (apart from external dependencies) and sources are + # still only compiled once. + add_library(${name}_objects OBJECT ${COMPONENT_SOURCES}) + # disable pch for isolated builds to ensure dependencies are explict and + # to avoid contamination across components by setting include path to + # reach primitive (ideally empty) stdafx.h. + target_include_directories(${name}_objects + PRIVATE + nopch + ) + target_link_libraries(${name}_objects PRIVATE ${name}_properties_PUBLIC ${name}_properties_PRIVATE) + + # create library of sub-component + add_library(${name} $) + target_link_libraries(${name} PUBLIC ${name}_properties_PUBLIC PRIVATE ${name}_properties_PRIVATE) + + # connect sources to cpprest (main target) + target_sources(cpprest PRIVATE $) + else() + # no isolation, just build sources as part of cpprest + target_sources(cpprest PRIVATE ${COMPONENT_SOURCES}) + + # do create a dummy interface library for sub-components to specify other + # sub-components in sub_component_link_libraries + add_library(${name} INTERFACE) + # also add to target install list in case there is such use + list(APPEND CPPREST_TARGETS ${name}) + endif() + + target_link_libraries(cpprest PUBLIC ${name}_properties_PUBLIC PRIVATE ${name}_properties_PRIVATE) + + # append public properties (interface) target to install list + # sub-component libraries (isolation build only) are not installed + list(APPEND CPPREST_TARGETS ${name}_properties_PUBLIC) + set(CPPREST_TARGETS ${CPPREST_TARGETS} PARENT_SCOPE) +endfunction() + +# sub_component_sources(name sources...) +# Adds given sources to sub-component library and/or cpprest. +function(sub_component_sources name) # additional sources... + if(CPPREST_ISOLATE_COMPONENTS) + target_sources(${name}_objects ${ARGN}) + else() + # no actual sub-component targets built when not isolated; pass along + # sources to cpprest + target_sources(cpprest ${ARGN}) + endif() +endfunction() + +# sub_component_link_libraries(name link_dependencies...) +# Adds given link_dependencies to sub-component library and/or cpprest. +function(sub_component_link_libraries name) # link dependencies... + if(CPPREST_ISOLATE_COMPONENTS) + target_link_libraries(${name}_objects ${ARGN}) + target_link_libraries(${name} ${ARGN}) + # remove entries in list that are our own sub-components + # before passing up to cpprest + set(ALL_LINK_ARGS ${ARGN}) + foreach(LINK_ARG ${ALL_LINK_ARGS}) + if(TARGET ${LINK_ARG}_properties_PRIVATE) + list(REMOVE_ITEM ARGN ${LINK_ARG}) + endif() + endforeach() + else() + # no actual sub-component targets built when not isolated + endif() + # pass along dependencies to cpprest in all cases + # (in isolated case only objects are referenced, so dependencies + # need to be passed up too) + target_link_libraries(cpprest ${ARGN}) +endfunction() + + +# Utility components +add_sub_component(cpprest_utility_strings + utilities/string_utils.cpp +) + +add_sub_component(cpprest_utility_asyncrt + utilities/asyncrt_utils.cpp +) +sub_component_link_libraries(cpprest_utility_asyncrt PUBLIC cpprest_utility_strings) + +add_sub_component(cpprest_utilities + utilities/base64.cpp + utilities/web_utilities.cpp +) +sub_component_link_libraries(cpprest_utilities PUBLIC cpprest_utility_asyncrt cpprest_utility_strings) +if(WIN32 AND NOT WINDOWS_STORE AND NOT WINDOWS_PHONE) + sub_component_link_libraries(cpprest_utilities PRIVATE + crypt32.lib + ) +endif() + +# Json component +add_sub_component(cpprest_json + json/json.cpp + json/json_parsing.cpp + json/json_serialization.cpp +) +sub_component_link_libraries(cpprest_json PUBLIC cpprest_utility_strings) + # Websockets component if(CPPREST_WEBSOCKETS_IMPL STREQUAL "none") target_compile_definitions(cpprest PUBLIC -DCPPREST_EXCLUDE_WEBSOCKETS=1) @@ -100,35 +227,43 @@ endif() if(CPPREST_PPLX_IMPL STREQUAL "apple") find_library(COREFOUNDATION CoreFoundation "/") find_library(SECURITY Security "/") - target_link_libraries(cpprest PUBLIC ${COREFOUNDATION} ${SECURITY}) - target_sources(cpprest PRIVATE pplx/pplxapple.cpp pplx/pplx.cpp pplx/threadpool.cpp ../include/pplx/threadpool.h) + add_sub_component(cpprest_pplx pplx/pplxapple.cpp pplx/pplx.cpp pplx/threadpool.cpp ../include/pplx/threadpool.h) + sub_component_link_libraries(cpprest_pplx PUBLIC ${COREFOUNDATION} ${SECURITY}) if(CPPREST_INSTALL_HEADERS) install(FILES ../include/pplx/threadpool.h DESTINATION include/pplx) endif() elseif(CPPREST_PPLX_IMPL STREQUAL "linux") - target_sources(cpprest PRIVATE pplx/pplxlinux.cpp pplx/pplx.cpp pplx/threadpool.cpp ../include/pplx/threadpool.h) + add_sub_component(cpprest_pplx pplx/pplxlinux.cpp pplx/pplx.cpp pplx/threadpool.cpp ../include/pplx/threadpool.h) if(CPPREST_INSTALL_HEADERS) install(FILES ../include/pplx/threadpool.h DESTINATION include/pplx) endif() elseif(CPPREST_PPLX_IMPL STREQUAL "win") - target_sources(cpprest PRIVATE pplx/pplxwin.cpp) + add_sub_component(cpprest_pplx pplx/pplxwin.cpp) if(CPPREST_WEBSOCKETS_IMPL STREQUAL "wspp") - target_sources(cpprest PRIVATE pplx/threadpool.cpp ../include/pplx/threadpool.h) + sub_component_sources(cpprest_pplx PRIVATE pplx/threadpool.cpp ../include/pplx/threadpool.h) if(CPPREST_INSTALL_HEADERS) install(FILES ../include/pplx/threadpool.h DESTINATION include/pplx) endif() endif() elseif(CPPREST_PPLX_IMPL STREQUAL "winpplx") - target_compile_definitions(cpprest PUBLIC -DCPPREST_FORCE_PPLX=1) - target_sources(cpprest PRIVATE pplx/pplxwin.cpp pplx/pplx.cpp pplx/threadpool.cpp ../include/pplx/threadpool.h) - if(CPPREST_INSTALL_HEADERS) - install(FILES ../include/pplx/threadpool.h DESTINATION include/pplx) + add_sub_component(cpprest_pplx pplx/pplxwin.cpp pplx/pplx.cpp) + target_compile_definitions(cpprest_pplx_properties_PUBLIC INTERFACE -DCPPREST_FORCE_PPLX=1) + if(NOT CPPREST_WEBSOCKETS_IMPL STREQUAL "none") + sub_component_sources(cpprest_pplx PRIVATE pplx/threadpool.cpp ../include/pplx/threadpool.h) + if(CPPREST_INSTALL_HEADERS) + install(FILES ../include/pplx/threadpool.h DESTINATION include/pplx) + endif() endif() elseif(CPPREST_PPLX_IMPL STREQUAL "winrt") - target_sources(cpprest PRIVATE pplx/pplxwin.cpp) + add_sub_component(cpprest_pplx pplx/pplxwin.cpp) else() message(FATAL_ERROR "Invalid implementation") endif() +if(NOT CPPREST_PPLX_IMPL STREQUAL "winrt") + cpprest_find_boost() + sub_component_link_libraries(cpprest_pplx PUBLIC cpprestsdk_boost_internal) +endif() +sub_component_link_libraries(cpprest_pplx PUBLIC cpprest_utility_asyncrt) # Http client component if(NOT CPPREST_EXCLUDE_HTTP_NARROW_STRING_WIP) @@ -156,14 +291,15 @@ endif() # fileio streams component if(CPPREST_FILEIO_IMPL STREQUAL "win32") - target_sources(cpprest PRIVATE streams/fileio_win32.cpp) + add_sub_component(cpprest_streams streams/fileio_win32.cpp) elseif(CPPREST_FILEIO_IMPL STREQUAL "winrt") - target_sources(cpprest PRIVATE streams/fileio_winrt.cpp) + add_sub_component(cpprest_streams streams/fileio_winrt.cpp) elseif(CPPREST_FILEIO_IMPL STREQUAL "posix") - target_sources(cpprest PRIVATE streams/fileio_posix.cpp) + add_sub_component(cpprest_streams streams/fileio_posix.cpp) else() message(FATAL_ERROR "Invalid implementation") endif() +sub_component_link_libraries(cpprest_streams PUBLIC cpprest_utility_asyncrt) # http listener component if(CPPREST_HTTP_LISTENER_IMPL STREQUAL "asio") @@ -197,12 +333,12 @@ endif() if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") if(WERROR) - target_compile_options(cpprest PRIVATE -Werror) + target_compile_options(cpprest_interface_PRIVATE INTERFACE -Werror) endif() - target_compile_options(cpprest PRIVATE -pedantic ${WARNINGS}) + target_compile_options(cpprest_interface_PRIVATE INTERFACE -pedantic ${WARNINGS}) elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") if(WERROR) - target_compile_options(cpprest PRIVATE /WX ${WARNINGS}) + target_compile_options(cpprest_interface_PRIVATE INTERFACE /WX ${WARNINGS}) endif() else() message(FATAL_ERROR "Unknown compiler") @@ -210,22 +346,21 @@ endif() if(WIN32) if (BUILD_SHARED_LIBS) - target_compile_definitions(cpprest PRIVATE -D_ASYNCRT_EXPORT -D_PPLX_EXPORT -D_USRDLL) + target_compile_definitions(cpprest_interface_PRIVATE INTERFACE -D_ASYNCRT_EXPORT -D_PPLX_EXPORT -D_USRDLL) else() - target_compile_definitions(cpprest PUBLIC -D_NO_ASYNCRTIMP -D_NO_PPLXIMP) + target_compile_definitions(cpprest_interface_PUBLIC INTERFACE -D_NO_ASYNCRTIMP -D_NO_PPLXIMP) endif() elseif(ANDROID) - target_link_libraries(cpprest PRIVATE ${ANDROID_STL_FLAGS}) + target_link_libraries(cpprest_interface_PRIVATE INTERFACE ${ANDROID_STL_FLAGS}) endif() if (WIN32 AND NOT WINDOWS_STORE AND NOT WINDOWS_PHONE) target_link_libraries(cpprest PRIVATE bcrypt.lib - crypt32.lib ) elseif(WINDOWS_STORE) if(NOT CMAKE_GENERATOR MATCHES "Visual Studio .*") - target_compile_definitions(cpprest PRIVATE -DWINAPI_FAMILY=WINAPI_FAMILY_PC_APP) + target_compile_definitions(cpprest_interface_PRIVATE INTERFACE -DWINAPI_FAMILY=WINAPI_FAMILY_PC_APP) get_target_property(LINK_FLAGS cpprest LINK_FLAGS) if(NOT LINK_FLAGS) set(LINK_FLAGS "") @@ -257,7 +392,6 @@ if(CPPREST_INSTALL) set(CPPREST_USES_BROTLI OFF) set(CPPREST_USES_OPENSSL OFF) - set(CPPREST_TARGETS cpprest) if(TARGET cpprestsdk_boost_internal) list(APPEND CPPREST_TARGETS cpprestsdk_boost_internal) set(CPPREST_USES_BOOST ON) diff --git a/Release/src/internal/windows_config.h b/Release/src/internal/windows_config.h new file mode 100644 index 0000000000..a726e4f17b --- /dev/null +++ b/Release/src/internal/windows_config.h @@ -0,0 +1,40 @@ +/*** +* Copyright (C) Microsoft. All rights reserved. +* Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. +* +* =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ +* +* Internal headers +* +* For the latest on this and related APIs, please see: https://github.com/Microsoft/cpprestsdk +* +* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +****/ + +#pragma once + +#if !defined(_WIN32) +#error windows_config.h use only expected for Windows builds. (_WIN32 is not defined) +#endif + +// use the debug version of the CRT if _DEBUG is defined +#ifdef _DEBUG +#define _CRTDBG_MAP_ALLOC +#include +#endif // _DEBUG + +#include +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +#if CPPREST_TARGET_XP && _WIN32_WINNT != 0x0501 +#error CPPREST_TARGET_XP implies _WIN32_WINNT == 0x0501 +#endif // CPPREST_TARGET_XP && _WIN32_WINNT != 0x0501 + +#include + +#include + +// Windows Header Files: +#ifndef __cplusplus_winrt +#include +#endif !__cplusplus_winrt diff --git a/Release/src/json/json.cpp b/Release/src/json/json.cpp index ae640ae26d..b5262d26aa 100644 --- a/Release/src/json/json.cpp +++ b/Release/src/json/json.cpp @@ -13,6 +13,8 @@ #include "stdafx.h" +#include "cpprest/json.h" + using namespace web; bool json::details::g_keep_json_object_unsorted = false; diff --git a/Release/src/json/json_parsing.cpp b/Release/src/json/json_parsing.cpp index 2e0d71e6d3..b6ab5e2ac1 100644 --- a/Release/src/json/json_parsing.cpp +++ b/Release/src/json/json_parsing.cpp @@ -13,6 +13,9 @@ #include "stdafx.h" +#include "cpprest/json.h" + +#include #include #if defined(_MSC_VER) diff --git a/Release/src/json/json_serialization.cpp b/Release/src/json/json_serialization.cpp index 83c1086e1f..7a9617ec49 100644 --- a/Release/src/json/json_serialization.cpp +++ b/Release/src/json/json_serialization.cpp @@ -13,6 +13,9 @@ #include "stdafx.h" +#include "cpprest/json.h" + +#include #include #ifndef _WIN32 diff --git a/Release/src/nopch/stdafx.h b/Release/src/nopch/stdafx.h new file mode 100644 index 0000000000..d32bbd5137 --- /dev/null +++ b/Release/src/nopch/stdafx.h @@ -0,0 +1,17 @@ +/*** +* Copyright (C) Microsoft. All rights reserved. +* Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. +* +* =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ +* +* Pre-compiled headers +* +* For the latest on this and related APIs, please see: https://github.com/Microsoft/cpprestsdk +* +* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +****/ + +#pragma once + +// There are no contents here -- in support of component isolation builds. + diff --git a/Release/src/pch/stdafx.h b/Release/src/pch/stdafx.h index 372bc561ff..ff414674e9 100644 --- a/Release/src/pch/stdafx.h +++ b/Release/src/pch/stdafx.h @@ -20,29 +20,8 @@ #endif #ifdef _WIN32 -// use the debug version of the CRT if _DEBUG is defined -#ifdef _DEBUG -#define _CRTDBG_MAP_ALLOC -#include -#endif // _DEBUG - -#include -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - -#if CPPREST_TARGET_XP && _WIN32_WINNT != 0x0501 -#error CPPREST_TARGET_XP implies _WIN32_WINNT == 0x0501 -#endif // CPPREST_TARGET_XP && _WIN32_WINNT != 0x0501 - -#include - -#include - -// Windows Header Files: -#ifndef __cplusplus_winrt -#include -#endif !__cplusplus_winrt - -#else // LINUX or APPLE +#include "windows_config.h" +#else // LINUX or APPLE #define __STDC_LIMIT_MACROS #include "pthread.h" #include diff --git a/Release/src/pplx/pplxwin.cpp b/Release/src/pplx/pplxwin.cpp index e25d9acf34..c81b074472 100644 --- a/Release/src/pplx/pplxwin.cpp +++ b/Release/src/pplx/pplxwin.cpp @@ -15,7 +15,11 @@ #if !defined(_WIN32) || CPPREST_FORCE_PPLX -#include "pplx/pplxwin.h" +#include "pplx/pplx.h" +#include "pplx/pplxwin.h" // Note: Should already be included by way of pplx.h + +#include "cpprest/asyncrt_utils.h" +#include "windows_config.h" // Disable false alarm code analysis warning #pragma warning(disable : 26165 26110) @@ -242,6 +246,9 @@ _PPLXIMP void windows_scheduler::schedule(TaskProc_t proc, _In_ void* param) } // namespace pplx #else // ^^^ !defined(_WIN32) || CPPREST_FORCE_PPLX ^^^ // vvv defined(_WIN32) && !CPPREST_FORCE_PPLX vvv + +#include "pplx/pplxtasks.h" + namespace Concurrency { void __cdecl set_cpprestsdk_ambient_scheduler(const std::shared_ptr& _Scheduler) diff --git a/Release/src/pplx/threadpool.cpp b/Release/src/pplx/threadpool.cpp index ba38a1a12f..4fbea1ed93 100644 --- a/Release/src/pplx/threadpool.cpp +++ b/Release/src/pplx/threadpool.cpp @@ -4,7 +4,10 @@ **/ #include "stdafx.h" -#if !defined(CPPREST_EXCLUDE_WEBSOCKETS) || !defined(_WIN32) +#if defined(CPPREST_EXCLUDE_WEBSOCKETS) && defined(_WIN32) +#error CPPREST_EXCLUDE_WEBSOCKETS and WIN32, but still compiling threadpool.cpp +#endif + #include "pplx/threadpool.h" #include #include @@ -232,4 +235,3 @@ std::unique_ptr crossplat::threadpool::construct(size_t n { return std::unique_ptr(new threadpool_impl(num_threads)); } -#endif // !defined(CPPREST_EXCLUDE_WEBSOCKETS) || !defined(_WIN32) diff --git a/Release/src/streams/fileio_win32.cpp b/Release/src/streams/fileio_win32.cpp index 129fd991de..5ff5976754 100644 --- a/Release/src/streams/fileio_win32.cpp +++ b/Release/src/streams/fileio_win32.cpp @@ -19,10 +19,12 @@ #include "cpprest/details/fileio.h" -using namespace web; +#include "cpprest/asyncrt_utils.h" + +#include "windows_config.h" + using namespace utility; using namespace concurrency; -using namespace utility::conversions; namespace Concurrency { diff --git a/Release/src/utilities/asyncrt_utils.cpp b/Release/src/utilities/asyncrt_utils.cpp index d16531ce7a..72f3d97c3a 100644 --- a/Release/src/utilities/asyncrt_utils.cpp +++ b/Release/src/utilities/asyncrt_utils.cpp @@ -20,6 +20,10 @@ #include #include +#if defined(_WIN32) +#include "windows_config.h" +#endif + using namespace utility; namespace utility diff --git a/Release/src/utilities/web_utilities.cpp b/Release/src/utilities/web_utilities.cpp index 67d15a343b..39f09629d4 100644 --- a/Release/src/utilities/web_utilities.cpp +++ b/Release/src/utilities/web_utilities.cpp @@ -13,14 +13,19 @@ #include "stdafx.h" +#include "cpprest/details/web_utilities.h" + #include -#if defined(_WIN32) && !defined(__cplusplus_winrt) +#if defined(_WIN32) +#include "windows_config.h" + +#if !defined(__cplusplus_winrt) #include +#else +#include #endif -#if defined(__cplusplus_winrt) -#include #endif namespace web diff --git a/Release/tests/common/UnitTestpp/CMakeLists.txt b/Release/tests/common/UnitTestpp/CMakeLists.txt index 309c5f28fa..8cbda5b284 100644 --- a/Release/tests/common/UnitTestpp/CMakeLists.txt +++ b/Release/tests/common/UnitTestpp/CMakeLists.txt @@ -47,7 +47,7 @@ elseif(WIN32) endif() add_library(unittestpp ${UT_SOURCES}) -target_link_libraries(unittestpp PUBLIC cpprest) +target_link_libraries(unittestpp PUBLIC cpprest_interface_PUBLIC) if(UNIX) cpprest_find_boost() diff --git a/Release/tests/functional/json/CMakeLists.txt b/Release/tests/functional/json/CMakeLists.txt index 1d44a99ce6..61d443c69a 100644 --- a/Release/tests/functional/json/CMakeLists.txt +++ b/Release/tests/functional/json/CMakeLists.txt @@ -10,7 +10,11 @@ if(NOT WINDOWS_STORE AND NOT WINDOWS_PHONE) list(APPEND SOURCES fuzz_tests.cpp) endif() -add_casablanca_test(json_test SOURCES) +set(ADDITIONAL_COMPONENTS) +if(WIN32) + set(ADDITIONAL_COMPONENTS cpprest_streams) +endif() +add_casablanca_test(json_test SOURCES cpprest_json ${ADDITIONAL_COMPONENTS}) if(UNIX AND NOT APPLE) cpprest_find_boost() target_link_libraries(json_test PRIVATE cpprestsdk_boost_internal) diff --git a/Release/tests/functional/pplx/pplx_test/CMakeLists.txt b/Release/tests/functional/pplx/pplx_test/CMakeLists.txt index 0e2672b73e..a0d92f42e6 100644 --- a/Release/tests/functional/pplx/pplx_test/CMakeLists.txt +++ b/Release/tests/functional/pplx/pplx_test/CMakeLists.txt @@ -4,7 +4,7 @@ set(SOURCES pplxtask_tests.cpp ) -add_casablanca_test(pplx_test SOURCES) +add_casablanca_test(pplx_test SOURCES cpprest_pplx) if(MSVC) get_target_property(_srcs pplx_test SOURCES) diff --git a/Release/tests/functional/streams/CMakeLists.txt b/Release/tests/functional/streams/CMakeLists.txt index 29d09bbac8..7b16ed8466 100644 --- a/Release/tests/functional/streams/CMakeLists.txt +++ b/Release/tests/functional/streams/CMakeLists.txt @@ -14,7 +14,7 @@ else() endif() endif() -add_casablanca_test(streams_test SOURCES) +add_casablanca_test(streams_test SOURCES cpprest_streams) if(NOT WIN32 OR CPPREST_WEBSOCKETS_IMPL STREQUAL "wspp") cpprest_find_boost() if(NOT TEST_LIBRARY_TARGET_TYPE STREQUAL "OBJECT") diff --git a/Release/tests/functional/utils/CMakeLists.txt b/Release/tests/functional/utils/CMakeLists.txt index 201af77039..b3fa2dc7d6 100644 --- a/Release/tests/functional/utils/CMakeLists.txt +++ b/Release/tests/functional/utils/CMakeLists.txt @@ -7,7 +7,7 @@ set(SOURCES win32_encryption_tests.cpp ) -add_casablanca_test(utils_test SOURCES) +add_casablanca_test(utils_test SOURCES cpprest_utilities) if(CMAKE_COMPILER_IS_GNUCXX) target_compile_options(utils_test PRIVATE "-Wno-deprecated-declarations") diff --git a/Release/tests/functional/utils/macro_test.cpp b/Release/tests/functional/utils/macro_test.cpp index f45bc9f237..c27f0a29ed 100644 --- a/Release/tests/functional/utils/macro_test.cpp +++ b/Release/tests/functional/utils/macro_test.cpp @@ -15,6 +15,7 @@ #include "cpprest/http_client.h" #include "cpprest/http_msg.h" #include "cpprest/json.h" +#include "cpprest/uri.h" #include "cpprest/uri_builder.h" namespace tests diff --git a/Release/tests/functional/utils/stdafx.h b/Release/tests/functional/utils/stdafx.h index 40eb75f5a0..7f53de66f3 100644 --- a/Release/tests/functional/utils/stdafx.h +++ b/Release/tests/functional/utils/stdafx.h @@ -16,6 +16,5 @@ #include "cpprest/asyncrt_utils.h" #include "cpprest/details/web_utilities.h" -#include "cpprest/uri.h" #include "unittestpp.h" #include "utils_tests.h" diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 8c878f0901..5237d2c896 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -65,7 +65,28 @@ jobs: cd build.common\Release\Binaries\Release .\test_runner.exe *test.dll displayName: 'Run tests, release' - - job: Windows_VS2017_UWP + - script: mkdir build.isolated + displayName: Make Isolated Build Directory + - task: CMake@1 + inputs: + workingDirectory: 'build.isolated' + cmakeArgs: '-A x64 -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake -DCPPREST_EXCLUDE_BROTLI=OFF -DCPPREST_ISOLATE_COMPONENTS=ON ..' + - task: MSBuild@1 + inputs: + solution: 'build.isolated/ALL_BUILD.vcxproj' + maximumCpuCount: true + platform: 'x64' + - script: | + cd build.isolated\Release\Binaries\Debug + .\test_runner.exe *testd.dll + displayName: 'Run isolated tests, debug' + - task: MSBuild@1 + inputs: + solution: 'build.isolated/ALL_BUILD.vcxproj' + maximumCpuCount: true + platform: 'x64' + configuration: 'Release' +- job: Windows_VS2017_UWP pool: vmImage: 'vs2017-win2016' steps: @@ -166,12 +187,19 @@ jobs: cd build.release /usr/local/bin/cmake -G Ninja -DCMAKE_BUILD_TYPE=Release .. cd .. + mkdir build.debug.isolated + cd build.debug.isolated + /usr/local/bin/cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCPPREST_ISOLATE_COMPONENTS=ON .. + cd .. ninja -C build.debug ninja -C build.release + ninja -C build.debug.isolated cd build.debug/Release/Binaries ./test_runner *test.so cd ../../../build.release/Release/Binaries ./test_runner *test.so + cd ../../../build.debug.isolated/Release/Binaries + ./test_runner *test.so displayName: Run build - job: Ubuntu_1604_Vcpkg pool: From d2479ea1dae10f99c4e4bc9a9bd577338384ccee Mon Sep 17 00:00:00 2001 From: Jason Hartman Date: Tue, 23 Jul 2019 15:45:04 -0700 Subject: [PATCH 2/9] fix yaml indent --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5237d2c896..35bbad6822 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -86,7 +86,7 @@ jobs: maximumCpuCount: true platform: 'x64' configuration: 'Release' -- job: Windows_VS2017_UWP + - job: Windows_VS2017_UWP pool: vmImage: 'vs2017-win2016' steps: From 734a1f117d409d8fa9ae2a49455ff21d3965cb32 Mon Sep 17 00:00:00 2001 From: Jason Hartman Date: Wed, 24 Jul 2019 12:04:20 -0700 Subject: [PATCH 3/9] fix build breaks - missing headers (stl/config dependent) - correct install for static lib builds also add isolation build to Ubuntu Vcpkg and break up Ubuntu Apt --- Release/src/CMakeLists.txt | 11 ++++++ Release/src/utilities/base64.cpp | 5 ++- Release/src/utilities/string_utils.cpp | 1 + azure-pipelines.yml | 51 +++++++++++++++++++++++++- 4 files changed, 64 insertions(+), 4 deletions(-) diff --git a/Release/src/CMakeLists.txt b/Release/src/CMakeLists.txt index 66feb7534b..1746b490ff 100644 --- a/Release/src/CMakeLists.txt +++ b/Release/src/CMakeLists.txt @@ -59,6 +59,12 @@ target_include_directories(cpprest ) target_link_libraries(cpprest PUBLIC cpprest_interface_PUBLIC PRIVATE cpprest_interface_PRIVATE) set(CPPREST_TARGETS cpprest cpprest_interface_PUBLIC) +if(NOT BUILD_SHARED_LIBS) + # for installed static libraries the private dependencies must also be + # installed, though those should be interfaces only. + list(APPEND CPPREST_TARGETS cpprest_interface_PRIVATE) +endif() + ## Sub-components @@ -113,6 +119,11 @@ function(add_sub_component name) # sources... # append public properties (interface) target to install list # sub-component libraries (isolation build only) are not installed list(APPEND CPPREST_TARGETS ${name}_properties_PUBLIC) + if(NOT BUILD_SHARED_LIBS) + # for installed static libraries the private dependencies must also be + # installed, though those should be interfaces only. + list(APPEND CPPREST_TARGETS ${name}_properties_PRIVATE) + endif() set(CPPREST_TARGETS ${CPPREST_TARGETS} PARENT_SCOPE) endfunction() diff --git a/Release/src/utilities/base64.cpp b/Release/src/utilities/base64.cpp index 89ccf43674..429c3ff24c 100644 --- a/Release/src/utilities/base64.cpp +++ b/Release/src/utilities/base64.cpp @@ -13,6 +13,7 @@ #include "cpprest/base64_utils.h" #include +#include using namespace utility; @@ -138,7 +139,7 @@ std::vector _from_base64(const utility::string_t& input) for (; size > 4; ++idx) { unsigned char target[3]; - memset(target, 0, sizeof(target)); + std::memset(target, 0, sizeof(target)); _triple_byte* record = reinterpret_cast<_triple_byte*>(target); unsigned char val0 = _base64_dectbl[ptr[0]]; @@ -167,7 +168,7 @@ std::vector _from_base64(const utility::string_t& input) { unsigned char target[3]; - memset(target, 0, sizeof(target)); + std::memset(target, 0, sizeof(target)); _triple_byte* record = reinterpret_cast<_triple_byte*>(target); unsigned char val0 = _base64_dectbl[ptr[0]]; diff --git a/Release/src/utilities/string_utils.cpp b/Release/src/utilities/string_utils.cpp index 51751f224d..87f0edb415 100644 --- a/Release/src/utilities/string_utils.cpp +++ b/Release/src/utilities/string_utils.cpp @@ -15,6 +15,7 @@ #include +#include #include #include #include diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 35bbad6822..3d3c676863 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -191,16 +191,39 @@ jobs: cd build.debug.isolated /usr/local/bin/cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCPPREST_ISOLATE_COMPONENTS=ON .. cd .. + mkdir build.release.isolated + cd build.release.isolated + /usr/local/bin/cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCPPREST_ISOLATE_COMPONENTS=ON .. + cd .. + displayName: Run build generate + - script: | ninja -C build.debug + displayName: 'Run ninja, debug' + - script: | ninja -C build.release + displayName: 'Run ninja, release' + - script: | ninja -C build.debug.isolated + displayName: 'Run ninja, isolated debug' + - script: | + ninja -C build.release.isolated + displayName: 'Run ninja, isolated release' + - script: | cd build.debug/Release/Binaries ./test_runner *test.so - cd ../../../build.release/Release/Binaries + displayName: 'Run tests, debug' + - script: | + cd build.release/Release/Binaries ./test_runner *test.so + displayName: 'Run tests, release' + - script: | cd ../../../build.debug.isolated/Release/Binaries ./test_runner *test.so - displayName: Run build + displayName: 'Run tests, isolated debug' + - script: | + cd ../../../build.release.isolated/Release/Binaries + ./test_runner *test.so + displayName: 'Run tests, isolated release' - job: Ubuntu_1604_Vcpkg pool: vmImage: 'Ubuntu 16.04' @@ -224,6 +247,14 @@ jobs: inputs: workingDirectory: 'build.release' cmakeArgs: '-G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake ..' + - task: CMake@1 + inputs: + workingDirectory: 'build.debug.isolated' + cmakeArgs: '-G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake ..' + - task: CMake@1 + inputs: + workingDirectory: 'build.release.isolated' + cmakeArgs: '-G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake ..' - script: | cd build.debug ninja @@ -240,6 +271,22 @@ jobs: cd build.release/Release/Binaries ./test_runner *test.so displayName: 'Run tests, release' + - script: | + cd build.debug.isolated + ninja + displayName: 'Run ninja, isolated debug' + - script: | + cd build.debug.isolated/Release/Binaries + ./test_runner *test.so + displayName: 'Run Tests, isolated debug' + - script: | + cd build.release.isolated + ninja + displayName: 'Run ninja, isolated release' + - script: | + cd build.release.isolated/Release/Binaries + ./test_runner *test.so + displayName: 'Run tests, isolated release' - job: Android pool: vmImage: 'Ubuntu 16.04' From 052890e3e5b84d62eb562971d34c87adf649a8bb Mon Sep 17 00:00:00 2001 From: Jason Hartman Date: Wed, 24 Jul 2019 13:58:02 -0700 Subject: [PATCH 4/9] isolated component build fixes per Ubuntu - more explicit includes +cmake comment tweak --- Release/src/CMakeLists.txt | 4 ++-- Release/src/utilities/asyncrt_utils.cpp | 3 ++- Release/src/utilities/string_utils.cpp | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Release/src/CMakeLists.txt b/Release/src/CMakeLists.txt index 1746b490ff..3d34fc9f35 100644 --- a/Release/src/CMakeLists.txt +++ b/Release/src/CMakeLists.txt @@ -61,7 +61,7 @@ target_link_libraries(cpprest PUBLIC cpprest_interface_PUBLIC PRIVATE cpprest_in set(CPPREST_TARGETS cpprest cpprest_interface_PUBLIC) if(NOT BUILD_SHARED_LIBS) # for installed static libraries the private dependencies must also be - # installed, though those should be interfaces only. + # "installed". As an interface it should not actually impact install. list(APPEND CPPREST_TARGETS cpprest_interface_PRIVATE) endif() @@ -121,7 +121,7 @@ function(add_sub_component name) # sources... list(APPEND CPPREST_TARGETS ${name}_properties_PUBLIC) if(NOT BUILD_SHARED_LIBS) # for installed static libraries the private dependencies must also be - # installed, though those should be interfaces only. + # "installed". Should be interfaces and not actually impact install. list(APPEND CPPREST_TARGETS ${name}_properties_PRIVATE) endif() set(CPPREST_TARGETS ${CPPREST_TARGETS} PARENT_SCOPE) diff --git a/Release/src/utilities/asyncrt_utils.cpp b/Release/src/utilities/asyncrt_utils.cpp index 72f3d97c3a..849d930ff1 100644 --- a/Release/src/utilities/asyncrt_utils.cpp +++ b/Release/src/utilities/asyncrt_utils.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -306,7 +307,7 @@ utility::string_t datetime::to_string(date_format format) const leftover); #endif // _MSC_VER outCursor += 25; - memcpy(outCursor, " GMT", 4); + std::memcpy(outCursor, " GMT", 4); outCursor += 4; return utility::string_t(outBuffer, outCursor); case ISO_8601: diff --git a/Release/src/utilities/string_utils.cpp b/Release/src/utilities/string_utils.cpp index 87f0edb415..5100546a6e 100644 --- a/Release/src/utilities/string_utils.cpp +++ b/Release/src/utilities/string_utils.cpp @@ -15,6 +15,7 @@ #include +#include #include #include #include From beaa3585b8b8a9d4426686767e9b499bb985c594 Mon Sep 17 00:00:00 2001 From: Jason Hartman Date: Wed, 24 Jul 2019 15:22:38 -0700 Subject: [PATCH 5/9] compile isolated components with -fPIC --- Release/src/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Release/src/CMakeLists.txt b/Release/src/CMakeLists.txt index 3d34fc9f35..8d46b3c2c4 100644 --- a/Release/src/CMakeLists.txt +++ b/Release/src/CMakeLists.txt @@ -95,6 +95,7 @@ function(add_sub_component name) # sources... PRIVATE nopch ) + set_target_properties(${name}_objects PROPERTIES POSITION_INDEPENDENT_CODE ON) target_link_libraries(${name}_objects PRIVATE ${name}_properties_PUBLIC ${name}_properties_PRIVATE) # create library of sub-component From 164309d3e0ceeb1baddcae542190c1ec6279d2e7 Mon Sep 17 00:00:00 2001 From: Jason Hartman Date: Wed, 24 Jul 2019 16:29:46 -0700 Subject: [PATCH 6/9] include boost/asio/ssl.hpp that fileio_posix.cpp used to get from stdafx.h's include of everything The exact dependency was not reviewed when making this fix. --- Release/src/streams/fileio_posix.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Release/src/streams/fileio_posix.cpp b/Release/src/streams/fileio_posix.cpp index 2404196423..0210660a9d 100644 --- a/Release/src/streams/fileio_posix.cpp +++ b/Release/src/streams/fileio_posix.cpp @@ -19,6 +19,8 @@ #include "cpprest/details/fileio.h" +#include + using namespace boost::asio; using namespace Concurrency::streams::details; From 690b36fc4a9601d8314162a9d35f2160e2076c81 Mon Sep 17 00:00:00 2001 From: Jason Hartman Date: Thu, 25 Jul 2019 11:05:33 -0700 Subject: [PATCH 7/9] more includes per isolated Ubuntu build --- Release/src/pplx/pplxlinux.cpp | 1 + Release/src/pplx/threadpool.cpp | 1 + Release/src/streams/fileio_posix.cpp | 2 ++ 3 files changed, 4 insertions(+) diff --git a/Release/src/pplx/pplxlinux.cpp b/Release/src/pplx/pplxlinux.cpp index 630a9e477f..ac5d92ecf9 100644 --- a/Release/src/pplx/pplxlinux.cpp +++ b/Release/src/pplx/pplxlinux.cpp @@ -16,6 +16,7 @@ #include "pplx/pplx.h" #include "pplx/threadpool.h" #include "sys/syscall.h" +#include #include #ifdef _WIN32 diff --git a/Release/src/pplx/threadpool.cpp b/Release/src/pplx/threadpool.cpp index 4fbea1ed93..a2fd471945 100644 --- a/Release/src/pplx/threadpool.cpp +++ b/Release/src/pplx/threadpool.cpp @@ -10,6 +10,7 @@ #include "pplx/threadpool.h" #include +#include #include #include #include diff --git a/Release/src/streams/fileio_posix.cpp b/Release/src/streams/fileio_posix.cpp index 0210660a9d..7396bd7b93 100644 --- a/Release/src/streams/fileio_posix.cpp +++ b/Release/src/streams/fileio_posix.cpp @@ -19,7 +19,9 @@ #include "cpprest/details/fileio.h" +#include "cpprest/asyncrt_utils.h" #include +#include using namespace boost::asio; using namespace Concurrency::streams::details; From 3caf23dcfcf573b79f5a820b7413d9bf8aecbe31 Mon Sep 17 00:00:00 2001 From: Jason Hartman Date: Thu, 25 Jul 2019 15:00:45 -0700 Subject: [PATCH 8/9] last of memcpy updates for isolated components --- Release/src/json/json_parsing.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Release/src/json/json_parsing.cpp b/Release/src/json/json_parsing.cpp index b6ab5e2ac1..8dd1b0585a 100644 --- a/Release/src/json/json_parsing.cpp +++ b/Release/src/json/json_parsing.cpp @@ -17,6 +17,7 @@ #include #include +#include #if defined(_MSC_VER) #pragma warning(disable : 4127) // allow expressions like while(true) pass @@ -826,7 +827,7 @@ bool JSON_StringParser::CompleteStringLiteral(typename JSON_Parser(token.string_val.c_str() + prevSize), start, numChars * sizeof(CharType)); + std::memcpy(const_cast(token.string_val.c_str() + prevSize), start, numChars * sizeof(CharType)); if (!JSON_StringParser::handle_unescape_char(token)) { @@ -847,7 +848,7 @@ bool JSON_StringParser::CompleteStringLiteral(typename JSON_Parser(token.string_val.c_str() + prevSize), start, numChars * sizeof(CharType)); + std::memcpy(const_cast(token.string_val.c_str() + prevSize), start, numChars * sizeof(CharType)); token.kind = JSON_Parser::Token::TKN_StringLiteral; From 5bd4d98ec6827173d2a5196100c94e8fcf4016db Mon Sep 17 00:00:00 2001 From: Jason Hartman Date: Thu, 25 Jul 2019 17:11:56 -0700 Subject: [PATCH 9/9] fix yaml for Ubuntu test step breakup --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3d3c676863..7b7aa47253 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -217,11 +217,11 @@ jobs: ./test_runner *test.so displayName: 'Run tests, release' - script: | - cd ../../../build.debug.isolated/Release/Binaries + cd build.debug.isolated/Release/Binaries ./test_runner *test.so displayName: 'Run tests, isolated debug' - script: | - cd ../../../build.release.isolated/Release/Binaries + cd build.release.isolated/Release/Binaries ./test_runner *test.so displayName: 'Run tests, isolated release' - job: Ubuntu_1604_Vcpkg