Skip to content

Commit

Permalink
Really careless update to C++20
Browse files Browse the repository at this point in the history
  • Loading branch information
mmertama committed Sep 7, 2024
1 parent 8f920e7 commit edb0be3
Show file tree
Hide file tree
Showing 22 changed files with 39 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ For the application, Gempyre let engine to be implemented using C++ (or Python),

Gempyre is intended for applications that has a solid C++ core (or C), and allows rapid UI development without extra hassle with platform specific UI development.

Gempyre is multiplatform, its core is written using C++17 (tested on OSX (CLang), Ubuntu (gcc), Raspberry OS (gcc) and Windows 10 (MSVC and MinGW) ). The Gempyre framework can be downloaded at Github under MIT license.
Gempyre is multiplatform, its core is built using C++20 (tested on OSX (CLang), Ubuntu (gcc), Raspberry OS (gcc) and Windows 10 (MSVC and MinGW) ). The Gempyre framework can be downloaded at Github under MIT license.

Gempyre itself does not contain an application window. The UI is drawn using external application. Some OSes defaults to system browser, some Python webview. However that is fully configurable per application.

Expand Down
2 changes: 1 addition & 1 deletion affiliates/test_rpc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 3.18)
set(NAME affiliates_test_rpc)
project (${NAME})

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

include_directories(
../../gempyrelib/include
Expand Down
2 changes: 1 addition & 1 deletion examples/audio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required (VERSION 3.18)
set(NAME audio)
project (${NAME}test)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

include_directories(
../../gempyrelib/include
Expand Down
2 changes: 1 addition & 1 deletion examples/dialogs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
set(NAME dialogs_test)
project (${NAME})

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

include_directories(
../../gempyrelib/include
Expand Down
2 changes: 1 addition & 1 deletion examples/drawcanvas/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ project (${NAME}test)

include(../../scripts/gempyre.cmake)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

include_directories(
../../gempyrelib/include)
Expand Down
2 changes: 1 addition & 1 deletion examples/eval/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required (VERSION 3.18)
set(NAME eval)
project (${NAME}test)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

include_directories(
../../gempyrelib/include
Expand Down
2 changes: 1 addition & 1 deletion examples/fire/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required (VERSION 3.18)
set(NAME fire)
project (${NAME})

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

include_directories(
../../gempyrelib/include
Expand Down
2 changes: 1 addition & 1 deletion examples/flakes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ project (${NAME}test)

include(../../scripts/gempyre.cmake)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

include_directories(
../../gempyrelib/include
Expand Down
2 changes: 1 addition & 1 deletion examples/hello/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required (VERSION 3.18)
set(NAME hello)
project (${NAME})

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

include_directories(
../../gempyrelib/include
Expand Down
2 changes: 1 addition & 1 deletion examples/hello2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required (VERSION 3.18)
set(NAME hello2)
project (${NAME})

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

include_directories(
../../gempyrelib/include
Expand Down
2 changes: 1 addition & 1 deletion examples/helloworld/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 3.18)

project (helloworld)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

include_directories(
../../gempyrelib/include
Expand Down
2 changes: 1 addition & 1 deletion examples/imageblit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ project (${NAME}test)

include(../../scripts/gempyre.cmake)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

include_directories(
../../gempyrelib/include
Expand Down
2 changes: 1 addition & 1 deletion examples/minihello/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required (VERSION 3.18)
set(NAME minihello)
project (${NAME})

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

include_directories(
../../gempyrelib/include
Expand Down
2 changes: 1 addition & 1 deletion examples/snowflakes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ project (${NAME}test)

include(../../scripts/gempyre.cmake)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

include_directories(
../../gempyrelib/include
Expand Down
6 changes: 3 additions & 3 deletions examples/tick/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ cmake_minimum_required (VERSION 3.18)
set(NAME tick)
project (${NAME})

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

if(MSVC)
if (MSVC_VERSION GREATER_EQUAL "1900")
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("/std:c++17" _cpp_latest_flag_supported)
CHECK_CXX_COMPILER_FLAG("/std:c++20" _cpp_latest_flag_supported)
if (_cpp_latest_flag_supported)
add_compile_options("/std:c++17")
add_compile_options("/std:c++20")
endif()
endif()
endif()
Expand Down
4 changes: 2 additions & 2 deletions gempyrelib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#cmake_minimum_required (VERSION 3.18)


project (gempyre VERSION 1.4.2 LANGUAGES CXX C)
project (gempyre VERSION 1.5.0 LANGUAGES CXX C)
# Must use GNUInstallDirs to install libraries into correct
# locations on all platforms.
include(GNUInstallDirs)
Expand Down Expand Up @@ -210,7 +210,7 @@ else()
endif()
endif()

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_definitions(_GLIBCXX_DEBUG)
Expand Down
15 changes: 15 additions & 0 deletions gempyrelib/include/gempyre_bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,24 @@ namespace Gempyre {

/// underlaying data
const uint8_t* const_data() const;

/// @brief Copy pixels into bitmap
/// @param bytes (TODO will change to std::span when moving to C++20)
/// @param offset
/// @return false on overflow, otherwise true
template<class T, std::enable_if_t<std::is_same_v<typename T::value_type, Color::type>, int> = 0>
bool set_data(const T& bytes, size_t offset = 0) {
if(bytes.size() + offset > size())
return false;
std::memcpy(inner_data() + offset, bytes.data(), sizeof(Color::type) * bytes.size());
return true;
}

protected:
/// @cond INTERNAL
void copy_from(const Bitmap& other);
Color::type* inner_data();
std::size_t size() const;
/// @endcond
private:
friend class Gempyre::CanvasElement;
Expand Down
2 changes: 1 addition & 1 deletion scripts/gencmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
cmake_minimum_required (VERSION 3.14)
set(NAME !NAME)
project (${NAME} VERSION 0.1)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
include_directories(
Expand Down
2 changes: 1 addition & 1 deletion test/apitests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required (VERSION 3.18)
include(GoogleTest)

project (apitests)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
include_directories(
../../gempyrelib/include
include
Expand Down
2 changes: 1 addition & 1 deletion test/install_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if(gempyre_FOUND)

include(gempyre)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

include_directories(
include
Expand Down
2 changes: 1 addition & 1 deletion test/mock_browser/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

project(mock_browser)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

if(NOT USE_LIBWEBSOCKETS)
include(${CMAKE_SOURCE_DIR}/gempyrelib/cmake/libwebsockets.cmake)
Expand Down
2 changes: 1 addition & 1 deletion test/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required (VERSION 3.18)
include(GoogleTest)

project (unittests)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
include_directories(
../../gempyrelib/include
../../gempyrelib/src
Expand Down

0 comments on commit edb0be3

Please sign in to comment.