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

Experimental: C++17 build #276

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
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,16 @@ include(GraphicsSample)
# ------------------------------------------------------------------------------

if(MSVC)
set(CMAKE_CXX_STANDARD 20)
# Disable the following warnings:
# 26812: unscoped enums are widely used by the project and dependencies.
set(MSVC_DISABLED_WARNINGS "/wd26812")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MSVC_DISABLED_WARNINGS} /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MSVC_DISABLED_WARNINGS} /MP /Zc:__cplusplus /std:c++20")
else()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
-std=c++20 \
-std=c++17 \
-fdiagnostics-color=always \
-Wno-nullability-completeness \
-Wno-deprecated-anon-enum-enum-conversion \
Expand All @@ -133,8 +135,6 @@ else()
endif ()
endif()

set(CMAKE_CXX_STANDARD 20)

# ------------------------------------------------------------------------------
# Configure PPX directories.
# ------------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ subprojects {
'-DPPX_BUILD_TESTS=FALSE'
}
if (project.name.contains("_xr")) {
cppFlags '-std=c++20',
cppFlags '-std=c++17',
'-DXR_USE_PLATFORM_ANDROID'
}
else {
cppFlags '-std=c++20'
cppFlags '-std=c++17'
}

if (project.hasProperty('DXC_PATH')) {
Expand Down
2 changes: 1 addition & 1 deletion include/ppx/command_line_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class CliOptions
public:
CliOptions() = default;

bool HasExtraOption(const std::string& option) const { return mAllOptions.contains(option); }
bool HasExtraOption(const std::string& option) const { return mAllOptions.find(option) != mAllOptions.end(); }

// Returns the number of unique options and flags that were specified on the commandline,
// not counting multiple appearances of the same flag such as: --assets-path a --assets-path b
Expand Down
2 changes: 1 addition & 1 deletion include/ppx/window.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct WindowSize
WindowSize(uint32_t width_, uint32_t height_)
: width(width_), height(height_) {}

bool operator==(const WindowSize&) const = default;
bool operator==(const WindowSize& other) const { return width == other.width && height == other.height; };
};

class Window
Expand Down
8 changes: 4 additions & 4 deletions src/ppx/grfx/vk/vk_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,27 +72,27 @@ Result Device::ConfigureQueueInfo(const grfx::DeviceCreateInfo* pCreateInfo, std
createdQueues.insert(mGraphicsQueueFamilyIndex);
}
// Compute
if (mComputeQueueFamilyIndex != PPX_VALUE_IGNORED && !createdQueues.contains(mComputeQueueFamilyIndex)) {
if (mComputeQueueFamilyIndex != PPX_VALUE_IGNORED && createdQueues.find(mComputeQueueFamilyIndex) == createdQueues.end()) {
VkDeviceQueueCreateInfo vkci = {VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO};
vkci.queueFamilyIndex = mComputeQueueFamilyIndex;
vkci.queueCount = pCreateInfo->pGpu->GetComputeQueueCount();
vkci.pQueuePriorities = DataPtr(queuePriorities);
queueCreateInfos.push_back(vkci);
createdQueues.insert(mComputeQueueFamilyIndex);
}
else if (createdQueues.contains(mComputeQueueFamilyIndex)) {
else if (createdQueues.find(mComputeQueueFamilyIndex) != createdQueues.end()) {
PPX_LOG_WARN("Graphics queue will be shared with compute queue.");
}
// Transfer
if (mTransferQueueFamilyIndex != PPX_VALUE_IGNORED && !createdQueues.contains(mTransferQueueFamilyIndex)) {
if (mTransferQueueFamilyIndex != PPX_VALUE_IGNORED && createdQueues.find(mTransferQueueFamilyIndex) == createdQueues.end()) {
VkDeviceQueueCreateInfo vkci = {VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO};
vkci.queueFamilyIndex = mTransferQueueFamilyIndex;
vkci.queueCount = pCreateInfo->pGpu->GetTransferQueueCount();
vkci.pQueuePriorities = DataPtr(queuePriorities);
queueCreateInfos.push_back(vkci);
createdQueues.insert(mTransferQueueFamilyIndex);
}
else if (createdQueues.contains(mTransferQueueFamilyIndex)) {
else if (createdQueues.find(mTransferQueueFamilyIndex) != createdQueues.end()) {
PPX_LOG_WARN("Transfer queue will be shared with graphics or compute queue.");
}
}
Expand Down