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

Enable C++ 20 standard globally #1257

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
5 changes: 3 additions & 2 deletions bldsys/cmake/global_options.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[[
Copyright (c) 2019-2024, Arm Limited and Contributors
Copyright (c) 2019-2025, Arm Limited and Contributors

SPDX-License-Identifier: Apache-2.0

Expand Down Expand Up @@ -122,7 +122,8 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "bin/${CMAKE_BUILD_TYPE}/${TARGET_ARCH}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "lib/${CMAKE_BUILD_TYPE}/${TARGET_ARCH}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "lib/${CMAKE_BUILD_TYPE}/${TARGET_ARCH}")

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)

Expand Down
4 changes: 2 additions & 2 deletions components/core/include/core/util/error.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023-2024, Thomas Atkinson
/* Copyright (c) 2023-2025, Thomas Atkinson
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -58,7 +58,7 @@
template <typename... Args>
inline void ERRORF(const std::string &format, Args &&...args)
{
throw std::runtime_error(fmt::format(format, std::forward<Args>(args)...));
throw std::runtime_error(fmt::vformat(format, fmt::make_format_args(args...)));
}

inline void ERRORF(const std::string &message)
Expand Down
3 changes: 1 addition & 2 deletions components/ios/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2023-2024, Thomas Atkinson
# Copyright (c) 2023-2025, Thomas Atkinson
#
# SPDX-License-Identifier: Apache-2.0
#
Expand Down Expand Up @@ -39,4 +39,3 @@ vkb__register_tests(

# attach to core
target_link_libraries(vkb__core INTERFACE vkb__ios_platform)
target_compile_features(vkb__core PUBLIC cxx_std_17)
7 changes: 4 additions & 3 deletions framework/gui.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Copyright (c) 2018-2024, Arm Limited and Contributors
* Copyright (c) 2019-2024, Sascha Willems
/* Copyright (c) 2018-2025, Arm Limited and Contributors
* Copyright (c) 2019-2025, Sascha Willems
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -922,7 +922,8 @@ void Gui::show_stats(const Stats &stats)
// Check if the stat is available in the current platform
if (stats.is_available(stat_index))
{
graph_label << fmt::format(graph_data.name + ": " + graph_data.format, avg * graph_data.scale_factor);
auto graph_value = avg * graph_data.scale_factor;
graph_label << fmt::vformat(graph_data.name + ": " + graph_data.format, fmt::make_format_args(graph_value));
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PlotLines("", &graph_elements[0], static_cast<int>(graph_elements.size()), 0, graph_label.str().c_str(), graph_min, graph_max, graph_size);
ImGui::PopItemFlag();
Expand Down
5 changes: 3 additions & 2 deletions framework/hpp_gui.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023-2024, NVIDIA CORPORATION. All rights reserved.
/* Copyright (c) 2023-2025, NVIDIA CORPORATION. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -869,7 +869,8 @@ void HPPGui::show_stats(const vkb::stats::HPPStats &stats)
// Check if the stat is available in the current platform
if (stats.is_available(stat_index))
{
graph_label << fmt::format(graph_data.name + ": " + graph_data.format, avg * graph_data.scale_factor);
auto graph_value = avg * graph_data.scale_factor;
graph_label << fmt::vformat(graph_data.name + ": " + graph_data.format, fmt::make_format_args(graph_value));
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PlotLines("", &graph_elements[0], static_cast<int>(graph_elements.size()), 0, graph_label.str().c_str(), graph_min, graph_max, graph_size);
ImGui::PopItemFlag();
Expand Down
4 changes: 2 additions & 2 deletions framework/platform/platform.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2019-2024, Arm Limited and Contributors
/* Copyright (c) 2019-2025, Arm Limited and Contributors
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -202,7 +202,7 @@ void Platform::update()
delta_time = simulation_frame_time;
}

active_app->update_overlay(delta_time, [=]() {
active_app->update_overlay(delta_time, [=, this]() {
on_update_ui_overlay(*active_app->get_drawer());
});
active_app->update(delta_time);
Expand Down
4 changes: 2 additions & 2 deletions framework/rendering/hpp_render_frame.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023-2024, NVIDIA CORPORATION. All rights reserved.
/* Copyright (c) 2023-2025, NVIDIA CORPORATION. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -61,7 +61,7 @@ vkb::BufferAllocationCpp HPPRenderFrame::allocate_buffer(const vk::BufferUsageFl
auto buffer_pool_it = buffer_pools.find(usage);
if (buffer_pool_it == buffer_pools.end())
{
LOGE("No buffer pool for buffer usage " + vk::to_string(usage));
LOGE("No buffer pool for buffer usage{} ", vk::to_string(usage));
return vkb::BufferAllocationCpp{};
}

Expand Down
4 changes: 1 addition & 3 deletions samples/api/hello_triangle_1_3/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2024, Huawei Technologies Co., Ltd.
# Copyright (c) 2024-2025, Huawei Technologies Co., Ltd.
#
# SPDX-License-Identifier: Apache-2.0
#
Expand All @@ -14,8 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

get_filename_component(FOLDER_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
Expand Down
6 changes: 3 additions & 3 deletions samples/extensions/open_cl_interop/open_cl_interop.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023-2024, Sascha Willems
/* Copyright (c) 2023-2025, Sascha Willems
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -857,8 +857,8 @@ void OpenCLInterop::prepare_opencl_resources()

if ((selected_platform_id == nullptr) || (selected_device_id == nullptr))
{
const std::string message{"Could not find an OpenCL platform + device that matches the required extensions and also matches the Vulkan device UUID "};
LOGE(message);
const std::string message{"Could not find an OpenCL platform + device that matches the required extensions and also matches the Vulkan device UUID"};
LOGE("{}", message);
throw std::runtime_error(message);
}

Expand Down
Loading