unicode.cmake improvements, RagePhoto API changes

RagePhoto: remove class from Error enum
RagePhotoA: error() uint32_t -> uint8_t
RagePhoto-Extract: remove Error:: from Error enums
ragephoto-gtkviewer: RagePhoto::Error -> uint8_t, remove Error:: from
Error enum
ragephoto-qtviewer: RagePhoto::Error -> uint8_t, remove Error:: from
Error enum
This commit is contained in:
Syping 2021-12-02 05:55:50 +01:00
parent eed3290633
commit 7326cc26c7
7 changed files with 135 additions and 123 deletions

View file

@ -16,47 +16,59 @@
* responsible for anything with use of the software, you are self responsible.
****************************************************************************]]
# RagePhoto Unicode functionality tests
message("-- Testing codecvt")
try_run(CODECVT_RUN CODECVT_COMPILE ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/tests/CodecvtTest.cpp)
if (CODECVT_COMPILE AND CODECVT_RUN EQUAL 0)
set(CODECVT_COMPAT TRUE)
message("-- Testing codecvt - yes")
set(RAGEPHOTO_UNICODE "" CACHE STRING "libragephoto Unicode implementation")
if (RAGEPHOTO_UNICODE)
string(TOUPPER "UNICODE_${RAGEPHOTO_UNICODE}" UNICODE_DEF)
list(APPEND LIBRAGEPHOTO_DEFINES
"${UNICODE_DEF}"
)
message("-- UnicodeCvt - ${RAGEPHOTO_UNICODE}")
else()
message("-- Testing codecvt - no")
endif()
message("-- Testing iconv")
try_run(ICONV_RUN ICONV_COMPILE ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/tests/IconvTest.cpp)
if (ICONV_COMPILE AND ICONV_RUN EQUAL 0)
set(ICONV_COMPAT TRUE)
message("-- Testing iconv - yes")
else()
message("-- Testing iconv - no")
endif()
if (WIN32)
message("-- Testing wincvt")
try_run(WINCVT_RUN WINCVT_COMPILE ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/tests/WincvtTest.cpp)
if (WINCVT_COMPILE AND WINCVT_RUN EQUAL 0)
set(WINCVT_COMPAT TRUE)
message("-- Testing wincvt - yes")
# RagePhoto Unicode functionality tests
message("-- Testing codecvt")
try_run(CODECVT_RUN CODECVT_COMPILE ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/tests/CodecvtTest.cpp)
if (CODECVT_COMPILE AND CODECVT_RUN EQUAL 0)
set(CODECVT_COMPAT TRUE)
message("-- Testing codecvt - yes")
else()
message("-- Testing wincvt - no")
message("-- Testing codecvt - no")
endif()
message("-- Testing iconv")
try_run(ICONV_RUN ICONV_COMPILE ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/tests/IconvTest.cpp)
if (ICONV_COMPILE AND ICONV_RUN EQUAL 0)
set(ICONV_COMPAT TRUE)
message("-- Testing iconv - yes")
else()
message("-- Testing iconv - no")
endif()
if (WIN32)
message("-- Testing wincvt")
try_run(WINCVT_RUN WINCVT_COMPILE ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/tests/WincvtTest.cpp)
if (WINCVT_COMPILE AND WINCVT_RUN EQUAL 0)
set(WINCVT_COMPAT TRUE)
message("-- Testing wincvt - yes")
else()
message("-- Testing wincvt - no")
endif()
endif()
# Unicode implementation for RagePhoto
if (WINCVT_COMPAT)
list(APPEND LIBRAGEPHOTO_DEFINES
"UNICODE_WINCVT"
)
message("-- UnicodeCvt - wincvt")
elseif (CODECVT_COMPAT)
list(APPEND LIBRAGEPHOTO_DEFINES
"UNICODE_CODECVT"
)
message("-- UnicodeCvt - codecvt")
elseif (ICONV_COMPAT)
list(APPEND LIBRAGEPHOTO_DEFINES
"UNICODE_ICONV"
)
message("-- UnicodeCvt - iconv")
endif()
endif()
# Unicode implementation for RagePhoto
if (WINCVT_COMPAT)
list(APPEND LIBRAGEPHOTO_DEFINES
UNICODE_WINCVT
)
elseif (CODECVT_COMPAT)
list(APPEND LIBRAGEPHOTO_DEFINES
UNICODE_CODECVT
)
elseif (ICONV_COMPAT)
list(APPEND LIBRAGEPHOTO_DEFINES
UNICODE_ICONV
)
endif()