Skip to content

Commit

Permalink
Build for older targets
Browse files Browse the repository at this point in the history
  • Loading branch information
kaetemi committed Jan 4, 2022
1 parent f79be35 commit ad95cd3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ file(
source_group("" FILES ${SRC})

add_library(qoi SHARED ${SRC})
set_target_properties(qoi PROPERTIES CXX_STANDARD 17)
if(MaxSDK_VERSION VERSION_GREATER 2019)
set_target_properties(qoi PROPERTIES CXX_STANDARD 17)
else()
set_target_properties(qoi PROPERTIES CXX_STANDARD 14)
endif()
set_target_properties(qoi PROPERTIES SUFFIX ".bmi")
target_link_libraries(qoi ${MaxSDK_LIBRARIES})
include_directories(${MaxSDK_INCLUDE_DIR} qoi)
Expand Down
9 changes: 0 additions & 9 deletions platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,15 @@ using std::min;
// C++
#ifdef __cplusplus

// Require C++17
#if defined(_MSC_VER) && (!defined(_HAS_CXX17) || !_HAS_CXX17)
static_assert(false, "C++17 is required");
#endif

// Define null, with color highlight
#ifndef null
constexpr decltype(nullptr) null = nullptr;
#define null null
#endif

// Include STL string and allow string literals.
// Always use sv suffix when declaring string literals.
// Ideally, assign them as `constexpr std::string_view`.
#include <string>
#include <string_view>
using namespace std::string_literals;
using namespace std::string_view_literals;

// Functional
#include <functional>
Expand Down
2 changes: 1 addition & 1 deletion qoiio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ BMMRES BitmapIO_QOI::GetImageInfo(BitmapInfo *pbi)
});

// Read header
static_assert(QOI_HEADER_SIZE == 14);
static_assert(QOI_HEADER_SIZE == 14, "Header size mismatch");
unsigned char header[QOI_HEADER_SIZE];
if (fread(header, 1, QOI_HEADER_SIZE, fi) != QOI_HEADER_SIZE)
return BMMRES_INVALIDFORMAT;
Expand Down

0 comments on commit ad95cd3

Please sign in to comment.