mirror of
https://github.com/libAthena/athena.git
synced 2025-12-08 13:15:05 +00:00
Compare commits
17 Commits
37206e5301
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bfeb6eb8d0 | ||
| fa346ace47 | |||
| c6046d9150 | |||
| 01970c7249 | |||
| f27a63f312 | |||
|
e13b498266
|
|||
|
066e3ae109
|
|||
|
644070d5f3
|
|||
| 2aa9a573a0 | |||
| 4bd9dfac61 | |||
| bc2ebaab88 | |||
| 6eec5760b3 | |||
| 96fa2d24ef | |||
| b0daee99fc | |||
| daf8bf0595 | |||
| 2aa5b76732 | |||
| 064839bad6 |
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@@ -26,7 +26,7 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get -y update
|
||||
sudo apt-get -y install cmake ninja-build llvm-11-dev libclang-11-dev clang-11
|
||||
sudo apt-get -y install cmake ninja-build llvm-11-dev libclang-11-dev clang-11 zlib1g-dev
|
||||
|
||||
# setup buildcache
|
||||
curl -LSfs https://github.com/mbitsnbites/buildcache/releases/download/$BUILDCACHE_VERSION/buildcache-linux.tar.gz | tar xz -C "$RUNNER_WORKSPACE"
|
||||
@@ -84,7 +84,7 @@ jobs:
|
||||
--volume "${PWD}:/workspace"
|
||||
install: |
|
||||
apt-get -y update
|
||||
apt-get -y install build-essential cmake ninja-build llvm-11-dev libclang-11-dev clang-11
|
||||
apt-get -y install build-essential cmake ninja-build llvm-11-dev libclang-11-dev clang-11 zlib1g-dev
|
||||
run: |
|
||||
cmake -B build . -GNinja \
|
||||
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
|
||||
@@ -243,7 +243,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
uses: actions/download-artifact@v4.1.7
|
||||
with:
|
||||
path: artifacts
|
||||
|
||||
|
||||
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -1,6 +1,6 @@
|
||||
[submodule "extern/lzokay"]
|
||||
path = extern/lzokay
|
||||
url = https://github.com/jackoalan/lzokay.git
|
||||
url = https://github.com/AxioDL/lzokay.git
|
||||
branch = master
|
||||
[submodule "extern/fmt"]
|
||||
path = extern/fmt
|
||||
|
||||
@@ -222,11 +222,11 @@ endif()
|
||||
|
||||
target_include_directories(athena-core PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<BUILD_INTERFACE:${ZLIB_INCLUDE_DIR}>
|
||||
)
|
||||
target_link_libraries(athena-core PUBLIC
|
||||
athena-libyaml
|
||||
fmt
|
||||
$<BUILD_INTERFACE:${ZLIB_LIBRARIES}>
|
||||
)
|
||||
|
||||
add_library(athena-sakura EXCLUDE_FROM_ALL
|
||||
@@ -332,8 +332,11 @@ endforeach()
|
||||
# Define installs
|
||||
install(DIRECTORY include/athena DESTINATION ${INSTALL_INCLUDE_DIR} COMPONENT athena)
|
||||
install(DIRECTORY extern/fmt/include/fmt DESTINATION ${INSTALL_INCLUDE_DIR} COMPONENT athena)
|
||||
install(TARGETS athena-core fmt
|
||||
DESTINATION ${INSTALL_LIB_DIR} EXPORT AthenaTargets COMPONENT athena)
|
||||
if (ATHENA_ZLIB)
|
||||
set(ZLIB_INSTALL ${ZLIB_LIBRARIES})
|
||||
endif ()
|
||||
install(TARGETS athena-core fmt ${ZLIB_INSTALL}
|
||||
DESTINATION ${INSTALL_LIB_DIR} EXPORT AthenaTargets COMPONENT athena)
|
||||
if(WIN32 AND NOT CYGWIN)
|
||||
install(FILES Athena.ico DESTINATION ${INSTALL_LIB_DIR} COMPONENT athena)
|
||||
elseif(UNIX)
|
||||
@@ -348,7 +351,7 @@ endif()
|
||||
##################
|
||||
|
||||
# Add all targets to the build-tree export set
|
||||
export(TARGETS athena-core athena-libyaml fmt FILE "${CMAKE_CURRENT_BINARY_DIR}/AthenaTargets.cmake")
|
||||
export(TARGETS athena-core athena-libyaml fmt ${ZLIB_LIBRARIES} FILE "${CMAKE_CURRENT_BINARY_DIR}/AthenaTargets.cmake")
|
||||
|
||||
# Export the package for use from the build-tree
|
||||
# (this registers the build-tree with a global CMake-registry)
|
||||
|
||||
@@ -101,13 +101,25 @@ target_include_directories(atdna PRIVATE ${CLANG_INCLUDE_DIRS})
|
||||
# Clang 10.0.x headers currently broken with C++20
|
||||
set_property(TARGET atdna PROPERTY CXX_STANDARD 17)
|
||||
if(MSVC)
|
||||
if (NOT VCPKG_TOOLCHAIN)
|
||||
if (VCPKG_TOOLCHAIN)
|
||||
# Assumes static build of LLVM
|
||||
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||
set_property(TARGET atdna PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreadedDebug")
|
||||
else ()
|
||||
set_property(TARGET atdna PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded")
|
||||
endif ()
|
||||
else ()
|
||||
# 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")
|
||||
endif ()
|
||||
else()
|
||||
else ()
|
||||
target_compile_options(atdna PRIVATE -fno-rtti -fvisibility=hidden -Wno-error)
|
||||
if (METAFORCE_ASAN AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
# On Linux, we need to compile without ASAN; explicitly disable it here
|
||||
target_compile_options(atdna PRIVATE -stdlib=libstdc++ -fno-sanitize=address)
|
||||
target_link_options(atdna PRIVATE -stdlib=libstdc++ -fno-sanitize=address)
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
# Define installs
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# - Config file for the atdna package
|
||||
|
||||
|
||||
# Compute paths
|
||||
get_filename_component(ATDNA_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
|
||||
|
||||
# Our library dependencies (contains definitions for IMPORTED targets)
|
||||
if(NOT TARGET atdna AND NOT atdna_BINARY_DIR)
|
||||
include("${ATDNA_CMAKE_DIR}/atdnaTargets.cmake")
|
||||
@@ -26,7 +26,9 @@ function(atdna out)
|
||||
get_property(incdirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
|
||||
set(inccli "")
|
||||
foreach(dir ${incdirs})
|
||||
list(APPEND inccli "-I${dir}")
|
||||
if (NOT dir MATCHES ".*emscripten.*")
|
||||
list(APPEND inccli "-I${dir}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Get local defines for atdna
|
||||
|
||||
@@ -92,6 +92,18 @@ function(atdna out incdirs cdefs)
|
||||
list(APPEND ins_impdeps ${CMAKE_CURRENT_SOURCE_DIR}/${arg})
|
||||
endforeach()
|
||||
|
||||
set(inccli "")
|
||||
foreach(dir ${incdirs})
|
||||
if (NOT dir MATCHES ".*emscripten.*")
|
||||
list(APPEND inccli "-I${dir}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
set(cdefcli "")
|
||||
foreach(def ${cdefs})
|
||||
list(APPEND cdefcli "-D${def}")
|
||||
endforeach()
|
||||
|
||||
# MS extra
|
||||
unset(extraargs)
|
||||
if(MSVC)
|
||||
@@ -124,8 +136,7 @@ function(atdna out incdirs cdefs)
|
||||
# Use Ninja's DEPFILE parser in cooperation with atdna
|
||||
add_custom_command(OUTPUT ${out} COMMAND $<TARGET_FILE:atdna>
|
||||
ARGS ${extraargs} -o ${out_rel} -MD -MT ${out_rel} -MF ${out_rel}.d
|
||||
"$<$<BOOL:${incdirs}>:-I$<JOIN:${incdirs},;-I>>"
|
||||
"$<$<BOOL:${cdefs}>:-D$<JOIN:${cdefs},;-D>>"
|
||||
${inccli} ${cdefcli}
|
||||
"-I${athena_SOURCE_DIR}/include" ${ins}
|
||||
DEPENDS atdna ${ins} IMPLICIT_DEPENDS ${ins_impdeps}
|
||||
DEPFILE "${CMAKE_CURRENT_BINARY_DIR}/${out}.d"
|
||||
@@ -136,8 +147,7 @@ function(atdna out incdirs cdefs)
|
||||
# Use CMake's built-in dependency scanner for makefile targets
|
||||
add_custom_command(OUTPUT ${out} COMMAND $<TARGET_FILE:atdna>
|
||||
ARGS ${extraargs} -o ${out_rel}
|
||||
"$<$<BOOL:${incdirs}>:-I$<JOIN:${incdirs},;-I>>"
|
||||
"$<$<BOOL:${cdefs}>:-D$<JOIN:${cdefs},;-D>>"
|
||||
${inccli} ${cdefcli}
|
||||
"-I${athena_SOURCE_DIR}/include" ${ins}
|
||||
DEPENDS atdna ${ins} IMPLICIT_DEPENDS ${ins_impdeps}
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
|
||||
@@ -51,7 +51,8 @@ static llvm::cl::list<std::string> IncludeSearchPaths("I", llvm::cl::desc("Heade
|
||||
|
||||
static llvm::cl::list<std::string> SystemIncludeSearchPaths("isystem", llvm::cl::desc("System Header search path"));
|
||||
|
||||
static llvm::cl::list<std::string> StandardCXXLibISystem("stdlib++-isystem", llvm::cl::desc("Standard C++ library search path"));
|
||||
static llvm::cl::list<std::string> StandardCXXLibISystem("stdlib++-isystem",
|
||||
llvm::cl::desc("Standard C++ library search path"));
|
||||
|
||||
static llvm::cl::opt<std::string> StandardCXXLib("stdlib", llvm::cl::desc("Standard C++ library"));
|
||||
|
||||
@@ -188,7 +189,12 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
||||
for (clang::Attr* attr : field->attrs()) {
|
||||
if (clang::AnnotateAttr* annot = clang::dyn_cast_or_null<clang::AnnotateAttr>(attr)) {
|
||||
llvm::StringRef textRef = annot->getAnnotation();
|
||||
if (textRef.startswith_lower("rcrc32=")) {
|
||||
#if LLVM_VERSION_MAJOR >= 13
|
||||
if (textRef.startswith_insensitive("rcrc32="))
|
||||
#else
|
||||
if (textRef.startswith_lower("rcrc32="))
|
||||
#endif
|
||||
{
|
||||
unsigned long num = strtoul(textRef.data() + 7, nullptr, 16);
|
||||
std::string tmpS;
|
||||
llvm::raw_string_ostream s(tmpS);
|
||||
@@ -256,7 +262,11 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
||||
if (needsComma)
|
||||
qualType += ", ";
|
||||
llvm::raw_string_ostream OS(qualType);
|
||||
#if LLVM_VERSION_MAJOR >= 13
|
||||
arg.print(context.getPrintingPolicy(), OS, false);
|
||||
#else
|
||||
arg.print(context.getPrintingPolicy(), OS);
|
||||
#endif
|
||||
needsComma = true;
|
||||
}
|
||||
qualType += '>';
|
||||
@@ -279,7 +289,10 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
||||
templateStmt += ", ";
|
||||
qualType += ", ";
|
||||
}
|
||||
templateStmt += nonTypeParm->getType().getAsString(context.getPrintingPolicy()).append(1, ' ').append(nonTypeParm->getName().str());
|
||||
templateStmt += nonTypeParm->getType()
|
||||
.getAsString(context.getPrintingPolicy())
|
||||
.append(1, ' ')
|
||||
.append(nonTypeParm->getName().str());
|
||||
qualType += nonTypeParm->getName();
|
||||
needsComma = true;
|
||||
}
|
||||
@@ -326,7 +339,11 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
||||
if (needsComma)
|
||||
specializations.back().first += ", ";
|
||||
llvm::raw_string_ostream OS(specializations.back().first);
|
||||
#if LLVM_VERSION_MAJOR >= 13
|
||||
arg.print(context.getPrintingPolicy(), OS, false);
|
||||
#else
|
||||
arg.print(context.getPrintingPolicy(), OS);
|
||||
#endif
|
||||
needsComma = true;
|
||||
}
|
||||
specializations.back().first += '>';
|
||||
@@ -342,7 +359,12 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
||||
for (clang::Attr* attr : rec->attrs()) {
|
||||
if (clang::AnnotateAttr* annot = clang::dyn_cast_or_null<clang::AnnotateAttr>(attr)) {
|
||||
llvm::StringRef textRef = annot->getAnnotation();
|
||||
if (textRef.startswith_lower("specparms=")) {
|
||||
#if LLVM_VERSION_MAJOR >= 13
|
||||
if (textRef.startswith_insensitive("specparms="))
|
||||
#else
|
||||
if (textRef.startswith_lower("specparms="))
|
||||
#endif
|
||||
{
|
||||
llvm::SmallVector<llvm::StringRef, 16> specParms;
|
||||
textRef.substr(10).split(specParms, ',');
|
||||
int numTuples = int(specParms.size()) / numParms;
|
||||
@@ -611,7 +633,13 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
||||
llvm::raw_string_ostream strStream(sizeExprStr);
|
||||
argExpr->printPretty(strStream, nullptr, context.getPrintingPolicy());
|
||||
} else if (GetIntegerConstantExpr(expr, sizeLiteral, context)) {
|
||||
#if LLVM_VERSION_MAJOR >= 13
|
||||
llvm::SmallVector<char> strStream;
|
||||
sizeLiteral.toString(strStream, 10);
|
||||
sizeExprStr = std::string(strStream.begin(), strStream.end());
|
||||
#else
|
||||
sizeExprStr = sizeLiteral.toString(10);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -653,7 +681,13 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
||||
llvm::raw_string_ostream strStream2(sizeExprStr);
|
||||
argExpr->printPretty(strStream2, nullptr, context.getPrintingPolicy());
|
||||
} else if (GetIntegerConstantExpr(expr, sizeLiteral, context)) {
|
||||
#if LLVM_VERSION_MAJOR >= 13
|
||||
llvm::SmallVector<char> strStream;
|
||||
sizeLiteral.toString(strStream, 10);
|
||||
sizeExprStr = std::string(strStream.begin(), strStream.end());
|
||||
#else
|
||||
sizeExprStr = sizeLiteral.toString(10);
|
||||
#endif
|
||||
}
|
||||
} else if (idx == 1) {
|
||||
defaultEndian = false;
|
||||
@@ -700,7 +734,13 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
||||
llvm::raw_string_ostream strStream(offsetExprStr);
|
||||
argExpr->printPretty(strStream, nullptr, context.getPrintingPolicy());
|
||||
} else if (GetIntegerConstantExpr(expr, offsetLiteral, context)) {
|
||||
#if LLVM_VERSION_MAJOR >= 13
|
||||
llvm::SmallVector<char> strStream;
|
||||
offsetLiteral.toString(strStream, 10);
|
||||
offsetExprStr = std::string(strStream.begin(), strStream.end());
|
||||
#else
|
||||
offsetExprStr = offsetLiteral.toString(10);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
clang::APValue result;
|
||||
@@ -765,8 +805,15 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
||||
|
||||
const int64_t alignVal = align.getSExtValue();
|
||||
if (alignVal) {
|
||||
#if LLVM_VERSION_MAJOR >= 13
|
||||
llvm::SmallVector<char> alignStream;
|
||||
align.toString(alignStream, 10, true);
|
||||
outputNodes.emplace_back(NodeType::DoAlign, std::move(fieldName),
|
||||
"<Op>("s.append(alignStream.begin(), alignStream.end()).append(", s)"), false);
|
||||
#else
|
||||
outputNodes.emplace_back(NodeType::DoAlign, std::move(fieldName),
|
||||
"<Op>("s.append(align.toString(10, true)).append(", s)"), false);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
const clang::NamedDecl* nd = tsDecl->getTemplatedDecl();
|
||||
@@ -1005,7 +1052,13 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
||||
llvm::raw_string_ostream strStream(sizeExprStr);
|
||||
argExpr->printPretty(strStream, nullptr, context.getPrintingPolicy());
|
||||
} else if (GetIntegerConstantExpr(expr, sizeLiteral, context)) {
|
||||
#if LLVM_VERSION_MAJOR >= 13
|
||||
llvm::SmallVector<char> strStream;
|
||||
sizeLiteral.toString(strStream, 10);
|
||||
sizeExprStr = std::string(strStream.begin(), strStream.end());
|
||||
#else
|
||||
sizeExprStr = sizeLiteral.toString(10);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1048,7 +1101,13 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
||||
llvm::raw_string_ostream strStream2(sizeExprStr);
|
||||
argExpr->printPretty(strStream2, nullptr, context.getPrintingPolicy());
|
||||
} else if (GetIntegerConstantExpr(expr, sizeLiteral, context)) {
|
||||
#if LLVM_VERSION_MAJOR >= 13
|
||||
llvm::SmallVector<char> strStream;
|
||||
sizeLiteral.toString(strStream, 10);
|
||||
sizeExprStr = std::string(strStream.begin(), strStream.end());
|
||||
#else
|
||||
sizeExprStr = sizeLiteral.toString(10);
|
||||
#endif
|
||||
}
|
||||
} else if (idx == 1) {
|
||||
llvm::raw_string_ostream strStream(endianExprStr);
|
||||
@@ -1266,17 +1325,17 @@ int main(int argc, const char** argv) {
|
||||
llvm::cl::PrintHelpMessage();
|
||||
|
||||
std::vector<std::string> args = {
|
||||
XSTR(ATDNA_ARGV0),
|
||||
"-fsyntax-only",
|
||||
"-std=c++2a",
|
||||
XSTR(ATDNA_ARGV0),
|
||||
"-fsyntax-only",
|
||||
"-std=c++2a",
|
||||
#if __x86_64__
|
||||
"-mno-sse",
|
||||
"-mno-sse",
|
||||
#endif
|
||||
"-D__atdna__=1",
|
||||
"-Wno-expansion-to-defined",
|
||||
"-Wno-nullability-completeness",
|
||||
"-Werror=shadow-field",
|
||||
"-I" XSTR(INSTALL_PREFIX) "/include/Athena",
|
||||
"-D__atdna__=1",
|
||||
"-Wno-expansion-to-defined",
|
||||
"-Wno-nullability-completeness",
|
||||
"-Werror=shadow-field",
|
||||
"-I" XSTR(INSTALL_PREFIX) "/include/Athena",
|
||||
};
|
||||
for (int a = 1; a < argc; ++a) {
|
||||
args.emplace_back(argv[a]);
|
||||
|
||||
1
extern/CMakeLists.txt
vendored
1
extern/CMakeLists.txt
vendored
@@ -7,7 +7,6 @@ add_subdirectory(yaml)
|
||||
if(NOT TARGET fmt)
|
||||
add_subdirectory(fmt)
|
||||
target_compile_definitions(fmt PUBLIC
|
||||
FMT_STRING_ALIAS=1
|
||||
FMT_ARM_ABI_COMPATIBILITY=1
|
||||
FMT_EXCEPTIONS=0)
|
||||
target_compile_definitions(fmt INTERFACE
|
||||
|
||||
2
extern/fmt
vendored
2
extern/fmt
vendored
Submodule extern/fmt updated: 95da484727...9e8b86fd2d
2
extern/lzokay
vendored
2
extern/lzokay
vendored
Submodule extern/lzokay updated: 546a969527...ee8b4c29ad
93
extern/zlib/CMakeLists.txt
vendored
93
extern/zlib/CMakeLists.txt
vendored
@@ -1,47 +1,48 @@
|
||||
if (APPLE)
|
||||
# use toolchain zlib
|
||||
find_package(ZLIB REQUIRED)
|
||||
set(ZLIB_LIBRARIES ZLIB::ZLIB)
|
||||
else()
|
||||
if(NOT WIN32 AND NOT NX) # remove WIN32 when specter/freetype is gone
|
||||
find_library(ZLIB_LIB NAMES zlib z)
|
||||
endif()
|
||||
if(NOT ZLIB_LIB)
|
||||
message(STATUS "Using Athena's built-in zlib")
|
||||
add_library(z
|
||||
adler32.c
|
||||
compress.c
|
||||
crc32.c
|
||||
deflate.c
|
||||
infback.c
|
||||
inffast.c
|
||||
inflate.c
|
||||
inftrees.c
|
||||
trees.c
|
||||
uncompr.c
|
||||
zutil.c
|
||||
crc32.h
|
||||
deflate.h
|
||||
gzguts.h
|
||||
inffast.h
|
||||
inffixed.h
|
||||
inflate.h
|
||||
inftrees.h
|
||||
trees.h
|
||||
zconf.h
|
||||
zlib.h
|
||||
zutil.h)
|
||||
if(WIN32 AND NOT UNIX)
|
||||
install(FILES zconf.h zlib.h DESTINATION include COMPONENT zlib)
|
||||
install(TARGETS z DESTINATION lib COMPONENT zlib)
|
||||
else()
|
||||
target_compile_options(z PRIVATE -Wno-implicit-fallthrough)
|
||||
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_LIB} CACHE PATH "Zlib libraries" FORCE)
|
||||
find_path(ZLIB_INCLUDE_DIR zlib.h PATHS "${PNG_LIB}/../../include")
|
||||
message(STATUS "Using zlib at ${ZLIB_LIB}, include: ${ZLIB_INCLUDE_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
# always use toolchain zlib
|
||||
set(ZLIB_REQUIRED REQUIRED)
|
||||
endif ()
|
||||
find_package(ZLIB ${ZLIB_REQUIRED})
|
||||
if (ZLIB_FOUND)
|
||||
add_library(z INTERFACE)
|
||||
target_link_libraries(z INTERFACE ${ZLIB_LIBRARIES})
|
||||
target_include_directories(z INTERFACE ${ZLIB_INCLUDE_DIRS})
|
||||
set(ZLIB_LIBRARIES z CACHE STRING "zlib libraries" FORCE)
|
||||
set(ATHENA_ZLIB NO CACHE BOOL "Using built-in zlib" FORCE)
|
||||
else ()
|
||||
message(STATUS "Using Athena's built-in zlib")
|
||||
add_library(z
|
||||
adler32.c
|
||||
compress.c
|
||||
crc32.c
|
||||
deflate.c
|
||||
infback.c
|
||||
inffast.c
|
||||
inflate.c
|
||||
inftrees.c
|
||||
trees.c
|
||||
uncompr.c
|
||||
zutil.c
|
||||
include/crc32.h
|
||||
include/deflate.h
|
||||
include/gzguts.h
|
||||
include/inffast.h
|
||||
include/inffixed.h
|
||||
include/inflate.h
|
||||
include/inftrees.h
|
||||
include/trees.h
|
||||
include/zconf.h
|
||||
include/zlib.h
|
||||
include/zutil.h)
|
||||
if (WIN32 AND NOT UNIX)
|
||||
install(FILES include/zconf.h include/zlib.h DESTINATION include COMPONENT zlib)
|
||||
install(TARGETS z DESTINATION lib COMPONENT zlib)
|
||||
else ()
|
||||
target_compile_options(z PRIVATE -Wno-implicit-fallthrough)
|
||||
endif ()
|
||||
target_include_directories(z PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>)
|
||||
set(ZLIB_LIBRARIES z CACHE STRING "zlib libraries" FORCE)
|
||||
set(ATHENA_ZLIB YES CACHE BOOL "Using built-in zlib" FORCE)
|
||||
endif ()
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#if _WIN32
|
||||
using mode_t = int;
|
||||
#else
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
namespace athena {
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#if _WIN32
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <cstdio>
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
@@ -49,7 +41,7 @@ public:
|
||||
void setCacheSize(const atInt32 blockSize);
|
||||
|
||||
#if _WIN32
|
||||
using HandleType = HANDLE;
|
||||
using HandleType = void*;
|
||||
#else
|
||||
using HandleType = FILE*;
|
||||
#endif
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <cstdio>
|
||||
#endif
|
||||
|
||||
#include "athena/IStreamWriter.hpp"
|
||||
#include "athena/Types.hpp"
|
||||
@@ -43,7 +36,7 @@ public:
|
||||
void writeUBytes(const atUint8* data, atUint64 len) override;
|
||||
|
||||
#ifdef _WIN32
|
||||
using HandleType = HANDLE;
|
||||
using HandleType = void*;
|
||||
#else
|
||||
using HandleType = FILE*;
|
||||
#endif
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
#if defined(GEKKO) || defined(__SWITCH__)
|
||||
#if defined(GEKKO) || defined(__SWITCH__) || defined(EMSCRIPTEN)
|
||||
#include "gekko_support.h"
|
||||
typedef struct stat atStat64_t;
|
||||
#define atStat64 stat
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
#include "athena/FileReader.hpp"
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
|
||||
#include "win32_largefilewrapper.h"
|
||||
|
||||
namespace athena::io {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||
#include "osx_largefilewrapper.h"
|
||||
#elif defined(GEKKO) || defined(__SWITCH__)
|
||||
#include "gekko_support.h"
|
||||
#include "athena/gekko_support.h"
|
||||
#include "osx_largefilewrapper.h"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
#include "athena/FileWriter.hpp"
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user