Merge remote-tracking branch 'origin/master' into hsh

# Conflicts:
#	atdna/FindLLVM.cmake
#	extern/zlib/CMakeLists.txt
This commit is contained in:
Luke Street 2021-01-06 14:17:43 -05:00
commit 04cbd546b7
7 changed files with 38 additions and 41 deletions

View File

@ -1,4 +1,6 @@
cmake_minimum_required(VERSION 3.10 FATAL_ERROR) # because of c++17
# Set MSVC runtime library flags from CMAKE_MSVC_RUNTIME_LIBRARY
cmake_policy(SET CMP0091 NEW)
project(athena)
if (NOT MSVC)
set(CMAKE_CXX_STANDARD 20)

View File

@ -10,13 +10,6 @@ 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 /MD flags (to make MSVC happy)
if(MSVC)
set(CMAKE_CXX_FLAGS_DEBUG "/MD /Zi /Ob0 /Od /RTC1")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD /O2 /Ob2 /DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "/MD /Zi /O2 /Ob1 /DNDEBUG")
endif()
# Find dependencies
include(FindLLVM.cmake)
if(NOT LLVM_FOUND)
@ -90,7 +83,8 @@ else()
LLVMSupport
LLVMRemarks
LLVMBitStreamReader
${LLVMDEMANGLE_LIB})
${LLVMDEMANGLE_LIB}
LLVMFrontendOpenMP)
endif()
string(FIND ${LLVM_VERSION_STRING} "svn" SVN_FILTER_IDX)
@ -149,11 +143,14 @@ target_compile_definitions(atdna PRIVATE
ATDNA_ARGV0=${LLVM_ROOT_DIR}/bin/clang-tool)
target_include_directories(atdna PRIVATE ${LLVM_INCLUDE_DIRS})
target_link_directories(atdna PRIVATE ${LLVM_LIBRARY_DIRS})
# Clang 10.0.x headers currently broken with C++20
set_property(TARGET atdna PROPERTY CXX_STANDARD 17)
if(MSVC)
target_compile_options(atdna PRIVATE /GR-)
# Allow linking against release-built LLVM libraries
target_compile_options(atdna PRIVATE /GR- /D_ITERATOR_DEBUG_LEVEL=0)
set_property(TARGET atdna PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
else()
target_compile_options(atdna PRIVATE -fno-rtti -Wno-error)
set_property(TARGET atdna PROPERTY CXX_STANDARD 17)
endif()
# Define installs

View File

@ -207,4 +207,3 @@ endif()
find_package_handle_standard_args(LLVM
REQUIRED_VARS LLVM_ROOT_DIR LLVM_HOST_TARGET
VERSION_VAR LLVM_VERSION_STRING)

View File

@ -419,7 +419,7 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
regType = regType->getUnqualifiedDesugaredType();
}
std::string fieldName = field->getName();
std::string fieldName = field->getName().str();
std::string propIdExpr = GetPropIdExpr(field, fieldName);
if (regType->getTypeClass() == clang::Type::TemplateSpecialization) {
@ -431,6 +431,8 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
llvm::APSInt endian(64, -1);
std::string endianExprStr;
bool defaultEndian = true;
/* FIXME: The is the following code required? */
#if 0
if (classParms->size() >= 2) {
const clang::NamedDecl* endianParm = classParms->getParam(1);
if (endianParm->getKind() == clang::Decl::NonTypeTemplateParm) {
@ -439,7 +441,7 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
nttParm->print(strStream, context.getPrintingPolicy());
}
}
#endif
for (const clang::TemplateArgument& arg : *tsType) {
if (arg.getKind() == clang::TemplateArgument::Expression) {
const clang::Expr* expr = arg.getAsExpr();
@ -818,7 +820,7 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
regType = regType->getUnqualifiedDesugaredType();
}
std::string fieldName = field->getName();
std::string fieldName = field->getName().str();
std::string propIdExpr = GetPropIdExpr(field, fieldName);
if (regType->getTypeClass() == clang::Type::TemplateSpecialization) {

View File

@ -1,7 +1,7 @@
if(NOT WIN32 AND NOT NX)
find_package(ZLIB)
if(NOT WIN32 AND NOT NX) # remove when specter/freetype is gone
find_library(ZLIB_LIB NAMES zlib z)
endif()
if(WIN32 OR NOT ZLIB_FOUND)
if(NOT ZLIB_LIB)
message(STATUS "Using Athena's built-in zlib")
add_library(z
adler32.c
@ -35,6 +35,6 @@ endif()
set(ZLIB_LIBRARIES z CACHE PATH "Zlib libraries" FORCE)
set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "Zlib include path" FORCE)
else()
set(ZLIB_LIBRARIES ${ZLIB_LIBRARIES} CACHE PATH "Zlib libraries" FORCE)
set(ZLIB_LIBRARIES ${ZLIB_LIB} CACHE PATH "Zlib libraries" FORCE)
find_path(ZLIB_INCLUDE_DIR zlib.h)
endif()

View File

@ -500,7 +500,7 @@ struct Write {
static std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
StreamT& w) {
/* libc++ specializes vector<bool> as a bitstream */
for (const T& v : vector)
for (const T v : vector)
w.writeBool(v);
}
static void Do(const PropId& id, std::unique_ptr<atUint8[]>& buf, size_t count, StreamT& w) {
@ -732,7 +732,7 @@ struct WriteYaml {
StreamT& w) {
/* libc++ specializes vector<bool> as a bitstream */
if (auto __v = w.enterSubVector(id.name))
for (const T& v : vector)
for (const T v : vector)
w.writeBool(v);
}
static void Do(const PropId& id, std::unique_ptr<atUint8[]>& buf, size_t count, StreamT& w) {

View File

@ -441,8 +441,6 @@ bool YAMLDocWriter::finish(athena::io::IStreamWriter* fout) {
return false;
};
yaml_event_t event = {};
if (fout) {
yaml_emitter_set_output(&m_emitter, (yaml_write_handler_t*)YAMLAthenaWriter, fout);
}
@ -450,16 +448,15 @@ bool YAMLDocWriter::finish(athena::io::IStreamWriter* fout) {
return error();
}
event.type = YAML_DOCUMENT_START_EVENT;
event.data.document_start.implicit = true;
yaml_event_t event;
yaml_document_start_event_initialize(&event, nullptr, nullptr, nullptr, 1);
if (!yaml_emitter_emit(&m_emitter, &event)) {
return error();
}
if (!RecursiveFinish(&m_emitter, *m_rootNode)) {
return false;
}
event.type = YAML_DOCUMENT_END_EVENT;
event.data.document_end.implicit = true;
yaml_document_end_event_initialize(&event, 1);
if (!yaml_emitter_emit(&m_emitter, &event)) {
return error();
}