Skip to content

Commit

Permalink
Merge pull request #7 from Laguna1989/prepare_for_v0.2.0
Browse files Browse the repository at this point in the history
Switch to c++20
  • Loading branch information
Laguna1989 committed Dec 24, 2023
2 parents 462fbdf + 6d1001f commit 96f8512
Show file tree
Hide file tree
Showing 24 changed files with 311 additions and 204 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/test_verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
gccver: [ 9, 10, 11 ]
gccver: [ 10, 11, 12, 13 ]
steps:
- name: Set up cmake
uses: jwlawson/actions-setup-cmake@v1.11
Expand All @@ -24,7 +24,7 @@ jobs:
version: ${{ matrix.gccver }}
platform: x64

- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: ccache
uses: hendrikmuhs/ccache-action@v1
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
# with:
# cmake-version: '3.26.x'
#
# - uses: actions/checkout@v2
# - uses: actions/checkout@v4
#
# - name: CMake
# run: cmake -B ${{github.workspace}}/build . -DOALPP_STATIC_LIBRARY=ON
Expand All @@ -83,12 +83,14 @@ jobs:
- name: Set up gcc
uses: egor-tensin/setup-gcc@v1
with:
version: 9
version: 11
platform: x64

- uses: mymindstorm/setup-emsdk@v11
- uses: mymindstorm/setup-emsdk@v13
with:
version: 3.1.51

- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: ccache
uses: hendrikmuhs/ccache-action@v1
Expand Down Expand Up @@ -117,7 +119,7 @@ jobs:
run: |
brew install cmake ninja
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: ccache
uses: hendrikmuhs/ccache-action@v1
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ project(aselib VERSION 0.0.1 LANGUAGES CXX)
option(ASE_LIB_ENABLE_UNIT_TESTS "Enable unit tests" ON)

set(CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 17)
set(CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CXX_STANDARD 20)

# speed up fetchcontent on consecutive runs
set(FETCHCONTENT_UPDATES_DISCONNECTED ON)
Expand Down
Binary file not shown.
20 changes: 19 additions & 1 deletion ext/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
if (ASE_LIB_ENABLE_UNIT_TESTS)
add_subdirectory(catch2)
message(STATUS "Add CPM.cmake")
# download CPM.cmake
file(
DOWNLOAD
https://github.com/cpm-cmake/CPM.cmake/releases/download/v0.38.6/CPM.cmake
${CMAKE_BINARY_DIR}/cmake/CPM.cmake
EXPECTED_HASH SHA256=11c3fa5f1ba14f15d31c2fb63dbc8628ee133d81c8d764caad9a8db9e0bacb07
)
include(${CMAKE_BINARY_DIR}/cmake/CPM.cmake)

message(STATUS "Fetching external libraries started")

message(STATUS "Fetching catch2")
CPMAddPackage(
NAME catch2
GITHUB_REPOSITORY catchorg/Catch2
GIT_TAG v2.13.8
)

endif ()

add_subdirectory(zlib)
9 changes: 0 additions & 9 deletions ext/catch2/CMakeLists.txt

This file was deleted.

6 changes: 3 additions & 3 deletions impl/aselib/aseprite_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#include <fstream>
#include <istream>

aselib::AsepriteData::AsepriteData(std::string const& file_name)
aselib::AsepriteData::AsepriteData(std::filesystem::path const& file_name)
{
std::ifstream in { file_name, std::ios::binary };
if (!in.good()) {
throw std::invalid_argument { "Error opening the file: '" + file_name + "'" };
if (!in.good()) [[unlikely]] {
throw std::invalid_argument { "Error opening the file: '" + file_name.string() + "'" };
}
in >> m_header;

Expand Down
3 changes: 2 additions & 1 deletion impl/aselib/aseprite_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@

#include <aselib/aseprite_header.hpp>
#include <aselib/frame_data.hpp>
#include <filesystem>
#include <vector>

namespace aselib {

class AsepriteData {
public:
AsepriteData(std::string const& file_name);
explicit AsepriteData(std::filesystem::path const& file_name);

AsepriteHeader m_header {};
std::vector<FrameData> m_frames {};
Expand Down
2 changes: 1 addition & 1 deletion impl/aselib/aseprite_header.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct AsepriteHeader {
Word_t m_grid_height {};
};

std::istream& operator>>(std::istream& os, AsepriteHeader& header);
std::istream& operator>>(std::istream& is, AsepriteHeader& header);

} // namespace aselib

Expand Down
3 changes: 2 additions & 1 deletion impl/aselib/chunks/cel_chunk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ struct CelChunk {
Short_t m_z_index {};
Word_t m_cell_width {};
Word_t m_cell_height {};
// Note: the cel chunk contains all three pixel data types, but only one is used.
// Note: the cel chunk contains all three pixel data types, but only one is used, based on
// m_cell_type.
std::vector<PixelDataRGBA> m_pixels_rgba {};
std::vector<PixelDataGrayscale> m_pixels_grayscale {};
std::vector<PixelDataIndexed> m_pixels_indexed;
Expand Down
Loading

0 comments on commit 96f8512

Please sign in to comment.