Skip to content

Commit

Permalink
Experimental: C++17 build
Browse files Browse the repository at this point in the history
  • Loading branch information
hysw committed Aug 21, 2023
1 parent 4bdd70e commit 181d34d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ if(MSVC)
# 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")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MSVC_DISABLED_WARNINGS} /MP /Zc:__cplusplus /std:c++17")
else()
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,7 +133,7 @@ else()
endif ()
endif()

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD 17)

# ------------------------------------------------------------------------------
# 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

0 comments on commit 181d34d

Please sign in to comment.