mirror of https://github.com/libAthena/athena.git
Merge branch 'master' of ssh://git.axiodl.com:6431/libAthena/athena
This commit is contained in:
commit
aa07559839
|
@ -10,12 +10,11 @@ get_directory_property(ATDNA_DEFINES COMPILE_DEFINITIONS)
|
|||
list(REMOVE_ITEM ATDNA_DEFINES _GLIBCXX_DEBUG=1)
|
||||
set_directory_properties(PROPERTIES COMPILE_DEFINITIONS "${ATDNA_DEFINES}")
|
||||
|
||||
# Force this binary to Release flags (to make MSVC happy)
|
||||
# Force this binary to /MD flags (to make MSVC happy)
|
||||
if(MSVC)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "/MD /Zi /Ob0 /Od /RTC1")
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD /O2 /Ob2 /DNDEBUG")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "-debug -incremental:no")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "/MD /Zi /O2 /Ob1 /DNDEBUG")
|
||||
endif()
|
||||
|
||||
# Find dependencies
|
||||
|
@ -31,6 +30,8 @@ else()
|
|||
endif()
|
||||
|
||||
if(ATDNA_DYNAMIC_LLVM)
|
||||
find_library(CLANGCPP_LIB clang-cpp HINTS "${LLVM_ROOT_DIR}/lib")
|
||||
if (NOT CLANGCPP_LIB)
|
||||
list(APPEND LLVM_LIBS
|
||||
clangFrontend
|
||||
clangTooling
|
||||
|
@ -44,6 +45,11 @@ if(ATDNA_DYNAMIC_LLVM)
|
|||
clangLex
|
||||
clangBasic
|
||||
LLVM)
|
||||
else()
|
||||
list(APPEND LLVM_LIBS
|
||||
clang-cpp
|
||||
LLVM)
|
||||
endif()
|
||||
else()
|
||||
find_library(LLVMDEMANGLE_LIB LLVMDemangle HINTS "${LLVM_ROOT_DIR}/lib")
|
||||
find_library(LLVMBINARYFORMAT_LIB LLVMBinaryFormat HINTS "${LLVM_ROOT_DIR}/lib")
|
||||
|
@ -53,7 +59,9 @@ else()
|
|||
if (NOT LLVMBINARYFORMAT_LIB)
|
||||
set(LLVMBINARYFORMAT_LIB "")
|
||||
endif()
|
||||
list(APPEND LLVM_LIBS
|
||||
find_library(CLANG_CPP_LIB clang-cpp HINTS "${LLVM_ROOT_DIR}/lib")
|
||||
if (NOT CLANG_CPP_LIB)
|
||||
list(APPEND CLANG_LIBS
|
||||
clangFrontend
|
||||
clangTooling
|
||||
clangDriver
|
||||
|
@ -64,7 +72,14 @@ else()
|
|||
clangEdit
|
||||
clangAST
|
||||
clangLex
|
||||
clangBasic
|
||||
clangBasic)
|
||||
else()
|
||||
list(APPEND CLANG_LIBS
|
||||
clang-cpp)
|
||||
endif()
|
||||
|
||||
list(APPEND LLVM_LIBS
|
||||
${CLANG_LIBS}
|
||||
LLVMCore
|
||||
LLVMOption
|
||||
LLVMMCParser
|
||||
|
@ -73,6 +88,8 @@ else()
|
|||
LLVMMC
|
||||
LLVMProfileData
|
||||
LLVMSupport
|
||||
LLVMRemarks
|
||||
LLVMBitStreamReader
|
||||
${LLVMDEMANGLE_LIB})
|
||||
endif()
|
||||
|
||||
|
@ -133,6 +150,7 @@ if(MSVC)
|
|||
target_compile_options(atdna PRIVATE /GR-)
|
||||
else()
|
||||
target_compile_options(atdna PRIVATE -fno-rtti -Wno-error)
|
||||
set_property(TARGET atdna PROPERTY CXX_STANDARD 17)
|
||||
endif()
|
||||
|
||||
# Define installs
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
set(LLVM_ROOT_DIR "" CACHE PATH "Location of LLVM development root")
|
||||
set(LLVM_FIND_COMPONENTS "")
|
||||
if(WIN32)
|
||||
get_filename_component(LLVM_ROOT_DIR [HKEY_LOCAL_MACHINE\\Software\\LLVM\\LLVM] ABSOLUTE CACHE)
|
||||
get_filename_component(LLVM_ROOT_DIR [HKEY_LOCAL_MACHINE\\Software\\LLVM\\LLVM] ABSOLUTE)
|
||||
endif()
|
||||
|
||||
set(llvm_config_names llvm-config-3.9 llvm-config39
|
||||
|
|
|
@ -262,7 +262,7 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
|||
templateStmt += ", ";
|
||||
qualType += ", ";
|
||||
}
|
||||
templateStmt += nonTypeParm->getType().getAsString().append(1, ' ').append(nonTypeParm->getName().str());
|
||||
templateStmt += nonTypeParm->getType().getAsString(context.getPrintingPolicy()).append(1, ' ').append(nonTypeParm->getName().str());
|
||||
qualType += nonTypeParm->getName();
|
||||
needsComma = true;
|
||||
}
|
||||
|
@ -1261,10 +1261,13 @@ int main(int argc, const char** argv) {
|
|||
}
|
||||
|
||||
llvm::IntrusiveRefCntPtr<clang::FileManager> fman(new clang::FileManager(clang::FileSystemOptions()));
|
||||
#if LLVM_VERSION_MAJOR >= 10
|
||||
clang::tooling::ToolInvocation TI(std::move(args), std::make_unique<ATDNAAction>(), fman.get());
|
||||
#else
|
||||
ATDNAAction* action = new ATDNAAction();
|
||||
clang::tooling::ToolInvocation TI(std::move(args), action, fman.get());
|
||||
#endif
|
||||
if (!TI.run())
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -12,36 +12,25 @@ namespace athena::io::Compression {
|
|||
|
||||
atInt32 decompressZlib(const atUint8* src, atUint32 srcLen, atUint8* dst, atUint32 dstLen) {
|
||||
z_stream strm = {};
|
||||
strm.total_in = strm.avail_in = srcLen;
|
||||
strm.total_out = strm.avail_out = dstLen;
|
||||
strm.next_in = (Bytef*)src;
|
||||
strm.next_out = (Bytef*)dst;
|
||||
|
||||
strm.avail_in = srcLen;
|
||||
strm.avail_out = dstLen;
|
||||
strm.next_in = const_cast<Bytef*>(src);
|
||||
strm.next_out = dst;
|
||||
strm.zalloc = Z_NULL;
|
||||
strm.zfree = Z_NULL;
|
||||
strm.opaque = Z_NULL;
|
||||
|
||||
atInt32 err = -1;
|
||||
atInt32 ret = -1;
|
||||
atInt32 ret;
|
||||
// 15 window bits, and the | 16 tells zlib to to detect if using gzip or zlib
|
||||
ret = inflateInit2(&strm, MAX_WBITS | 16);
|
||||
|
||||
err = inflateInit(&strm); // 15 window bits, and the +32 tells zlib to to detect if using gzip or zlib
|
||||
|
||||
if (err == Z_OK) {
|
||||
err = inflate(&strm, Z_FINISH);
|
||||
|
||||
if (err == Z_STREAM_END)
|
||||
if (ret == Z_OK) {
|
||||
ret = inflate(&strm, Z_FINISH);
|
||||
if (ret == Z_STREAM_END) {
|
||||
ret = strm.total_out;
|
||||
else {
|
||||
inflateEnd(&strm);
|
||||
return err;
|
||||
}
|
||||
} else {
|
||||
inflateEnd(&strm);
|
||||
return err;
|
||||
}
|
||||
|
||||
inflateEnd(&strm);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ atUint8* MemoryReader::data() const {
|
|||
atUint64 MemoryReader::readUBytesToBuf(void* buf, atUint64 length) {
|
||||
if (m_position >= m_length) {
|
||||
if (m_globalErr)
|
||||
atFatal(FMT_STRING("Position {:08X} outside stream bounds "), m_position);
|
||||
atError(FMT_STRING("Position {:08X} outside stream bounds "), m_position);
|
||||
m_position = m_length;
|
||||
setError();
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue