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

Increase cmake minimum version and CXX_STANDARD to 20 #7448

Merged
merged 7 commits into from
Feb 10, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 7 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
cmake_minimum_required(VERSION 3.8.2)
cmake_minimum_required(VERSION 3.12.4)

project(rpcs3)

if(CMAKE_COMPILER_IS_GNUCXX)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8)
message(FATAL_ERROR "RPCS3 requires at least gcc-8.")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9)
message(FATAL_ERROR "RPCS3 requires at least gcc-9.")
endif()
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
message(FATAL_ERROR "RPCS3 requires at least clang-5.0.")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
message(FATAL_ERROR "RPCS3 requires at least clang-10.0.")
endif()
endif()

Expand All @@ -22,14 +22,11 @@ option(USE_LIBEVDEV "libevdev-based joystick support" ON)
option(USE_DISCORD_RPC "Discord rich presence integration" ON)
option(USE_SYSTEM_ZLIB "Prefer system ZLIB instead of the builtin one" ON)
option(USE_VULKAN "Vulkan render backend" ON)
option(USE_COTIRE "Use precompiled headers" ON)

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/rpcs3/cmake_modules")

if (MSVC)
set(CMAKE_CXX_STANDARD 20)
else()
set(CMAKE_CXX_STANDARD 17)
endif()
set(CMAKE_CXX_STANDARD 20)
include(CheckCXXCompilerFlag)

if (NOT CMAKE_BUILD_TYPE)
Expand Down
24 changes: 20 additions & 4 deletions Utilities/geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,18 @@ struct size2_base
return *this;
}

constexpr bool operator == (const size2_base& rhs) const
constexpr bool operator ==(const size2_base& rhs) const
{
return width == rhs.width && height == rhs.height;
}

constexpr bool operator != (const size2_base& rhs) const
#if __cpp_impl_three_way_comparison >= 201711
#else
constexpr bool operator !=(const size2_base& rhs) const
{
return width != rhs.width || height != rhs.height;
}
#endif

template<typename NT>
constexpr operator size2_base<NT>() const
Expand Down Expand Up @@ -644,10 +647,13 @@ struct coord_base
return position == rhs.position && size == rhs.size;
}

#if __cpp_impl_three_way_comparison >= 201711
#else
constexpr bool operator != (const coord_base& rhs) const
{
return position != rhs.position || size != rhs.size;
}
#endif

template<typename NT>
constexpr operator coord_base<NT>() const
Expand Down Expand Up @@ -876,11 +882,13 @@ struct color4_base
{
return r == rhs.r && g == rhs.g && b == rhs.b && a == rhs.a;
}

#if __cpp_impl_three_way_comparison >= 201711
#else
constexpr bool operator != (const color4_base& rhs) const
{
return !(*this == rhs);
}
#endif

void operator *= (const color4_base<T>& rhs)
{
Expand Down Expand Up @@ -950,11 +958,13 @@ struct color3_base
{
return r == rhs.r && g == rhs.g && b == rhs.b;
}

#if __cpp_impl_three_way_comparison >= 201711
#else
constexpr bool operator != (const color3_base& rhs) const
{
return !(*this == rhs);
}
#endif

template<typename NT>
constexpr operator color3_base<NT>() const
Expand Down Expand Up @@ -993,10 +1003,13 @@ struct color2_base
return r == rhs.r && g == rhs.g;
}

#if __cpp_impl_three_way_comparison >= 201711
#else
constexpr bool operator != (const color2_base& rhs) const
{
return !(*this == rhs);
}
#endif

template<typename NT>
constexpr operator color2_base<NT>() const
Expand Down Expand Up @@ -1024,10 +1037,13 @@ struct color1_base
return r == rhs.r;
}

#if __cpp_impl_three_way_comparison >= 201711
#else
constexpr bool operator != (const color1_base& rhs) const
{
return !(*this == rhs);
}
#endif

template<typename NT>
constexpr operator color1_base<NT>() const
Expand Down
2 changes: 1 addition & 1 deletion llvm
10 changes: 6 additions & 4 deletions rpcs3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,13 @@ else()
target_link_libraries(rpcs3 ${CMAKE_DL_LIBS})
endif()

set_target_properties(rpcs3 PROPERTIES
COTIRE_CXX_PREFIX_HEADER_INIT "${RPCS3_SRC_DIR}/stdafx.h"
COTIRE_ADD_UNITY_BUILD OFF)
if(USE_COTIRE)
set_target_properties(rpcs3 PROPERTIES
COTIRE_CXX_PREFIX_HEADER_INIT "${RPCS3_SRC_DIR}/stdafx.h"
COTIRE_ADD_UNITY_BUILD OFF)

cotire(rpcs3)
cotire(rpcs3)
endif()

# Copy icons to executable directory
if(APPLE)
Expand Down
14 changes: 8 additions & 6 deletions rpcs3/Emu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -431,11 +431,13 @@ target_link_libraries(rpcs3_emu
)


# Setup cotire
option(UNITY_BUILD_EMU "Use unity build for rpcs3_emu target" OFF)
if (USE_COTIRE)
# Setup cotire
option(UNITY_BUILD_EMU "Use unity build for rpcs3_emu target" OFF)

set_target_properties(rpcs3_emu PROPERTIES
COTIRE_CXX_PREFIX_HEADER_INIT "${RPCS3_SRC_DIR}/stdafx.h"
COTIRE_ADD_UNITY_BUILD ${UNITY_BUILD_EMU})
set_target_properties(rpcs3_emu PROPERTIES
COTIRE_CXX_PREFIX_HEADER_INIT "${RPCS3_SRC_DIR}/stdafx.h"
COTIRE_ADD_UNITY_BUILD ${UNITY_BUILD_EMU})

cotire(rpcs3_emu)
cotire(rpcs3_emu)
endif()