Skip to content
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

Add support for VS 2019 #125

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 1.0.{build}

image:
- Visual Studio 2017
- Visual Studio 2017 Preview
- Visual Studio 2019

platform:
- x64
Expand Down
7 changes: 4 additions & 3 deletions config.cake
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ if cake.system.isWindows() or cake.system.isCygwin():

for arch in ("x64", "x86"):
try:
from cake.library.compilers.msvc import getVisualStudio2017Compiler, findMsvc2017InstallDir
from cake.library.compilers.msvc import getVisualStudioCompiler, findMsvcInstallDir
if nugetPath:
vcInstallDir = cake.path.join(nugetPath, 'lib', 'native')
else:
vcInstallDir = str(findMsvc2017InstallDir(targetArchitecture=arch, allowPreRelease=True))
compiler = getVisualStudio2017Compiler(
vcInstallDir = str(findMsvcInstallDir(targetArchitecture=arch, allowPreRelease=True))
compiler = getVisualStudioCompiler(
configuration,
targetArchitecture=arch,
vcInstallDir=vcInstallDir,
Expand Down Expand Up @@ -116,6 +116,7 @@ if cake.system.isWindows() or cake.system.isCygwin():

# Enable C++17 features like std::optional<>
compiler.addCppFlag('/std:c++latest')
compiler.addCppFlag('/permissive-')

compiler.addDefine('_SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING')

Expand Down
5 changes: 2 additions & 3 deletions include/cppcoro/file.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
#include <cppcoro/file_open_mode.hpp>
#include <cppcoro/file_share_mode.hpp>
#include <cppcoro/file_buffering_mode.hpp>
#include <cppcoro/path.hpp>

#if CPPCORO_OS_WINNT
# include <cppcoro/detail/win32.hpp>
#endif

#include <experimental/filesystem>

namespace cppcoro
{
class io_service;
Expand All @@ -40,7 +39,7 @@ namespace cppcoro
static detail::win32::safe_handle open(
detail::win32::dword_t fileAccess,
io_service& ioService,
const std::experimental::filesystem::path& path,
const cppcoro::path& path,
file_open_mode openMode,
file_share_mode shareMode,
file_buffering_mode bufferingMode);
Expand Down
23 changes: 23 additions & 0 deletions include/cppcoro/path.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) Lewis Baker
// Licenced under MIT license. See LICENSE.txt for details.
///////////////////////////////////////////////////////////////////////////////
#ifndef CPPCORO_PATH_HPP_INCLUDED
#define CPPCORO_PATH_HPP_INCLUDED

#if __has_include(<filesystem>)
# include <filesystem>
#else
# include <experimental/filesystem>
#endif

namespace cppcoro
{
#if __cpp_lib_filesystem >= 201703L
using path = std::filesystem::path;
#else
using path = std::experimental::filesystem::path;
#endif
}

#endif
5 changes: 2 additions & 3 deletions include/cppcoro/read_only_file.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
#include <cppcoro/readable_file.hpp>
#include <cppcoro/file_share_mode.hpp>
#include <cppcoro/file_buffering_mode.hpp>

#include <experimental/filesystem>
#include <cppcoro/path.hpp>

namespace cppcoro
{
Expand Down Expand Up @@ -43,7 +42,7 @@ namespace cppcoro
[[nodiscard]]
static read_only_file open(
io_service& ioService,
const std::experimental::filesystem::path& path,
const cppcoro::path& path,
file_share_mode shareMode = file_share_mode::read,
file_buffering_mode bufferingMode = file_buffering_mode::default_);

Expand Down
5 changes: 2 additions & 3 deletions include/cppcoro/read_write_file.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#include <cppcoro/file_share_mode.hpp>
#include <cppcoro/file_buffering_mode.hpp>
#include <cppcoro/file_open_mode.hpp>

#include <experimental/filesystem>
#include <cppcoro/path.hpp>

namespace cppcoro
{
Expand Down Expand Up @@ -49,7 +48,7 @@ namespace cppcoro
[[nodiscard]]
static read_write_file open(
io_service& ioService,
const std::experimental::filesystem::path& path,
const cppcoro::path& path,
file_open_mode openMode = file_open_mode::create_or_open,
file_share_mode shareMode = file_share_mode::none,
file_buffering_mode bufferingMode = file_buffering_mode::default_);
Expand Down
5 changes: 2 additions & 3 deletions include/cppcoro/write_only_file.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#include <cppcoro/file_share_mode.hpp>
#include <cppcoro/file_buffering_mode.hpp>
#include <cppcoro/file_open_mode.hpp>

#include <experimental/filesystem>
#include <cppcoro/path.hpp>

namespace cppcoro
{
Expand Down Expand Up @@ -48,7 +47,7 @@ namespace cppcoro
[[nodiscard]]
static write_only_file open(
io_service& ioService,
const std::experimental::filesystem::path& path,
const cppcoro::path& path,
file_open_mode openMode = file_open_mode::create_or_open,
file_share_mode shareMode = file_share_mode::none,
file_buffering_mode bufferingMode = file_buffering_mode::default_);
Expand Down
2 changes: 1 addition & 1 deletion lib/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ cppcoro::file::file(detail::win32::safe_handle&& fileHandle) noexcept
cppcoro::detail::win32::safe_handle cppcoro::file::open(
detail::win32::dword_t fileAccess,
io_service& ioService,
const std::experimental::filesystem::path& path,
const cppcoro::path& path,
file_open_mode openMode,
file_share_mode shareMode,
file_buffering_mode bufferingMode)
Expand Down
2 changes: 1 addition & 1 deletion lib/read_only_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

cppcoro::read_only_file cppcoro::read_only_file::open(
io_service& ioService,
const std::experimental::filesystem::path& path,
const cppcoro::path& path,
file_share_mode shareMode,
file_buffering_mode bufferingMode)
{
Expand Down
2 changes: 1 addition & 1 deletion lib/read_write_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

cppcoro::read_write_file cppcoro::read_write_file::open(
io_service& ioService,
const std::experimental::filesystem::path& path,
const cppcoro::path& path,
file_open_mode openMode,
file_share_mode shareMode,
file_buffering_mode bufferingMode)
Expand Down
2 changes: 1 addition & 1 deletion lib/write_only_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

cppcoro::write_only_file cppcoro::write_only_file::open(
io_service& ioService,
const std::experimental::filesystem::path& path,
const cppcoro::path& path,
file_open_mode openMode,
file_share_mode shareMode,
file_buffering_mode bufferingMode)
Expand Down