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)
|
list(REMOVE_ITEM ATDNA_DEFINES _GLIBCXX_DEBUG=1)
|
||||||
set_directory_properties(PROPERTIES COMPILE_DEFINITIONS "${ATDNA_DEFINES}")
|
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)
|
if(MSVC)
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_RELEASE}")
|
set(CMAKE_CXX_FLAGS_DEBUG "/MD /Zi /Ob0 /Od /RTC1")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
|
|
||||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD /O2 /Ob2 /DNDEBUG")
|
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()
|
endif()
|
||||||
|
|
||||||
# Find dependencies
|
# Find dependencies
|
||||||
|
@ -31,6 +30,8 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ATDNA_DYNAMIC_LLVM)
|
if(ATDNA_DYNAMIC_LLVM)
|
||||||
|
find_library(CLANGCPP_LIB clang-cpp HINTS "${LLVM_ROOT_DIR}/lib")
|
||||||
|
if (NOT CLANGCPP_LIB)
|
||||||
list(APPEND LLVM_LIBS
|
list(APPEND LLVM_LIBS
|
||||||
clangFrontend
|
clangFrontend
|
||||||
clangTooling
|
clangTooling
|
||||||
|
@ -44,6 +45,11 @@ if(ATDNA_DYNAMIC_LLVM)
|
||||||
clangLex
|
clangLex
|
||||||
clangBasic
|
clangBasic
|
||||||
LLVM)
|
LLVM)
|
||||||
|
else()
|
||||||
|
list(APPEND LLVM_LIBS
|
||||||
|
clang-cpp
|
||||||
|
LLVM)
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
find_library(LLVMDEMANGLE_LIB LLVMDemangle HINTS "${LLVM_ROOT_DIR}/lib")
|
find_library(LLVMDEMANGLE_LIB LLVMDemangle HINTS "${LLVM_ROOT_DIR}/lib")
|
||||||
find_library(LLVMBINARYFORMAT_LIB LLVMBinaryFormat HINTS "${LLVM_ROOT_DIR}/lib")
|
find_library(LLVMBINARYFORMAT_LIB LLVMBinaryFormat HINTS "${LLVM_ROOT_DIR}/lib")
|
||||||
|
@ -53,7 +59,9 @@ else()
|
||||||
if (NOT LLVMBINARYFORMAT_LIB)
|
if (NOT LLVMBINARYFORMAT_LIB)
|
||||||
set(LLVMBINARYFORMAT_LIB "")
|
set(LLVMBINARYFORMAT_LIB "")
|
||||||
endif()
|
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
|
clangFrontend
|
||||||
clangTooling
|
clangTooling
|
||||||
clangDriver
|
clangDriver
|
||||||
|
@ -64,7 +72,14 @@ else()
|
||||||
clangEdit
|
clangEdit
|
||||||
clangAST
|
clangAST
|
||||||
clangLex
|
clangLex
|
||||||
clangBasic
|
clangBasic)
|
||||||
|
else()
|
||||||
|
list(APPEND CLANG_LIBS
|
||||||
|
clang-cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
list(APPEND LLVM_LIBS
|
||||||
|
${CLANG_LIBS}
|
||||||
LLVMCore
|
LLVMCore
|
||||||
LLVMOption
|
LLVMOption
|
||||||
LLVMMCParser
|
LLVMMCParser
|
||||||
|
@ -73,6 +88,8 @@ else()
|
||||||
LLVMMC
|
LLVMMC
|
||||||
LLVMProfileData
|
LLVMProfileData
|
||||||
LLVMSupport
|
LLVMSupport
|
||||||
|
LLVMRemarks
|
||||||
|
LLVMBitStreamReader
|
||||||
${LLVMDEMANGLE_LIB})
|
${LLVMDEMANGLE_LIB})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -133,6 +150,7 @@ if(MSVC)
|
||||||
target_compile_options(atdna PRIVATE /GR-)
|
target_compile_options(atdna PRIVATE /GR-)
|
||||||
else()
|
else()
|
||||||
target_compile_options(atdna PRIVATE -fno-rtti -Wno-error)
|
target_compile_options(atdna PRIVATE -fno-rtti -Wno-error)
|
||||||
|
set_property(TARGET atdna PROPERTY CXX_STANDARD 17)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Define installs
|
# Define installs
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
set(LLVM_ROOT_DIR "" CACHE PATH "Location of LLVM development root")
|
set(LLVM_ROOT_DIR "" CACHE PATH "Location of LLVM development root")
|
||||||
set(LLVM_FIND_COMPONENTS "")
|
set(LLVM_FIND_COMPONENTS "")
|
||||||
if(WIN32)
|
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()
|
endif()
|
||||||
|
|
||||||
set(llvm_config_names llvm-config-3.9 llvm-config39
|
set(llvm_config_names llvm-config-3.9 llvm-config39
|
||||||
|
|
|
@ -262,7 +262,7 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
||||||
templateStmt += ", ";
|
templateStmt += ", ";
|
||||||
qualType += ", ";
|
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();
|
qualType += nonTypeParm->getName();
|
||||||
needsComma = true;
|
needsComma = true;
|
||||||
}
|
}
|
||||||
|
@ -1261,10 +1261,13 @@ int main(int argc, const char** argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::IntrusiveRefCntPtr<clang::FileManager> fman(new clang::FileManager(clang::FileSystemOptions()));
|
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();
|
ATDNAAction* action = new ATDNAAction();
|
||||||
clang::tooling::ToolInvocation TI(std::move(args), action, fman.get());
|
clang::tooling::ToolInvocation TI(std::move(args), action, fman.get());
|
||||||
|
#endif
|
||||||
if (!TI.run())
|
if (!TI.run())
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,36 +12,25 @@ namespace athena::io::Compression {
|
||||||
|
|
||||||
atInt32 decompressZlib(const atUint8* src, atUint32 srcLen, atUint8* dst, atUint32 dstLen) {
|
atInt32 decompressZlib(const atUint8* src, atUint32 srcLen, atUint8* dst, atUint32 dstLen) {
|
||||||
z_stream strm = {};
|
z_stream strm = {};
|
||||||
strm.total_in = strm.avail_in = srcLen;
|
strm.avail_in = srcLen;
|
||||||
strm.total_out = strm.avail_out = dstLen;
|
strm.avail_out = dstLen;
|
||||||
strm.next_in = (Bytef*)src;
|
strm.next_in = const_cast<Bytef*>(src);
|
||||||
strm.next_out = (Bytef*)dst;
|
strm.next_out = dst;
|
||||||
|
|
||||||
strm.zalloc = Z_NULL;
|
strm.zalloc = Z_NULL;
|
||||||
strm.zfree = Z_NULL;
|
strm.zfree = Z_NULL;
|
||||||
strm.opaque = Z_NULL;
|
strm.opaque = Z_NULL;
|
||||||
|
|
||||||
atInt32 err = -1;
|
atInt32 ret;
|
||||||
atInt32 ret = -1;
|
// 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 (ret == Z_OK) {
|
||||||
|
ret = inflate(&strm, Z_FINISH);
|
||||||
if (err == Z_OK) {
|
if (ret == Z_STREAM_END) {
|
||||||
err = inflate(&strm, Z_FINISH);
|
|
||||||
|
|
||||||
if (err == Z_STREAM_END)
|
|
||||||
ret = strm.total_out;
|
ret = strm.total_out;
|
||||||
else {
|
|
||||||
inflateEnd(&strm);
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
inflateEnd(&strm);
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inflateEnd(&strm);
|
inflateEnd(&strm);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ atUint8* MemoryReader::data() const {
|
||||||
atUint64 MemoryReader::readUBytesToBuf(void* buf, atUint64 length) {
|
atUint64 MemoryReader::readUBytesToBuf(void* buf, atUint64 length) {
|
||||||
if (m_position >= m_length) {
|
if (m_position >= m_length) {
|
||||||
if (m_globalErr)
|
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;
|
m_position = m_length;
|
||||||
setError();
|
setError();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue