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

MSVC C++20 Support #126

Merged
merged 20 commits into from
Nov 13, 2024
Merged
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
28 changes: 20 additions & 8 deletions .github/matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,52 @@
"compiler": "gcc",
"version": "11",
"os": "ubuntu-22.04",
"cxxstd" : "17"
"cxxstd": "17"
},
{
"name": "Linux GCC 11 C++20",
"compiler": "gcc",
"version": "11",
"os": "ubuntu-22.04",
"cxxstd" : "20"
"cxxstd": "20"
},
{
"name": "Linux Clang 14 C++17",
"compiler": "clang",
"version": "14",
"os": "ubuntu-22.04",
"cxxstd" : "17"
"cxxstd": "17"
},
{
"name": "Linux Clang 14 C++20",
"compiler": "clang",
"version": "14",
"os": "ubuntu-22.04",
"cxxstd" : "20"
"cxxstd": "20"
},
{
"name": "macOS apple-clang 14.3.1",
"name": "macOS apple-clang 14.3.1 C++17",
"compiler": "apple-clang",
"version": "14.3.1",
"os": "macos-13",
"cxxstd" : "17"
"cxxstd": "17"
},
{
"name": "Windows VS2022",
"name": "macOS apple-clang 14.3.1 C++20",
"compiler": "apple-clang",
"version": "14.3.1",
"os": "macos-13",
"cxxstd": "20"
},
{
"name": "Windows VS2022 C++17",
"os": "windows-2022",
"cxxstd": "17"
},
{
"name": "Windows VS2022 C++20",
"os": "windows-2022",
"cxxstd" : "17"
"cxxstd": "20"
}
]
}
8 changes: 4 additions & 4 deletions .github/workflows/adobe_source_libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Generate job matrix
id: set-matrix
Expand All @@ -32,7 +32,7 @@ jobs:
name: ${{ matrix.config.name }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install dependencies (macos)
if: ${{ startsWith(matrix.config.os, 'macos') }}
Expand Down Expand Up @@ -109,15 +109,15 @@ jobs:
shell: bash
run: |
mkdir ../build
cmake -S. -B../build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17
cmake -S. -B../build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=${{matrix.config.cxxstd}}
- name: Configure (Windows)
if: ${{ startsWith(matrix.config.os, 'windows') }}
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
mkdir ..\build
cmake -S. -B../build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DBOOST_TEST_DYN_LINK=TRUE
cmake -S. -B../build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=${{matrix.config.cxxstd}} -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DBOOST_TEST_DYN_LINK=TRUE
- name: Build (Unix)
if: ${{ startsWith(matrix.config.os, 'ubuntu') || startsWith(matrix.config.os, 'macos') }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ gh-pages/

documentation/doxyfile.bak
build_asl/
.vs/
.vscode/
20 changes: 0 additions & 20 deletions .vscode/c_cpp_properties.json

This file was deleted.

136 changes: 0 additions & 136 deletions .vscode/settings.json

This file was deleted.

5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.29)
include(FindGit)
include(CMakeParseArguments)
enable_testing()
Expand All @@ -7,8 +7,7 @@ project(adobe_source_libraries CXX)

set(CMAKE_CXX_EXTENSIONS OFF)
if(NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++17")
set(CMAKE_CXX_STANDARD 20)
endif(NOT DEFINED CMAKE_CXX_STANDARD)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to assume that dropping the Xcode setting is intentional and correct.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It isn't needed.


set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
Expand Down
44 changes: 38 additions & 6 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,51 @@
"configurePresets": [
{
"name": "debug",
"displayName": "Custom configure preset",
"displayName": "debug-windows",
"description": "Sets Ninja generator, build and install directory",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_CXX_STANDARD": "20",
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}",
"VCPKG_TARGET_TRIPLET": "x64-windows"
},
"architecture": {
"value": "x64",
"strategy": "external"
},
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this toolchain requires vcpkg? Is that dependency documented in the README? If not you better do that.
Is how to use the presets documented?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The system is currently using vcpkg to pull in boost. It's undocumented, and I'd like to get rid of it in favor of fetch content, but not in this PR.

"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"hostOS": [
"Windows"
]
}
}
},
{
"name": "debug-windows-cpp17",
"displayName": "debug-windows-cpp17",
"description": "Sets Ninja generator, build and install directory",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_CXX_STANDARD": "17",
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}",
"VCPKG_TARGET_TRIPLET": "x64-windows"
},
"architecture": {
"value": "x64",
"strategy": "external"
},
"toolchainFile": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake",
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"hostOS": [ "Windows" ]
"hostOS": [
"Windows"
]
}
}
},
Expand All @@ -36,7 +64,9 @@
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"hostOS": [ "macOS" ]
"hostOS": [
"macOS"
]
}
}
},
Expand All @@ -53,14 +83,16 @@
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"hostOS": [ "macOS" ]
"hostOS": [
"macOS"
]
}
}
}
],
"buildPresets": [
{
"name": "debug",
"name": "debug-windows",
"description": "",
"displayName": "",
"configurePreset": "debug"
Expand Down
32 changes: 32 additions & 0 deletions adobe/algorithm/append.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
Copyright 2024 Adobe
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
/**************************************************************************************************/

#ifndef ADOBE_ALGORITHM_APPEND_HPP
#define ADOBE_ALGORITHM_APPEND_HPP

#include <iterator>

/**************************************************************************************************/

namespace adobe {

/**************************************************************************************************/

/// Insert the elements of _input_range_ `r` at the end of the _sequence container_ `c`,
/// returning the position corresponding to the incoming `end` of `c`.
template <class T, class R>
inline auto append(T& c, const R& r) {
return c.insert(std::end(c), std::begin(r), std::end(r));
}

/**************************************************************************************************/

} // namespace adobe

/**************************************************************************************************/

#endif
Loading
Loading