fix: fix linux build issue
This commit is contained in:
parent
85ff80cbf7
commit
8ef1c6e30a
|
@ -306,6 +306,8 @@ namespace BMap {
|
||||||
case LibCmo::CK2::CK_CLASSID::CKCID_TEXTURE:
|
case LibCmo::CK2::CK_CLASSID::CKCID_TEXTURE:
|
||||||
m_ObjTextures.emplace_back(fileobj.CreatedObjectId);
|
m_ObjTextures.emplace_back(fileobj.CreatedObjectId);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break; // skip unknow objects
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ write_basic_package_version_file(
|
||||||
COMPATIBILITY SameMinorVersion
|
COMPATIBILITY SameMinorVersion
|
||||||
)
|
)
|
||||||
configure_package_config_file(
|
configure_package_config_file(
|
||||||
${CMAKE_CURRENT_LIST_DIR}/cmake/LibCmoConfig.cmake.in
|
${CMAKE_CURRENT_LIST_DIR}/CMake/LibCmoConfig.cmake.in
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/LibCmoConfig.cmake"
|
"${CMAKE_CURRENT_BINARY_DIR}/LibCmoConfig.cmake"
|
||||||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LibCmo
|
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LibCmo
|
||||||
)
|
)
|
||||||
|
|
|
@ -230,7 +230,7 @@ namespace LibCmo::CK2 {
|
||||||
* @return True if it need to be notified, otherwise false.
|
* @return True if it need to be notified, otherwise false.
|
||||||
* If the class id of checking is invalid, this function always return false.
|
* If the class id of checking is invalid, this function always return false.
|
||||||
*/
|
*/
|
||||||
bool CKIsNeedNotify(CK_CLASSID listener, CK_CLASSID deletedObjCid); /**
|
bool CKIsNeedNotify(CK_CLASSID listener, CK_CLASSID deletedObjCid);
|
||||||
/**
|
/**
|
||||||
* @brief Get all class ids need to be notified when objects whose class id included in \c delObjCids are deleting.
|
* @brief Get all class ids need to be notified when objects whose class id included in \c delObjCids are deleting.
|
||||||
* @param[in] delObjCids The bit array representing class ids which need to be queried.
|
* @param[in] delObjCids The bit array representing class ids which need to be queried.
|
||||||
|
|
|
@ -81,7 +81,7 @@ FILES
|
||||||
# X Container
|
# X Container
|
||||||
XContainer/XTypes.hpp
|
XContainer/XTypes.hpp
|
||||||
)
|
)
|
||||||
# Setup include infomation
|
# Setup include and linked library infomation
|
||||||
target_include_directories(LibCmo
|
target_include_directories(LibCmo
|
||||||
PUBLIC
|
PUBLIC
|
||||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>"
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>"
|
||||||
|
@ -90,16 +90,17 @@ PRIVATE
|
||||||
YYCC::YYCCommonplace
|
YYCC::YYCCommonplace
|
||||||
ZLIB::ZLIB
|
ZLIB::ZLIB
|
||||||
stb::stb-image
|
stb::stb-image
|
||||||
$<$<NOT:$<BOOL:${WIN32}>>:Iconv::Iconv>
|
|
||||||
)
|
)
|
||||||
# Setup linked library infomation
|
|
||||||
target_link_libraries(LibCmo
|
target_link_libraries(LibCmo
|
||||||
PRIVATE
|
PRIVATE
|
||||||
YYCC::YYCCommonplace
|
YYCC::YYCCommonplace
|
||||||
ZLIB::ZLIB
|
ZLIB::ZLIB
|
||||||
stb::stb-image
|
stb::stb-image
|
||||||
$<$<NOT:$<BOOL:${WIN32}>>:Iconv::Iconv>
|
|
||||||
)
|
)
|
||||||
|
if (NOT WIN32)
|
||||||
|
target_include_directories(LibCmo PRIVATE Iconv::Iconv)
|
||||||
|
target_link_libraries(LibCmo PRIVATE Iconv::Iconv)
|
||||||
|
endif ()
|
||||||
# Setup C++ standard
|
# Setup C++ standard
|
||||||
set_target_properties(LibCmo
|
set_target_properties(LibCmo
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
|
|
|
@ -415,20 +415,21 @@ namespace LibCmo::EncodingHelper {
|
||||||
static const iconv_t c_InvalidIconvType = reinterpret_cast<iconv_t>(-1);
|
static const iconv_t c_InvalidIconvType = reinterpret_cast<iconv_t>(-1);
|
||||||
|
|
||||||
struct IconvEncodingToken {
|
struct IconvEncodingToken {
|
||||||
IconvEncodingToken(const std::u8string_view& universal_code, const std::string_view& iconv_code) :
|
IconvEncodingToken(const std::u8string_view& universal_code, const std::string_view& _iconv_code) :
|
||||||
m_Name(universal_code),
|
m_Name(universal_code),
|
||||||
m_FromUTF8(c_InvalidIconvType), m_ToUTF8(c_InvalidIconvType) {
|
m_FromUTF8(c_InvalidIconvType), m_ToUTF8(c_InvalidIconvType) {
|
||||||
// if iconv code is empty, do nothing
|
// if iconv code is empty, do nothing
|
||||||
|
std::string iconv_code(_iconv_code);
|
||||||
if (iconv_code.empty()) return;
|
if (iconv_code.empty()) return;
|
||||||
// setup iconv_t
|
// setup iconv_t
|
||||||
this->m_FromUTF8 = iconv_open(code.c_str(), "UTF-8");
|
this->m_FromUTF8 = iconv_open(iconv_code.c_str(), "UTF-8");
|
||||||
this->m_ToUTF8 = iconv_open("UTF-8", code.c_str());
|
this->m_ToUTF8 = iconv_open("UTF-8", iconv_code.c_str());
|
||||||
}
|
}
|
||||||
~IconvEncodingToken() {
|
~IconvEncodingToken() {
|
||||||
if (this->m_FromUTF8 != c_InvalidIconvType)
|
if (this->m_FromUTF8 != c_InvalidIconvType)
|
||||||
iconv_close(token_cast->m_FromUTF8);
|
iconv_close(this->m_FromUTF8);
|
||||||
if (this->m_ToUTF8 != c_InvalidIconvType)
|
if (this->m_ToUTF8 != c_InvalidIconvType)
|
||||||
iconv_close(token_cast->m_ToUTF8);
|
iconv_close(this->m_ToUTF8);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::u8string m_Name;
|
std::u8string m_Name;
|
||||||
|
@ -526,7 +527,7 @@ namespace LibCmo::EncodingHelper {
|
||||||
// check whether token has been initialized correctly
|
// check whether token has been initialized correctly
|
||||||
if (token->m_FromUTF8 == c_InvalidIconvType || token->m_ToUTF8 == c_InvalidIconvType) {
|
if (token->m_FromUTF8 == c_InvalidIconvType || token->m_ToUTF8 == c_InvalidIconvType) {
|
||||||
// failed. free resource and return
|
// failed. free resource and return
|
||||||
delete token_cast;
|
delete token;
|
||||||
return INVALID_ENCODING_TOKEN;
|
return INVALID_ENCODING_TOKEN;
|
||||||
}
|
}
|
||||||
// okey, return
|
// okey, return
|
||||||
|
@ -588,7 +589,7 @@ namespace LibCmo::EncodingHelper {
|
||||||
return YYCC::EncodingHelper::UTF8ToChar(src, dst, token_cast->m_CodePage);
|
return YYCC::EncodingHelper::UTF8ToChar(src, dst, token_cast->m_CodePage);
|
||||||
#else
|
#else
|
||||||
IconvEncodingToken* token_cast = static_cast<IconvEncodingToken*>(token);
|
IconvEncodingToken* token_cast = static_cast<IconvEncodingToken*>(token);
|
||||||
return DoIconv(token_cast->FromUTF8, YYCC::EncodingHelper::ToOrdinaryView(src), dst);
|
return DoIconv(token_cast->m_FromUTF8, YYCC::EncodingHelper::ToOrdinaryView(src), dst);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
bool ToOrdinary(const char8_t* src, std::string& dst, EncodingToken token) {
|
bool ToOrdinary(const char8_t* src, std::string& dst, EncodingToken token) {
|
||||||
|
@ -616,7 +617,7 @@ namespace LibCmo::EncodingHelper {
|
||||||
#else
|
#else
|
||||||
IconvEncodingToken* token_cast = static_cast<IconvEncodingToken*>(token);
|
IconvEncodingToken* token_cast = static_cast<IconvEncodingToken*>(token);
|
||||||
std::string dst_cache;
|
std::string dst_cache;
|
||||||
bool ret = DoIconv(token_cast->ToUTF8, src, dst_cache);
|
bool ret = DoIconv(token_cast->m_ToUTF8, src, dst_cache);
|
||||||
if (ret) dst = YYCC::EncodingHelper::ToUTF8(dst_cache);
|
if (ret) dst = YYCC::EncodingHelper::ToUTF8(dst_cache);
|
||||||
return ret;
|
return ret;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace LibCmo {
|
||||||
UnreachableException(const char* msg) : message(msg ? msg : "") {}
|
UnreachableException(const char* msg) : message(msg ? msg : "") {}
|
||||||
UnreachableException(const UnreachableException& rhs) : message(rhs.message) {}
|
UnreachableException(const UnreachableException& rhs) : message(rhs.message) {}
|
||||||
virtual ~UnreachableException() {}
|
virtual ~UnreachableException() {}
|
||||||
[[nodiscard]] virtual const char* what() const override { return message.c_str(); }
|
[[nodiscard]] virtual const char* what() const noexcept override { return message.c_str(); }
|
||||||
private:
|
private:
|
||||||
std::string message;
|
std::string message;
|
||||||
};
|
};
|
||||||
|
@ -47,7 +47,7 @@ namespace LibCmo {
|
||||||
LogicException(const char* msg) : message(msg ? msg : "") {}
|
LogicException(const char* msg) : message(msg ? msg : "") {}
|
||||||
LogicException(const LogicException& rhs) : message(rhs.message) {}
|
LogicException(const LogicException& rhs) : message(rhs.message) {}
|
||||||
virtual ~LogicException() {}
|
virtual ~LogicException() {}
|
||||||
[[nodiscard]] virtual const char* what() const override { return message.c_str(); }
|
[[nodiscard]] virtual const char* what() const noexcept override { return message.c_str(); }
|
||||||
private:
|
private:
|
||||||
std::string message;
|
std::string message;
|
||||||
};
|
};
|
||||||
|
@ -62,7 +62,7 @@ namespace LibCmo {
|
||||||
RuntimeException(const char* msg) : message(msg ? msg : "") {}
|
RuntimeException(const char* msg) : message(msg ? msg : "") {}
|
||||||
RuntimeException(const RuntimeException& rhs) : message(rhs.message) {}
|
RuntimeException(const RuntimeException& rhs) : message(rhs.message) {}
|
||||||
virtual ~RuntimeException() {}
|
virtual ~RuntimeException() {}
|
||||||
[[nodiscard]] virtual const char* what() const override { return message.c_str(); }
|
[[nodiscard]] virtual const char* what() const noexcept override { return message.c_str(); }
|
||||||
private:
|
private:
|
||||||
std::string message;
|
std::string message;
|
||||||
};
|
};
|
||||||
|
|
|
@ -389,7 +389,7 @@ namespace Unvirt::CmdHelper {
|
||||||
};
|
};
|
||||||
|
|
||||||
class RootNode : public AbstractNode {
|
class RootNode : public AbstractNode {
|
||||||
friend class CommandParser;
|
friend class ::Unvirt::CmdHelper::CommandParser;
|
||||||
public:
|
public:
|
||||||
RootNode();
|
RootNode();
|
||||||
virtual ~RootNode();
|
virtual ~RootNode();
|
||||||
|
|
|
@ -281,7 +281,7 @@ namespace Unvirt::Context {
|
||||||
YYCC::ConsoleHelper::EnableColorfulConsole();
|
YYCC::ConsoleHelper::EnableColorfulConsole();
|
||||||
|
|
||||||
// Show banner
|
// Show banner
|
||||||
YYCC::ConsoleHelper::WriteLine(YYCC_COLOR_LIGHT_YELLOW(u8"Unvirt 0.2.0") " build at " __DATE__ " " __TIME__);
|
YYCC::ConsoleHelper::WriteLine(YYCC_COLOR_LIGHT_YELLOW(u8"Unvirt 0.2.0") " built at " __DATE__ " " __TIME__);
|
||||||
YYCC::ConsoleHelper::WriteLine(u8"Type 'help' for more infomation. Type 'exit' to quit.");
|
YYCC::ConsoleHelper::WriteLine(u8"Type 'help' for more infomation. Type 'exit' to quit.");
|
||||||
|
|
||||||
// start process loop
|
// start process loop
|
||||||
|
|
Loading…
Reference in New Issue
Block a user