Skip to content

Mingw-w64 compilation support: #1832

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions aws-cpp-sdk-core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ elseif(ENABLE_WINDOWS_CLIENT)
# https://docs.microsoft.com/en-us/windows/desktop/WinHttp/option-flags#WINHTTP_OPTION_ENABLE_HTTP_PROTOCOL
set(CMAKE_REQUIRED_LIBRARIES "WinHttp.lib")
check_cxx_source_runs("
#include <Windows.h>
#include <windows.h>
#include <winhttp.h>
int main() {

Expand All @@ -167,7 +167,7 @@ elseif(ENABLE_WINDOWS_CLIENT)

set(CMAKE_REQUIRED_LIBRARIES "Wininet.lib")
check_cxx_source_runs("
#include <Windows.h>
#include <windows.h>
#include <WinInet.h>
int main() {
auto handle = InternetOpenA(\"aws-cpp-sdk\"/*lpszAgent*/,
Expand Down
12 changes: 6 additions & 6 deletions aws-cpp-sdk-core/include/aws/core/utils/Array.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
#include <cstring>
#include <algorithm>

#ifdef _WIN32
#ifdef _MSC_VER

#include <iterator>

#endif // _WIN32
#endif // _MSC_VER

namespace Aws
{
Expand Down Expand Up @@ -54,7 +54,7 @@ namespace Aws
{
m_data.reset(Aws::NewArray<T>(m_size, ARRAY_ALLOCATION_TAG));

#ifdef _WIN32
#ifdef _MSC_VER
std::copy(arrayToCopy, arrayToCopy + arraySize, stdext::checked_array_iterator< T * >(m_data.get(), m_size));
#else
std::copy(arrayToCopy, arrayToCopy + arraySize, m_data.get());
Expand Down Expand Up @@ -82,7 +82,7 @@ namespace Aws
if(arr->m_size > 0 && arr->m_data)
{
size_t arraySize = arr->m_size;
#ifdef _WIN32
#ifdef _MSC_VER
std::copy(arr->m_data.get(), arr->m_data.get() + arraySize, stdext::checked_array_iterator< T * >(m_data.get() + location, m_size));
#else
std::copy(arr->m_data.get(), arr->m_data.get() + arraySize, m_data.get() + location);
Expand All @@ -101,7 +101,7 @@ namespace Aws
{
m_data.reset(Aws::NewArray<T>(m_size, ARRAY_ALLOCATION_TAG));

#ifdef _WIN32
#ifdef _MSC_VER
std::copy(other.m_data.get(), other.m_data.get() + other.m_size, stdext::checked_array_iterator< T * >(m_data.get(), m_size));
#else
std::copy(other.m_data.get(), other.m_data.get() + other.m_size, m_data.get());
Expand Down Expand Up @@ -134,7 +134,7 @@ namespace Aws
{
m_data.reset(Aws::NewArray<T>(m_size, ARRAY_ALLOCATION_TAG));

#ifdef _WIN32
#ifdef _MSC_VER
std::copy(other.m_data.get(), other.m_data.get() + other.m_size, stdext::checked_array_iterator< T * >(m_data.get(), m_size));
#else
std::copy(other.m_data.get(), other.m_data.get() + other.m_size, m_data.get());
Expand Down
4 changes: 4 additions & 0 deletions aws-cpp-sdk-core/include/aws/core/utils/json/JsonSerializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@

#include <utility>

#ifdef GetObject
#undef GetObject
#endif

namespace Aws
{
namespace Utils
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <aws/core/http/windows/WinConnectionPoolMgr.h>
#include <aws/core/utils/logging/LogMacros.h>
#include <aws/core/utils/memory/AWSMemory.h>
#include <Windows.h>
#include <windows.h>
#include <algorithm>

using namespace Aws::Utils::Logging;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <aws/core/utils/StringUtils.h>

#include <Windows.h>
#include <windows.h>
#include <winhttp.h>

using namespace Aws::Http;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <aws/core/utils/ratelimiter/RateLimiterInterface.h>
#include <aws/core/utils/UnreferencedParam.h>

#include <Windows.h>
#include <windows.h>
#include <winhttp.h>
#include <sstream>
#include <iostream>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

#include <aws/core/http/windows/WinINetConnectionPoolMgr.h>
#include <Windows.h>
#include <windows.h>
#include <WinInet.h>

using namespace Aws::Http;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <aws/core/utils/ratelimiter/RateLimiterInterface.h>
#include <aws/core/utils/UnreferencedParam.h>

#include <Windows.h>
#include <windows.h>
#include <WinInet.h>
#include <sstream>
#include <iostream>
Expand Down
2 changes: 1 addition & 1 deletion aws-cpp-sdk-core/source/http/windows/WinSyncHttpClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <aws/core/utils/memory/stl/AWSStreamFwd.h>
#include <aws/core/utils/ratelimiter/RateLimiterInterface.h>

#include <Windows.h>
#include <windows.h>
#include <sstream>
#include <iostream>

Expand Down
5 changes: 5 additions & 0 deletions aws-cpp-sdk-core/source/internal/AWSHttpResourceClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ static const char EC2_METADATA_CLIENT_LOG_TAG[] = "EC2MetadataClient";
static const char ECS_CREDENTIALS_CLIENT_LOG_TAG[] = "ECSCredentialsClient";
static const char SSO_GET_ROLE_RESOURCE[] = "/federation/credentials";

//undef winapi
#ifdef GetObject
#undef GetObject
#endif

namespace Aws
{
namespace Client
Expand Down
4 changes: 4 additions & 0 deletions aws-cpp-sdk-core/source/monitoring/MonitoringManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
#pragma warning(disable : 4592)
#endif

#ifdef interface
#undef interface
#endif

namespace Aws
{
namespace Monitoring
Expand Down
2 changes: 1 addition & 1 deletion aws-cpp-sdk-core/source/net/windows/Net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0.
*/

#include <WinSock2.h>
#include <winsock2.h>
#include <cassert>
#include <aws/core/utils/logging/LogMacros.h>

Expand Down
6 changes: 3 additions & 3 deletions aws-cpp-sdk-core/source/net/windows/SimpleUDP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* SPDX-License-Identifier: Apache-2.0.
*/

#include <WinSock2.h>
#include <Ws2ipdef.h>
#include <Ws2tcpip.h>
#include <winsock2.h>
#include <ws2ipdef.h>
#include <ws2tcpip.h>
#include <cassert>
#include <aws/core/net/SimpleUDP.h>
#include <aws/core/utils/logging/LogMacros.h>
Expand Down
4 changes: 3 additions & 1 deletion aws-cpp-sdk-core/source/platform/windows/FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
#include <aws/core/utils/StringUtils.h>
#include <cassert>
#include <iostream>
#include <Userenv.h>
#include <userenv.h>

#ifdef _MSC_VER
#pragma warning( disable : 4996)
#endif

using namespace Aws::Utils;
namespace Aws
Expand Down
2 changes: 2 additions & 0 deletions aws-cpp-sdk-core/source/platform/windows/OSVersionInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

#include <iomanip>

#ifdef _MSC_VER
#pragma warning(disable: 4996)
#endif
#include <windows.h>
#include <stdio.h>
namespace Aws
Expand Down
4 changes: 4 additions & 0 deletions aws-cpp-sdk-core/source/utils/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/json/JsonSerializer.h>

#ifdef GetObject
#undef GetObject
#endif

using namespace Aws::Utils;

Document::Document() : m_wasParseSuccessful(true)
Expand Down
2 changes: 1 addition & 1 deletion aws-cpp-sdk-core/source/utils/StringUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <functional>

#ifdef _WIN32
#include <Windows.h>
#include <windows.h>
#endif

using namespace Aws::Utils;
Expand Down
4 changes: 2 additions & 2 deletions aws-cpp-sdk-core/source/utils/crypto/factory/Factories.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ std::shared_ptr<Aws::Utils::Crypto::HMAC> Aws::Utils::Crypto::CreateSha256HMACIm
return GetSha256HMACFactory()->CreateImplementation();
}

#ifdef _WIN32
#ifdef _MSC_VER
#pragma warning( push )
#pragma warning( disable : 4702 )
#endif
Expand Down Expand Up @@ -961,7 +961,7 @@ std::shared_ptr<SymmetricCipher> Aws::Utils::Crypto::CreateAES_KeyWrapImplementa
return GetAES_KeyWrapFactory()->CreateImplementation(key);
}

#ifdef _WIN32
#ifdef _MSC_VER
#pragma warning(pop)
#endif

Expand Down
4 changes: 4 additions & 0 deletions aws-cpp-sdk-core/source/utils/json/JsonSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/Document.h>

#ifdef GetObject
#undef GetObject
#endif

using namespace Aws::Utils;
using namespace Aws::Utils::Json;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include <mutex>

#include <Windows.h>
#include <windows.h>

namespace Aws
{
Expand Down
3 changes: 2 additions & 1 deletion cmake/compiler_settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ function(set_compiler_warnings target)
endif()
endfunction()

check_c_compiler_flag(-fPIC HAS_FPIC_FLAG)

macro(set_gcc_flags)
list(APPEND AWS_COMPILER_FLAGS "-fno-exceptions" "-std=c++${CPP_STANDARD}")

if(NOT BUILD_SHARED_LIBS)
if(NOT BUILD_SHARED_LIBS AND HAS_FPIC_FLAG)
list(APPEND AWS_COMPILER_FLAGS "-fPIC")
endif()

Expand Down