mirror of
https://github.com/libAthena/athena.git
synced 2025-12-08 21:18:02 +00:00
Compare commits
54 Commits
a87e8bb39f
...
update
| Author | SHA1 | Date | |
|---|---|---|---|
| 67d788ae4e | |||
| 4f8927d95c | |||
| 5c697c006f | |||
| f9545db293 | |||
| cee01a8df1 | |||
| 88b0ed137c | |||
| 50991752f8 | |||
| cce4b5e2c7 | |||
| fa346ace47 | |||
| c6046d9150 | |||
| 01970c7249 | |||
| f27a63f312 | |||
|
e13b498266
|
|||
|
066e3ae109
|
|||
|
644070d5f3
|
|||
| 2aa9a573a0 | |||
| 4bd9dfac61 | |||
| bc2ebaab88 | |||
| 6eec5760b3 | |||
| 96fa2d24ef | |||
| b0daee99fc | |||
| daf8bf0595 | |||
| 2aa5b76732 | |||
| 064839bad6 | |||
| 37206e5301 | |||
| 37c56eec07 | |||
| a4074e1a57 | |||
| da92db7356 | |||
| f02251ebf3 | |||
| 14e4d4e2ea | |||
| 11b86d7634 | |||
| 7a2a8a79ca | |||
| 991ffede79 | |||
| 4fa2335258 | |||
| ec43f653a7 | |||
| 2604243293 | |||
| 8558ca1b51 | |||
| b67f6dc231 | |||
| b3a274fcd8 | |||
| a36e589129 | |||
| 42d777bc1c | |||
| bbf8923a09 | |||
| 3ca375d030 | |||
| e2af6e5c79 | |||
| c53c9560fd | |||
| ec2675f130 | |||
| 79515ed6db | |||
| 144e14f2f5 | |||
| 85a16c7f45 | |||
| 5358d195bb | |||
| 608d675d9c | |||
| 666dea48ae | |||
|
|
25d3ed0f33 | ||
|
|
f5ad22ecf4 |
29
.clang-format
Normal file
29
.clang-format
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
BasedOnStyle: LLVM
|
||||||
|
ColumnLimit: 120
|
||||||
|
UseTab: Never
|
||||||
|
TabWidth: 2
|
||||||
|
---
|
||||||
|
Language: Cpp
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
PointerAlignment: Left
|
||||||
|
AlignAfterOpenBracket: Align
|
||||||
|
AlignConsecutiveAssignments: false
|
||||||
|
IndentCaseLabels: false
|
||||||
|
AllowShortBlocksOnASingleLine: Always
|
||||||
|
AlignOperands: true
|
||||||
|
AlignTrailingComments: true
|
||||||
|
AlwaysBreakBeforeMultilineStrings: true
|
||||||
|
AlwaysBreakTemplateDeclarations: Yes
|
||||||
|
BreakConstructorInitializersBeforeComma: true
|
||||||
|
AlwaysBreakAfterReturnType: None
|
||||||
|
AlwaysBreakAfterDefinitionReturnType: None
|
||||||
|
AllowShortFunctionsOnASingleLine: All
|
||||||
|
Cpp11BracedListStyle: true
|
||||||
|
NamespaceIndentation: None
|
||||||
|
BinPackArguments: true
|
||||||
|
BinPackParameters: true
|
||||||
|
SortIncludes: false
|
||||||
|
AccessModifierOffset: -2
|
||||||
|
ConstructorInitializerIndentWidth: 0
|
||||||
|
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||||
1
.clang-tidy
Normal file
1
.clang-tidy
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Checks: '*,-misc-unused-parameters,-modernize-use-trailing-return-type,-readability-named-parameter,-readability-convert-member-functions-to-static,-readability-uppercase-literal-suffix,-readability-magic-numbers,-hicpp-uppercase-literal-suffix,-hicpp-signed-bitwise,-cppcoreguidelines-avoid-magic-numbers,-cppcoreguidelines-pro-type-static-cast-downcast,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-owning-memory,-cppcoreguidelines-pro-type-union-access,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-non-private-member-variables-in-classes,-fuchsia-*,-google-runtime-references,-llvmlibc-*'
|
||||||
255
.github/workflows/build.yml
vendored
Normal file
255
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,255 @@
|
|||||||
|
name: Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
env:
|
||||||
|
BUILDCACHE_VERSION: v0.28.3
|
||||||
|
BUILDCACHE_ACCURACY: STRICT
|
||||||
|
BUILDCACHE_MAX_CACHE_SIZE: 1073741824 # 1GiB
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-linux-x86_64:
|
||||||
|
name: Build Linux (GCC x86_64)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: alpine:3.17
|
||||||
|
|
||||||
|
env:
|
||||||
|
LLVM_MAJOR: 15
|
||||||
|
BUILDCACHE_DIR: ${{github.workspace}}/.buildcache
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
apk add --no-cache git cmake ninja clang-dev clang-static llvm-dev llvm-static musl-dev \
|
||||||
|
gcc g++ libxml2-dev libxml2-static zlib-dev zlib-static
|
||||||
|
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Configure CMake
|
||||||
|
run: |
|
||||||
|
cmake -B build . -GNinja \
|
||||||
|
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
|
||||||
|
-DATDNA_DYNAMIC_LLVM:BOOL=OFF \
|
||||||
|
-DATDNA_STATIC:BOOL=ON \
|
||||||
|
-DCMAKE_CXX_FLAGS:STRING="-I/usr/lib/llvm15/include -Dstat64=stat"
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: cmake --build build --target package --verbose
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
working-directory: build
|
||||||
|
run: ./atdna-test
|
||||||
|
|
||||||
|
- name: Upload artifacts
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: atdna-linux-x86_64
|
||||||
|
path: |
|
||||||
|
build/athena-*.tar.gz
|
||||||
|
|
||||||
|
build-linux-aarch64:
|
||||||
|
name: Build Linux (GCC aarch64)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: 'false'
|
||||||
|
|
||||||
|
env:
|
||||||
|
LLVM_MAJOR: 15
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- uses: uraimo/run-on-arch-action@v2.0.9
|
||||||
|
name: Build & test
|
||||||
|
with:
|
||||||
|
arch: aarch64
|
||||||
|
base_image: --platform=linux/arm64/v8 alpine:3.17
|
||||||
|
githubToken: ${{github.token}}
|
||||||
|
dockerRunArgs: |
|
||||||
|
--volume "${PWD}:/workspace"
|
||||||
|
install: |
|
||||||
|
apk add --no-cache git cmake ninja clang-dev clang-static llvm-dev llvm-static musl-dev \
|
||||||
|
gcc g++ libxml2-dev libxml2-static zlib-dev zlib-static
|
||||||
|
run: |
|
||||||
|
cmake -B build . -GNinja \
|
||||||
|
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
|
||||||
|
-DATDNA_DYNAMIC_LLVM:BOOL=OFF \
|
||||||
|
-DATDNA_STATIC:BOOL=ON \
|
||||||
|
-DCMAKE_CXX_FLAGS:STRING="-I/usr/lib/llvm15/include -Dstat64=stat"
|
||||||
|
cmake --build build --target package --verbose
|
||||||
|
build/atdna-test
|
||||||
|
|
||||||
|
- name: Upload artifacts
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: atdna-linux-aarch64
|
||||||
|
path: |
|
||||||
|
build/athena-*.tar.gz
|
||||||
|
|
||||||
|
build-macos-universal:
|
||||||
|
name: Build macOS (AppleClang universal)
|
||||||
|
runs-on: macos-13
|
||||||
|
|
||||||
|
env:
|
||||||
|
LLVM_MAJOR: 15
|
||||||
|
LLVM_VERSION: 15.0.7_2
|
||||||
|
BUILDCACHE_DIR: ${{github.workspace}}/.buildcache
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
brew update
|
||||||
|
brew install ninja
|
||||||
|
|
||||||
|
# universal clang+llvm from macports
|
||||||
|
curl -LSfs https://axiodl.com/files/clang-$LLVM_MAJOR-$LLVM_VERSION.mpkg -o /tmp/clang-$LLVM_MAJOR-$LLVM_VERSION.mpkg
|
||||||
|
sudo installer -pkg /tmp/clang-$LLVM_MAJOR-$LLVM_VERSION.mpkg -target /
|
||||||
|
|
||||||
|
# setup buildcache
|
||||||
|
curl -LSfs https://github.com/mbitsnbites/buildcache/releases/download/$BUILDCACHE_VERSION/buildcache-macos.zip -o /tmp/buildcache-macos.zip
|
||||||
|
unzip /tmp/buildcache-macos.zip -d "$RUNNER_WORKSPACE"
|
||||||
|
echo "$RUNNER_WORKSPACE"/buildcache/bin >> $GITHUB_PATH
|
||||||
|
|
||||||
|
- name: Restore buildcache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{env.BUILDCACHE_DIR}}
|
||||||
|
key: buildcache-macos-12
|
||||||
|
|
||||||
|
- name: Configure CMake
|
||||||
|
run: |
|
||||||
|
cmake -B build . -GNinja \
|
||||||
|
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
|
||||||
|
-DCMAKE_OSX_ARCHITECTURES:STRING="x86_64;arm64" \
|
||||||
|
-DCMAKE_PREFIX_PATH:PATH=/opt/local \
|
||||||
|
-DLLVM_ROOT_DIR:PATH=/opt/local/libexec/llvm-$LLVM_MAJOR \
|
||||||
|
-DCMAKE_C_COMPILER_LAUNCHER:STRING=buildcache \
|
||||||
|
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=buildcache
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: cmake --build build --target package --verbose
|
||||||
|
|
||||||
|
- name: Print buildcache stats
|
||||||
|
run: buildcache -s
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
working-directory: build
|
||||||
|
run: ./atdna-test
|
||||||
|
|
||||||
|
- name: Upload artifacts
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: athena-macos-universal
|
||||||
|
path: |
|
||||||
|
build/athena-*.tar.gz
|
||||||
|
|
||||||
|
build-win32-amd64:
|
||||||
|
name: Build Windows (MSVC AMD64)
|
||||||
|
runs-on: windows-2022
|
||||||
|
|
||||||
|
env:
|
||||||
|
LLVM_VERSION: 15.0.7
|
||||||
|
BUILDCACHE_DIR: C:\buildcache
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Install LLVM
|
||||||
|
run: |
|
||||||
|
$TempDir = "C:\temp" # C: has more space
|
||||||
|
$Filename = "vcpkg-llvm-$env:LLVM_VERSION-full.7z"
|
||||||
|
New-Item -Path "$TempDir" -ItemType Directory -ea 0
|
||||||
|
(New-Object Net.WebClient).DownloadFile("https://axiodl.com/files/$Filename", "$TempDir\$Filename")
|
||||||
|
7z x "-o$TempDir" -aos "$TempDir\$Filename"
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
choco install ninja
|
||||||
|
|
||||||
|
# set up buildcache
|
||||||
|
$TempDir = "$env:RUNNER_WORKSPACE\temp"
|
||||||
|
New-Item -Path "$TempDir" -ItemType Directory -ea 0
|
||||||
|
(New-Object Net.WebClient).DownloadFile("https://github.com/mbitsnbites/buildcache/releases/download/$env:BUILDCACHE_VERSION/buildcache-windows.zip", "$TempDir\buildcache.zip")
|
||||||
|
Expand-Archive -LiteralPath "$TempDir\buildcache.zip" -DestinationPath "$TempDir"
|
||||||
|
echo "$TempDir\buildcache\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||||
|
|
||||||
|
- name: Restore buildcache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{env.BUILDCACHE_DIR}}
|
||||||
|
key: buildcache-windows-2019-msvc-amd64
|
||||||
|
|
||||||
|
- name: Enable Visual Studio environment
|
||||||
|
uses: ilammy/msvc-dev-cmd@v1
|
||||||
|
|
||||||
|
- name: Configure CMake
|
||||||
|
run: |
|
||||||
|
cmake -B build . -GNinja `
|
||||||
|
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo `
|
||||||
|
-DCMAKE_MSVC_RUNTIME_LIBRARY:STRING=MultiThreaded `
|
||||||
|
-DCMAKE_TOOLCHAIN_FILE:PATH="C:\temp\vcpkg-llvm-$env:LLVM_VERSION\scripts\buildsystems\vcpkg.cmake" `
|
||||||
|
-DVCPKG_TARGET_TRIPLET:STRING=x64-windows-static
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: cmake --build build --target package --verbose
|
||||||
|
|
||||||
|
- name: Print buildcache stats
|
||||||
|
run: buildcache -s
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
working-directory: build
|
||||||
|
run: ./atdna-test.exe
|
||||||
|
|
||||||
|
- name: Upload artifacts
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: athena-win32-amd64
|
||||||
|
path: |
|
||||||
|
build/athena-*.7z
|
||||||
|
|
||||||
|
release:
|
||||||
|
name: Release
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
|
if:
|
||||||
|
contains('
|
||||||
|
refs/heads/master
|
||||||
|
refs/heads/test
|
||||||
|
', github.ref)
|
||||||
|
needs:
|
||||||
|
- build-linux-x86_64
|
||||||
|
- build-linux-aarch64
|
||||||
|
- build-macos-universal
|
||||||
|
- build-win32-amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
path: artifacts
|
||||||
|
|
||||||
|
- name: Create release
|
||||||
|
uses: marvinpinto/action-automatic-releases@latest
|
||||||
|
with:
|
||||||
|
repo_token: ${{github.token}}
|
||||||
|
automatic_release_tag: latest
|
||||||
|
prerelease: true
|
||||||
|
title: Development build
|
||||||
|
files: |
|
||||||
|
artifacts/*/*
|
||||||
6
.gitignore
vendored
6
.gitignore
vendored
@@ -18,4 +18,8 @@ PKGBUILD
|
|||||||
**/doc
|
**/doc
|
||||||
**/obj
|
**/obj
|
||||||
**/Makefile
|
**/Makefile
|
||||||
|
/build
|
||||||
|
/out
|
||||||
|
/cmake-build-*
|
||||||
|
/.idea
|
||||||
|
/.buildcache
|
||||||
|
|||||||
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -1,6 +1,6 @@
|
|||||||
[submodule "extern/lzokay"]
|
[submodule "extern/lzokay"]
|
||||||
path = extern/lzokay
|
path = extern/lzokay
|
||||||
url = https://github.com/jackoalan/lzokay.git
|
url = https://github.com/AxioDL/lzokay.git
|
||||||
branch = master
|
branch = master
|
||||||
[submodule "extern/fmt"]
|
[submodule "extern/fmt"]
|
||||||
path = extern/fmt
|
path = extern/fmt
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
set(PACKAGE_VERSION "@ATHENA_VERSION@")
|
set(PACKAGE_VERSION "@ATHENA_VERSION_STRING@")
|
||||||
|
|
||||||
# Check whether the requested PACKAGE_FIND_VERSION is compatible
|
# Check whether the requested PACKAGE_FIND_VERSION is compatible
|
||||||
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
|
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
|
||||||
|
|||||||
213
CMakeLists.txt
213
CMakeLists.txt
@@ -1,21 +1,145 @@
|
|||||||
cmake_minimum_required(VERSION 3.10 FATAL_ERROR) # because of c++17
|
cmake_minimum_required(VERSION 3.10 FATAL_ERROR) # because of c++17
|
||||||
# Set MSVC runtime library flags from CMAKE_MSVC_RUNTIME_LIBRARY
|
# Set MSVC runtime library flags from CMAKE_MSVC_RUNTIME_LIBRARY
|
||||||
cmake_policy(SET CMP0091 NEW)
|
cmake_policy(SET CMP0091 NEW)
|
||||||
project(athena)
|
|
||||||
if (NOT MSVC)
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Athena Version #
|
# Athena Version #
|
||||||
##################
|
##################
|
||||||
|
find_package(Git)
|
||||||
|
if (GIT_FOUND)
|
||||||
|
# make sure version information gets re-run when the current Git HEAD changes
|
||||||
|
execute_process(WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --git-path HEAD
|
||||||
|
OUTPUT_VARIABLE athena_git_head_filename
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${athena_git_head_filename}")
|
||||||
|
|
||||||
set(ATHENA_MAJOR_VERSION 2)
|
execute_process(WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --symbolic-full-name HEAD
|
||||||
set(ATHENA_MINOR_VERSION 3)
|
OUTPUT_VARIABLE athena_git_head_symbolic
|
||||||
set(ATHENA_PATCH_VERSION 0)
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
set(ATHENA_VERSION
|
execute_process(WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
${ATHENA_MAJOR_VERSION}.${ATHENA_MINOR_VERSION}.${ATHENA_PATCH_VERSION})
|
COMMAND ${GIT_EXECUTABLE} rev-parse --git-path ${athena_git_head_symbolic}
|
||||||
|
OUTPUT_VARIABLE athena_git_head_symbolic_filename
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${athena_git_head_symbolic_filename}")
|
||||||
|
|
||||||
|
# defines ATHENA_WC_REVISION
|
||||||
|
execute_process(WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
|
||||||
|
OUTPUT_VARIABLE ATHENA_WC_REVISION
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
# defines ATHENA_WC_DESCRIBE
|
||||||
|
execute_process(WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} describe --tag --long --dirty --exclude latest
|
||||||
|
OUTPUT_VARIABLE ATHENA_WC_DESCRIBE
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
|
# remove hash (and trailing "-0" if needed) from description
|
||||||
|
string(REGEX REPLACE "(-0)?-[^-]+((-dirty)?)$" "\\2" ATHENA_WC_DESCRIBE "${ATHENA_WC_DESCRIBE}")
|
||||||
|
|
||||||
|
# defines ATHENA_WC_BRANCH
|
||||||
|
execute_process(WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
|
||||||
|
OUTPUT_VARIABLE ATHENA_WC_BRANCH
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
# defines ATHENA_WC_DATE
|
||||||
|
execute_process(WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} log -1 --format=%ad
|
||||||
|
OUTPUT_VARIABLE ATHENA_WC_DATE
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
else ()
|
||||||
|
message(STATUS "Unable to find git, commit information will not be available")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (ATHENA_WC_DESCRIBE)
|
||||||
|
string(REGEX REPLACE "v?([0-9]+)\.([0-9]+)\.([0-9]+)\-([0-9]+).*" "\\1.\\2.\\3.\\4" ATHENA_VERSION_STRING "${ATHENA_WC_DESCRIBE}")
|
||||||
|
string(REGEX REPLACE "v?([0-9]+)\.([0-9]+)\.([0-9]+).*" "\\1.\\2.\\3" ATHENA_VERSION "${ATHENA_VERSION_STRING}")
|
||||||
|
string(REGEX REPLACE "v?([0-9]+)\.([0-9]+)\.([0-9]+).*" "\\1" ATHENA_MAJOR_VERSION "${ATHENA_VERSION_STRING}")
|
||||||
|
string(REGEX REPLACE "v?([0-9]+)\.([0-9]+)\.([0-9]+).*" "\\2" ATHENA_MINOR_VERSION "${ATHENA_VERSION_STRING}")
|
||||||
|
string(REGEX REPLACE "v?([0-9]+)\.([0-9]+)\.([0-9]+).*" "\\3" ATHENA_PATCH_VERSION "${ATHENA_VERSION_STRING}")
|
||||||
|
else ()
|
||||||
|
set(ATHENA_WC_DESCRIBE "UNKNOWN-VERSION")
|
||||||
|
set(ATHENA_VERSION "0.0.0")
|
||||||
|
set(ATHENA_MAJOR_VERSION "0")
|
||||||
|
set(ATHENA_MINOR_VERSION "0")
|
||||||
|
set(ATHENA_PATCH_VERSION "0")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Add version information to CI environment variables
|
||||||
|
if(DEFINED ENV{GITHUB_ENV} AND CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||||
|
file(APPEND "$ENV{GITHUB_ENV}" "ATHENA_VERSION=${ATHENA_WC_DESCRIBE}\n")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
project(athena VERSION ${ATHENA_VERSION} LANGUAGES C CXX)
|
||||||
|
|
||||||
|
if (ATDNA_STATIC)
|
||||||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||||
|
add_link_options(-static)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
# Shaddup MSVC
|
||||||
|
add_compile_definitions(UNICODE=1 _UNICODE=1 __SSE__=1
|
||||||
|
_CRT_SECURE_NO_WARNINGS=1 D_SCL_SECURE_NO_WARNINGS=1
|
||||||
|
_SCL_SECURE_NO_DEPRECATE=1 _CRT_NONSTDC_NO_WARNINGS=1
|
||||||
|
_ENABLE_EXTENDED_ALIGNED_STORAGE=1 NOMINMAX=1)
|
||||||
|
add_compile_options(/IGNORE:4221
|
||||||
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4018>
|
||||||
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4800>
|
||||||
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4005>
|
||||||
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4311>
|
||||||
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4068>
|
||||||
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4267>
|
||||||
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4244>
|
||||||
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4200>
|
||||||
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4305>
|
||||||
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4067>
|
||||||
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4146>
|
||||||
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4309>
|
||||||
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4805>
|
||||||
|
${VS_OPTIONS})
|
||||||
|
|
||||||
|
string(REPLACE "/GR " "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
|
string(REPLACE " /EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
|
add_compile_options(
|
||||||
|
# Disable exceptions
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:/EHsc->
|
||||||
|
|
||||||
|
# Disable RTTI
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:/GR->
|
||||||
|
|
||||||
|
# Enforce various standards compliant behavior.
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:/permissive->
|
||||||
|
|
||||||
|
# Enable standard volatile semantics.
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:/volatile:iso>
|
||||||
|
|
||||||
|
# Reports the proper value for the __cplusplus preprocessor macro.
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:/Zc:__cplusplus>
|
||||||
|
|
||||||
|
# Use latest C++ standard.
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:/std:c++latest>
|
||||||
|
)
|
||||||
|
|
||||||
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||||
|
# Flags for MSVC (not clang-cl)
|
||||||
|
add_compile_options(
|
||||||
|
# Allow constexpr variables to have explicit external linkage.
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:/Zc:externConstexpr>
|
||||||
|
|
||||||
|
# Assume that new throws exceptions, allowing better code generation.
|
||||||
|
$<$<COMPILE_LANGUAGE:CXX>:/Zc:throwingNew>
|
||||||
|
|
||||||
|
# Link-time Code Generation for Release builds
|
||||||
|
$<$<CONFIG:Release>:/GL>
|
||||||
|
)
|
||||||
|
|
||||||
|
# Link-time Code Generation for Release builds
|
||||||
|
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "/LTCG")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/DEBUG /RELEASE /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:cv,fixup")
|
||||||
|
endif ()
|
||||||
|
else ()
|
||||||
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
endif ()
|
||||||
|
|
||||||
################
|
################
|
||||||
# Athena Build #
|
# Athena Build #
|
||||||
@@ -68,8 +192,8 @@ add_library(athena-core
|
|||||||
include/athena/YAMLCommon.hpp
|
include/athena/YAMLCommon.hpp
|
||||||
include/athena/YAMLDocReader.hpp
|
include/athena/YAMLDocReader.hpp
|
||||||
include/athena/YAMLDocWriter.hpp
|
include/athena/YAMLDocWriter.hpp
|
||||||
include/yaml.h
|
include/athena/yaml.h
|
||||||
include/utf8proc.h
|
include/athena/utf8proc.h
|
||||||
)
|
)
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_sources(athena-core PRIVATE
|
target_sources(athena-core PRIVATE
|
||||||
@@ -97,7 +221,7 @@ else()
|
|||||||
if(GEKKO OR NX)
|
if(GEKKO OR NX)
|
||||||
target_sources(athena-core PRIVATE
|
target_sources(athena-core PRIVATE
|
||||||
src/gekko_support.c
|
src/gekko_support.c
|
||||||
include/gekko_support.h
|
include/athena/gekko_support.h
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@@ -105,11 +229,11 @@ endif()
|
|||||||
|
|
||||||
target_include_directories(athena-core PUBLIC
|
target_include_directories(athena-core PUBLIC
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||||
$<BUILD_INTERFACE:${ZLIB_INCLUDE_DIR}>
|
|
||||||
)
|
)
|
||||||
target_link_libraries(athena-core PUBLIC
|
target_link_libraries(athena-core PUBLIC
|
||||||
athena-libyaml
|
athena-libyaml
|
||||||
fmt
|
fmt
|
||||||
|
$<BUILD_INTERFACE:${ZLIB_LIBRARIES}>
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(athena-sakura EXCLUDE_FROM_ALL
|
add_library(athena-sakura EXCLUDE_FROM_ALL
|
||||||
@@ -200,11 +324,7 @@ set(ATHENA_ICO ${CMAKE_CURRENT_SOURCE_DIR}/Athena.ico)
|
|||||||
# Offer the user the choice of overriding the installation directories
|
# Offer the user the choice of overriding the installation directories
|
||||||
set(INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries")
|
set(INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries")
|
||||||
set(INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files")
|
set(INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files")
|
||||||
if(WIN32 AND NOT CYGWIN)
|
set(INSTALL_CMAKE_DIR lib/cmake/athena)
|
||||||
set(INSTALL_CMAKE_DIR cmake)
|
|
||||||
else()
|
|
||||||
set(INSTALL_CMAKE_DIR lib/cmake/athena)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Make relative paths absolute (needed later on)
|
# Make relative paths absolute (needed later on)
|
||||||
foreach(p LIB INCLUDE CMAKE)
|
foreach(p LIB INCLUDE CMAKE)
|
||||||
@@ -217,10 +337,13 @@ foreach(p LIB INCLUDE CMAKE)
|
|||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Define installs
|
# Define installs
|
||||||
install(DIRECTORY include DESTINATION ${INSTALL_INCLUDE_DIR}/athena COMPONENT athena)
|
install(DIRECTORY include/athena DESTINATION ${INSTALL_INCLUDE_DIR} COMPONENT athena)
|
||||||
install(DIRECTORY extern/fmt/include DESTINATION ${INSTALL_INCLUDE_DIR}/fmt COMPONENT athena)
|
install(DIRECTORY extern/fmt/include/fmt DESTINATION ${INSTALL_INCLUDE_DIR} COMPONENT athena)
|
||||||
install(TARGETS athena-core fmt
|
if (ATHENA_ZLIB)
|
||||||
DESTINATION ${INSTALL_LIB_DIR} EXPORT AthenaTargets COMPONENT athena)
|
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)
|
if(WIN32 AND NOT CYGWIN)
|
||||||
install(FILES Athena.ico DESTINATION ${INSTALL_LIB_DIR} COMPONENT athena)
|
install(FILES Athena.ico DESTINATION ${INSTALL_LIB_DIR} COMPONENT athena)
|
||||||
elseif(UNIX)
|
elseif(UNIX)
|
||||||
@@ -235,7 +358,7 @@ endif()
|
|||||||
##################
|
##################
|
||||||
|
|
||||||
# Add all targets to the build-tree export set
|
# 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
|
# Export the package for use from the build-tree
|
||||||
# (this registers the build-tree with a global CMake-registry)
|
# (this registers the build-tree with a global CMake-registry)
|
||||||
@@ -272,13 +395,13 @@ add_subdirectory(atdna)
|
|||||||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||||
# Test target
|
# Test target
|
||||||
add_executable(atdna-test atdna/test.cpp atdna/test.hpp)
|
add_executable(atdna-test atdna/test.cpp atdna/test.hpp)
|
||||||
target_atdna(atdna-test atdna_test.cpp atdna/test.hpp)
|
|
||||||
if (CMAKE_SYSTEM_NAME STREQUAL "Switch")
|
if (CMAKE_SYSTEM_NAME STREQUAL "Switch")
|
||||||
set_target_properties(atdna-test PROPERTIES SUFFIX ".elf")
|
set_target_properties(atdna-test PROPERTIES SUFFIX ".elf")
|
||||||
target_link_libraries(atdna-test athena-core nx)
|
target_link_libraries(atdna-test athena-core nx)
|
||||||
else()
|
else()
|
||||||
target_link_libraries(atdna-test athena-core)
|
target_link_libraries(atdna-test athena-core)
|
||||||
endif()
|
endif()
|
||||||
|
target_atdna(atdna-test atdna_test.cpp atdna/test.hpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#########
|
#########
|
||||||
@@ -287,25 +410,37 @@ endif()
|
|||||||
|
|
||||||
include(InstallRequiredSystemLibraries)
|
include(InstallRequiredSystemLibraries)
|
||||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Athena")
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Athena")
|
||||||
set(CPACK_PACKAGE_VENDOR "Antidote / Jackoalan")
|
set(CPACK_PACKAGE_VENDOR "AxioDL Team")
|
||||||
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
|
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
|
||||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
||||||
set(CPACK_PACKAGE_VERSION_MAJOR ${ATHENA_MAJOR_VERSION})
|
set(CPACK_PACKAGE_VERSION_MAJOR ${ATHENA_MAJOR_VERSION})
|
||||||
set(CPACK_PACKAGE_VERSION_MINOR ${ATHENA_MINOR_VERSION})
|
set(CPACK_PACKAGE_VERSION_MINOR ${ATHENA_MINOR_VERSION})
|
||||||
set(CPACK_PACKAGE_VERSION_PATCH ${ATHENA_PATCH_VERSION})
|
set(CPACK_PACKAGE_VERSION_PATCH ${ATHENA_PATCH_VERSION})
|
||||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "athena")
|
set(CPACK_PACKAGE_INSTALL_DIRECTORY "athena")
|
||||||
if(WIN32 AND NOT UNIX)
|
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
|
||||||
# There is a bug in NSI that does not handle full unix paths properly. Make
|
|
||||||
# sure there is at least one set of four (4) backlasshes.
|
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" ARCHITECTURE_NAME)
|
||||||
set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "athena")
|
if (CMAKE_SYSTEM_NAME STREQUAL Windows)
|
||||||
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\AthenaNSIS.bmp")
|
set(SYSTEM_NAME win32)
|
||||||
set(CPACK_NSIS_MODIFY_PATH ON)
|
elseif (CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
||||||
set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\Athena.ico")
|
set(SYSTEM_NAME macos)
|
||||||
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\Athena.ico")
|
list(LENGTH CMAKE_OSX_ARCHITECTURES num_archs)
|
||||||
set(CPACK_NSIS_INSTALLED_ICON_NAME "Uninstall.exe")
|
if (num_archs GREATER 1)
|
||||||
set(CPACK_NSIS_DISPLAY_NAME "Athena")
|
set(ARCHITECTURE_NAME universal)
|
||||||
set(CPACK_NSIS_URL_INFO_ABOUT "http://libathena.github.io")
|
elseif(num_archs EQUAL 1)
|
||||||
set(CPACK_NSIS_CONTACT "antidote.crk@gmail.com")
|
set(ARCHITECTURE_NAME ${CMAKE_OSX_ARCHITECTURES})
|
||||||
endif()
|
endif()
|
||||||
|
elseif (CMAKE_SYSTEM_NAME STREQUAL Linux)
|
||||||
|
set(SYSTEM_NAME linux)
|
||||||
|
else ()
|
||||||
|
set(SYSTEM_NAME "${CMAKE_SYSTEM_NAME}")
|
||||||
|
endif ()
|
||||||
|
set(CPACK_PACKAGE_FILE_NAME "athena-${SYSTEM_NAME}-${ARCHITECTURE_NAME}")
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
set(CPACK_GENERATOR 7Z)
|
||||||
|
else ()
|
||||||
|
set(CPACK_GENERATOR TGZ)
|
||||||
|
endif ()
|
||||||
include(CPack)
|
include(CPack)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# PKGBUILD for libAthena
|
# PKGBUILD for libAthena
|
||||||
_pkgname=libathena
|
_pkgname=libathena
|
||||||
pkgname=$_pkgname-git
|
pkgname=$_pkgname-git
|
||||||
pkgver=@ATHENA_VERSION@
|
pkgver=@ATHENA_VERSION_STRING@
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Basic cross platform IO library"
|
pkgdesc="Basic cross platform IO library"
|
||||||
arch=('i686' 'x86_64')
|
arch=('i686' 'x86_64')
|
||||||
|
|||||||
@@ -2,19 +2,28 @@
|
|||||||
# ATDNA Build #
|
# ATDNA Build #
|
||||||
###############
|
###############
|
||||||
|
|
||||||
if(NOT CMAKE_CROSSCOMPILING)
|
if(NOT TARGET atdna AND NOT CMAKE_CROSSCOMPILING)
|
||||||
|
|
||||||
string(REPLACE -stdlib=libc++ "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
||||||
|
|
||||||
get_directory_property(ATDNA_DEFINES COMPILE_DEFINITIONS)
|
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}")
|
||||||
|
|
||||||
# Find dependencies
|
# Find dependencies
|
||||||
include(FindLLVM.cmake)
|
if (NOT "${LLVM_ROOT_DIR}" STREQUAL "")
|
||||||
if(NOT LLVM_FOUND)
|
# use existing LLVM_ROOT_DIR
|
||||||
message(STATUS "Unable to locate LLVM installation; skipping atdna")
|
elseif (APPLE AND CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
|
||||||
else()
|
set(LLVM_ROOT_DIR /usr/local/opt/llvm)
|
||||||
|
elseif (APPLE AND CMAKE_SYSTEM_PROCESSOR STREQUAL arm64)
|
||||||
|
set(LLVM_ROOT_DIR /opt/homebrew/opt/llvm)
|
||||||
|
elseif (WIN32)
|
||||||
|
get_filename_component(LLVM_ROOT_DIR [HKEY_LOCAL_MACHINE\\Software\\LLVM\\LLVM] ABSOLUTE)
|
||||||
|
else ()
|
||||||
|
set(LLVM_ROOT_DIR "")
|
||||||
|
endif ()
|
||||||
|
find_package(Clang REQUIRED PATHS ${LLVM_ROOT_DIR})
|
||||||
|
find_package(LLVM REQUIRED PATHS ${CLANG_INSTALL_PREFIX})
|
||||||
|
|
||||||
|
if(LLVM_FOUND)
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||||
option(ATDNA_DYNAMIC_LLVM "Use dynamic library targets when linking LLVM" ON)
|
option(ATDNA_DYNAMIC_LLVM "Use dynamic library targets when linking LLVM" ON)
|
||||||
@@ -22,100 +31,61 @@ else()
|
|||||||
option(ATDNA_DYNAMIC_LLVM "Use dynamic library targets when linking LLVM" OFF)
|
option(ATDNA_DYNAMIC_LLVM "Use dynamic library targets when linking LLVM" OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ATDNA_DYNAMIC_LLVM)
|
set(CLANG_LIBS "")
|
||||||
find_library(CLANGCPP_LIB clang-cpp HINTS "${LLVM_ROOT_DIR}/lib")
|
set(LLVM_LIBS "")
|
||||||
if (NOT CLANGCPP_LIB)
|
|
||||||
list(APPEND LLVM_LIBS
|
if (ATDNA_DYNAMIC_LLVM)
|
||||||
clangFrontend
|
list(APPEND CLANG_LIBS clang-cpp)
|
||||||
clangTooling
|
list(APPEND LLVM_LIBS LLVM)
|
||||||
clangDriver
|
|
||||||
clangSerialization
|
|
||||||
clangParse
|
|
||||||
clangSema
|
|
||||||
clangAnalysis
|
|
||||||
clangEdit
|
|
||||||
clangAST
|
|
||||||
clangLex
|
|
||||||
clangBasic
|
|
||||||
LLVM)
|
|
||||||
else()
|
|
||||||
list(APPEND LLVM_LIBS
|
|
||||||
clang-cpp
|
|
||||||
LLVM)
|
|
||||||
endif()
|
|
||||||
else()
|
else()
|
||||||
find_library(LLVMDEMANGLE_LIB LLVMDemangle HINTS "${LLVM_ROOT_DIR}/lib")
|
function(recursive_remove_library target library)
|
||||||
find_library(LLVMBINARYFORMAT_LIB LLVMBinaryFormat HINTS "${LLVM_ROOT_DIR}/lib")
|
get_target_property(target_dependencies ${target} INTERFACE_LINK_LIBRARIES)
|
||||||
if (NOT LLVMDEMANGLE_LIB)
|
foreach(dep ${target_dependencies})
|
||||||
set(LLVMDEMANGLE_LIB "")
|
if (NOT "${dep}" STREQUAL "${library}" AND TARGET "${dep}")
|
||||||
endif()
|
recursive_remove_library(${dep} ${library})
|
||||||
if (NOT LLVMBINARYFORMAT_LIB)
|
endif()
|
||||||
set(LLVMBINARYFORMAT_LIB "")
|
endforeach()
|
||||||
endif()
|
list(FIND target_dependencies "${library}" list_index)
|
||||||
find_library(CLANG_CPP_LIB clang-cpp HINTS "${LLVM_ROOT_DIR}/lib")
|
if (${list_index} GREATER -1)
|
||||||
if (NOT CLANG_CPP_LIB)
|
list(REMOVE_AT target_dependencies ${list_index})
|
||||||
list(APPEND CLANG_LIBS
|
set_property(TARGET ${target} PROPERTY INTERFACE_LINK_LIBRARIES "${target_dependencies}")
|
||||||
clangFrontend
|
endif()
|
||||||
clangTooling
|
endfunction()
|
||||||
clangDriver
|
|
||||||
clangSerialization
|
|
||||||
clangParse
|
|
||||||
clangSema
|
|
||||||
clangAnalysis
|
|
||||||
clangEdit
|
|
||||||
clangAST
|
|
||||||
clangLex
|
|
||||||
clangBasic)
|
|
||||||
else()
|
|
||||||
list(APPEND CLANG_LIBS
|
|
||||||
clang-cpp)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(APPEND LLVM_LIBS
|
# Add LLVM static libs
|
||||||
${CLANG_LIBS}
|
list(APPEND CLANG_LIBS clangTooling)
|
||||||
LLVMCore
|
list(APPEND LLVM_LIBS LLVMFrontendOpenMP LLVMOption)
|
||||||
LLVMOption
|
if (LLVM_VERSION_MAJOR GREATER_EQUAL 15)
|
||||||
LLVMMCParser
|
list(APPEND LLVM_LIBS LLVMWindowsDriver)
|
||||||
LLVMBitReader
|
endif ()
|
||||||
${LLVMBINARYFORMAT_LIB}
|
# Remove LLVM dynamic library from Clang dependencies
|
||||||
LLVMMC
|
foreach (lib ${CLANG_LIBS})
|
||||||
LLVMProfileData
|
recursive_remove_library(${lib} LLVM)
|
||||||
LLVMSupport
|
endforeach ()
|
||||||
LLVMRemarks
|
# Hack around link order issues
|
||||||
LLVMBitStreamReader
|
target_link_libraries(clangAST INTERFACE LLVMFrontendOpenMP)
|
||||||
${LLVMDEMANGLE_LIB}
|
|
||||||
LLVMFrontendOpenMP)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
string(FIND ${LLVM_VERSION_STRING} "svn" SVN_FILTER_IDX)
|
# Fix linking diaguids on Windows
|
||||||
if(NOT SVN_FILTER_IDX EQUAL -1)
|
if (WIN32 AND TARGET LLVMDebugInfoPDB)
|
||||||
string(SUBSTRING ${LLVM_VERSION_STRING} 0 ${SVN_FILTER_IDX} LLVM_VERSION_BASE)
|
find_package(DiaSDK REQUIRED)
|
||||||
else()
|
|
||||||
set(LLVM_VERSION_BASE ${LLVM_VERSION_STRING})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CLANG_INCLUDE_DIR ${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_BASE}/include
|
get_target_property(target_dependencies LLVMDebugInfoPDB INTERFACE_LINK_LIBRARIES)
|
||||||
CACHE PATH "Clang include dir" FORCE)
|
list(TRANSFORM target_dependencies REPLACE ".*diaguids.*" "${DIASDK_GUIDS_LIBRARY}")
|
||||||
|
set_property(TARGET LLVMDebugInfoPDB PROPERTY INTERFACE_LINK_LIBRARIES "${target_dependencies}")
|
||||||
|
endif ()
|
||||||
|
|
||||||
if(UNIX)
|
# Allow static linking against zstd
|
||||||
list(APPEND PLAT_LIBS z pthread curses)
|
if (ATDNA_STATIC)
|
||||||
if (APPLE)
|
get_target_property(target_dependencies LLVMSupport INTERFACE_LINK_LIBRARIES)
|
||||||
list(APPEND PLAT_LIBS dl)
|
list(TRANSFORM target_dependencies REPLACE "zstd::libzstd_shared" "zstd::libzstd_static")
|
||||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
set_property(TARGET LLVMSupport PROPERTY INTERFACE_LINK_LIBRARIES "${target_dependencies}")
|
||||||
list(APPEND PLAT_LIBS dl tinfo)
|
endif ()
|
||||||
endif()
|
|
||||||
elseif(WIN32)
|
|
||||||
list(APPEND PLAT_LIBS Version)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Offer the user the choice of overriding the installation directories
|
# Offer the user the choice of overriding the installation directories
|
||||||
set(INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files")
|
set(INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files")
|
||||||
set(INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables")
|
set(INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables")
|
||||||
if(WIN32 AND NOT CYGWIN)
|
set(INSTALL_CMAKE_DIR lib/cmake/atdna)
|
||||||
set(INSTALL_CMAKE_DIR cmake)
|
|
||||||
else()
|
|
||||||
set(INSTALL_CMAKE_DIR lib/cmake/atdna)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Make relative paths absolute (needed later on)
|
# Make relative paths absolute (needed later on)
|
||||||
foreach(p BIN INCLUDE CMAKE)
|
foreach(p BIN INCLUDE CMAKE)
|
||||||
@@ -135,27 +105,45 @@ endif()
|
|||||||
|
|
||||||
# ATDNA target
|
# ATDNA target
|
||||||
add_executable(atdna main.cpp test.hpp ${PLAT_SRCS})
|
add_executable(atdna main.cpp test.hpp ${PLAT_SRCS})
|
||||||
target_link_libraries(atdna ${LLVM_LIBS} ${PLAT_LIBS})
|
target_link_libraries(atdna ${CLANG_LIBS} ${LLVM_LIBS})
|
||||||
|
if (APPLE)
|
||||||
|
set(ATDNA_ARGV0 clang-tool)
|
||||||
|
else ()
|
||||||
|
set(ATDNA_ARGV0 "${LLVM_TOOLS_BINARY_DIR}/clang-tool")
|
||||||
|
endif ()
|
||||||
target_compile_definitions(atdna PRIVATE
|
target_compile_definitions(atdna PRIVATE
|
||||||
INSTALL_PREFIX=${ABS_INSTALL_BIN_DIR}
|
INSTALL_PREFIX=${ABS_INSTALL_BIN_DIR}
|
||||||
__STDC_LIMIT_MACROS=1
|
__STDC_LIMIT_MACROS=1
|
||||||
__STDC_CONSTANT_MACROS=1
|
__STDC_CONSTANT_MACROS=1
|
||||||
ATDNA_ARGV0=${LLVM_ROOT_DIR}/bin/clang-tool)
|
ATDNA_ARGV0=${ATDNA_ARGV0})
|
||||||
target_include_directories(atdna PRIVATE ${LLVM_INCLUDE_DIRS})
|
target_include_directories(atdna PRIVATE ${CLANG_INCLUDE_DIRS})
|
||||||
target_link_directories(atdna PRIVATE ${LLVM_LIBRARY_DIRS})
|
|
||||||
# Clang 10.0.x headers currently broken with C++20
|
# Clang 10.0.x headers currently broken with C++20
|
||||||
set_property(TARGET atdna PROPERTY CXX_STANDARD 17)
|
set_property(TARGET atdna PROPERTY CXX_STANDARD 17)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
# Allow linking against release-built LLVM libraries
|
if (VCPKG_TOOLCHAIN)
|
||||||
target_compile_options(atdna PRIVATE /GR- /D_ITERATOR_DEBUG_LEVEL=0)
|
# Assumes static build of LLVM
|
||||||
set_property(TARGET atdna PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
|
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||||
else()
|
set_property(TARGET atdna PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreadedDebug")
|
||||||
target_compile_options(atdna PRIVATE -fno-rtti -Wno-error)
|
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 ()
|
||||||
|
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()
|
endif()
|
||||||
|
|
||||||
# Define installs
|
# Define installs
|
||||||
install(TARGETS atdna DESTINATION ${INSTALL_BIN_DIR} EXPORT atdnaTargets COMPONENT atdna)
|
install(TARGETS atdna DESTINATION ${INSTALL_BIN_DIR} EXPORT atdnaTargets COMPONENT atdna)
|
||||||
install(DIRECTORY ${CLANG_INCLUDE_DIR}/ DESTINATION ${INSTALL_INCLUDE_DIR}/athena/clang COMPONENT atdna)
|
install(DIRECTORY ${LLVM_INCLUDE_DIR}/clang DESTINATION ${INSTALL_INCLUDE_DIR}/athena COMPONENT atdna)
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Package Export #
|
# Package Export #
|
||||||
@@ -197,6 +185,6 @@ endif()
|
|||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(atdnaHelpers.cmake)
|
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
include(atdnaHelpers.cmake)
|
||||||
|
|||||||
@@ -1,216 +0,0 @@
|
|||||||
# - Find LLVM headers and libraries.
|
|
||||||
# This module locates LLVM and adapts the llvm-config output for use with
|
|
||||||
# CMake.
|
|
||||||
#
|
|
||||||
# A given list of COMPONENTS is passed to llvm-config.
|
|
||||||
#
|
|
||||||
# The following variables are defined:
|
|
||||||
# LLVM_FOUND - true if LLVM was found
|
|
||||||
# LLVM_CXXFLAGS - C++ compiler flags for files that include LLVM headers.
|
|
||||||
# LLVM_HOST_TARGET - Target triple used to configure LLVM.
|
|
||||||
# LLVM_INCLUDE_DIRS - Directory containing LLVM include files.
|
|
||||||
# LLVM_LDFLAGS - Linker flags to add when linking against LLVM
|
|
||||||
# (includes -LLLVM_LIBRARY_DIRS).
|
|
||||||
# LLVM_LIBRARIES - Full paths to the library files to link against.
|
|
||||||
# LLVM_LIBRARY_DIRS - Directory containing LLVM libraries.
|
|
||||||
# LLVM_ROOT_DIR - The root directory of the LLVM installation.
|
|
||||||
# llvm-config is searched for in ${LLVM_ROOT_DIR}/bin.
|
|
||||||
# LLVM_VERSION_MAJOR - Major version of LLVM.
|
|
||||||
# LLVM_VERSION_MINOR - Minor version of LLVM.
|
|
||||||
# LLVM_VERSION_STRING - Full LLVM version string (e.g. 2.9).
|
|
||||||
#
|
|
||||||
# Note: The variable names were chosen in conformance with the offical CMake
|
|
||||||
# guidelines, see ${CMAKE_ROOT}/Modules/readme.txt.
|
|
||||||
|
|
||||||
# Try suffixed versions to pick up the newest LLVM install available on Debian
|
|
||||||
# derivatives.
|
|
||||||
# We also want an user-specified LLVM_ROOT_DIR to take precedence over the
|
|
||||||
# system default locations such as /usr/local/bin. Executing find_program()
|
|
||||||
# multiples times is the approach recommended in the docs.
|
|
||||||
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)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(llvm_config_names llvm-config-3.9 llvm-config39
|
|
||||||
llvm-config-3.8 llvm-config38
|
|
||||||
llvm-config-3.7 llvm-config37
|
|
||||||
llvm-config-3.6 llvm-config36
|
|
||||||
llvm-config-3.5 llvm-config35
|
|
||||||
llvm-config-3.4 llvm-config34
|
|
||||||
llvm-config-3.3 llvm-config33
|
|
||||||
llvm-config-3.2 llvm-config32
|
|
||||||
llvm-config-3.1 llvm-config31 llvm-config)
|
|
||||||
if(APPLE AND CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
|
|
||||||
set(LLVM_HOMEBREW_PATH /usr/local/opt/llvm/bin)
|
|
||||||
elseif(APPLE AND CMAKE_SYSTEM_PROCESSOR STREQUAL arm64)
|
|
||||||
set(LLVM_HOMEBREW_PATH /opt/homebrew/opt/llvm/bin)
|
|
||||||
else()
|
|
||||||
set(LLVM_HOMEBREW_PATH "")
|
|
||||||
endif()
|
|
||||||
find_program(LLVM_CONFIG
|
|
||||||
NAMES ${llvm_config_names}
|
|
||||||
PATHS ${LLVM_ROOT_DIR}/bin ${LLVM_HOMEBREW_PATH} NO_DEFAULT_PATH
|
|
||||||
DOC "Path to llvm-config tool.")
|
|
||||||
find_program(LLVM_CONFIG NAMES ${llvm_config_names})
|
|
||||||
|
|
||||||
if ((WIN32 AND NOT(MINGW OR CYGWIN)) OR NOT LLVM_CONFIG)
|
|
||||||
if (WIN32)
|
|
||||||
# A bit of a sanity check:
|
|
||||||
if( NOT EXISTS ${LLVM_ROOT_DIR}/include/llvm )
|
|
||||||
message(FATAL_ERROR "LLVM_ROOT_DIR (${LLVM_ROOT_DIR}) is not a valid LLVM install")
|
|
||||||
endif()
|
|
||||||
# We incorporate the CMake features provided by LLVM:
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
|
|
||||||
"${LLVM_ROOT_DIR}/share/llvm/cmake"
|
|
||||||
"${LLVM_ROOT_DIR}/lib/cmake/llvm")
|
|
||||||
include(LLVMConfig)
|
|
||||||
# Set properties
|
|
||||||
set(LLVM_HOST_TARGET ${TARGET_TRIPLE})
|
|
||||||
set(LLVM_VERSION_STRING ${LLVM_PACKAGE_VERSION})
|
|
||||||
set(LLVM_CXXFLAGS ${LLVM_DEFINITIONS})
|
|
||||||
set(LLVM_LDFLAGS "")
|
|
||||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "all-targets" index)
|
|
||||||
list(APPEND LLVM_FIND_COMPONENTS ${LLVM_TARGETS_TO_BUILD})
|
|
||||||
# Work around LLVM bug 21016
|
|
||||||
list(FIND LLVM_TARGETS_TO_BUILD "X86" TARGET_X86)
|
|
||||||
if(TARGET_X86 GREATER -1)
|
|
||||||
list(APPEND LLVM_FIND_COMPONENTS x86utils)
|
|
||||||
endif()
|
|
||||||
# Similar to the work around above, but for AArch64
|
|
||||||
list(FIND LLVM_TARGETS_TO_BUILD "AArch64" TARGET_AArch64)
|
|
||||||
if(TARGET_AArch64 GREATER -1)
|
|
||||||
list(APPEND LLVM_FIND_COMPONENTS AArch64Utils)
|
|
||||||
endif()
|
|
||||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "backend" index)
|
|
||||||
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-2][\\.0-9A-Za-z]*")
|
|
||||||
# Versions below 3.3 do not support components objcarcopts, option
|
|
||||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "objcarcopts" index)
|
|
||||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "option" index)
|
|
||||||
endif()
|
|
||||||
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-4][\\.0-9A-Za-z]*")
|
|
||||||
# Versions below 3.5 do not support components lto, profiledata
|
|
||||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "lto" index)
|
|
||||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "profiledata" index)
|
|
||||||
endif()
|
|
||||||
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-6][\\.0-9A-Za-z]*")
|
|
||||||
# Versions below 3.7 do not support components debuginfodwarf
|
|
||||||
# Only debuginfo is available
|
|
||||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "debuginfodwarf" index)
|
|
||||||
list(APPEND LLVM_FIND_COMPONENTS "debuginfo")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-4][\\.0-9A-Za-z]*")
|
|
||||||
llvm_map_components_to_libraries(tmplibs ${LLVM_FIND_COMPONENTS})
|
|
||||||
else()
|
|
||||||
llvm_map_components_to_libnames(tmplibs ${LLVM_FIND_COMPONENTS})
|
|
||||||
endif()
|
|
||||||
if(MSVC)
|
|
||||||
foreach(lib ${tmplibs})
|
|
||||||
list(APPEND LLVM_LIBRARIES "${LLVM_LIBRARY_DIRS}/${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
|
||||||
endforeach()
|
|
||||||
else()
|
|
||||||
# Rely on the library search path being set correctly via -L on
|
|
||||||
# MinGW and others, as the library list returned by
|
|
||||||
# llvm_map_components_to_libraries also includes imagehlp and psapi.
|
|
||||||
set(LLVM_LDFLAGS "-L${LLVM_LIBRARY_DIRS}")
|
|
||||||
set(LLVM_LIBRARIES ${tmplibs})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# When using the CMake LLVM module, LLVM_DEFINITIONS is a list
|
|
||||||
# instead of a string. Later, the list seperators would entirely
|
|
||||||
# disappear, replace them by spaces instead. A better fix would be
|
|
||||||
# to switch to add_definitions() instead of throwing strings around.
|
|
||||||
string(REPLACE ";" " " LLVM_CXXFLAGS "${LLVM_CXXFLAGS}")
|
|
||||||
else()
|
|
||||||
if (NOT FIND_LLVM_QUIETLY)
|
|
||||||
message(WARNING "Could not find llvm-config. Try manually setting LLVM_ROOT_DIR to the prebuilt LLVM prefix to use.")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
macro(llvm_set var flag)
|
|
||||||
if(LLVM_FIND_QUIETLY)
|
|
||||||
set(_quiet_arg ERROR_QUIET)
|
|
||||||
endif()
|
|
||||||
execute_process(
|
|
||||||
COMMAND ${LLVM_CONFIG} --${flag}
|
|
||||||
OUTPUT_VARIABLE LLVM_${var}
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
||||||
${_quiet_arg}
|
|
||||||
)
|
|
||||||
if(${ARGV2})
|
|
||||||
file(TO_CMAKE_PATH "${LLVM_${var}}" LLVM_${var})
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
macro(llvm_set_libs var flag prefix)
|
|
||||||
if(LLVM_FIND_QUIETLY)
|
|
||||||
set(_quiet_arg ERROR_QUIET)
|
|
||||||
endif()
|
|
||||||
execute_process(
|
|
||||||
COMMAND ${LLVM_CONFIG} --${flag} ${LLVM_FIND_COMPONENTS}
|
|
||||||
OUTPUT_VARIABLE tmplibs
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
||||||
${_quiet_arg}
|
|
||||||
)
|
|
||||||
file(TO_CMAKE_PATH "${tmplibs}" tmplibs)
|
|
||||||
string(REGEX REPLACE "([$^.[|*+?()]|])" "\\\\\\1" pattern "${prefix}/")
|
|
||||||
string(REGEX MATCHALL "${pattern}[^ ]+" "LLVM_${var}" "${tmplibs}")
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
llvm_set(VERSION_STRING version)
|
|
||||||
llvm_set(CXXFLAGS cxxflags)
|
|
||||||
llvm_set(HOST_TARGET host-target)
|
|
||||||
llvm_set(INCLUDE_DIRS includedir true)
|
|
||||||
llvm_set(ROOT_DIR prefix true)
|
|
||||||
|
|
||||||
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-2][\\.0-9A-Za-z]*")
|
|
||||||
# Versions below 3.3 do not support components objcarcopts, option
|
|
||||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "objcarcopts" index)
|
|
||||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "option" index)
|
|
||||||
endif()
|
|
||||||
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-4][\\.0-9A-Za-z]*")
|
|
||||||
# Versions below 3.5 do not support components lto, profiledata
|
|
||||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "lto" index)
|
|
||||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "profiledata" index)
|
|
||||||
endif()
|
|
||||||
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-6][\\.0-9A-Za-z]*")
|
|
||||||
# Versions below 3.7 do not support components debuginfodwarf
|
|
||||||
# Only debuginfo is available
|
|
||||||
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "debuginfodwarf" index)
|
|
||||||
list(APPEND LLVM_FIND_COMPONENTS "debuginfo")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
llvm_set(LDFLAGS ldflags)
|
|
||||||
if(NOT ${LLVM_VERSION_STRING} MATCHES "^3\\.[0-4][\\.0-9A-Za-z]*")
|
|
||||||
# In LLVM 3.5+, the system library dependencies (e.g. "-lz") are accessed
|
|
||||||
# using the separate "--system-libs" flag.
|
|
||||||
llvm_set(SYSTEM_LIBS system-libs)
|
|
||||||
string(REPLACE "\n" " " LLVM_LDFLAGS "${LLVM_LDFLAGS} ${LLVM_SYSTEM_LIBS}")
|
|
||||||
endif()
|
|
||||||
llvm_set(LIBRARY_DIRS libdir true)
|
|
||||||
llvm_set_libs(LIBRARIES libfiles "${LLVM_LIBRARY_DIRS}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# On CMake builds of LLVM, the output of llvm-config --cxxflags does not
|
|
||||||
# include -fno-rtti, leading to linker errors. Be sure to add it.
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
|
|
||||||
if(NOT ${LLVM_CXXFLAGS} MATCHES "-fno-rtti")
|
|
||||||
set(LLVM_CXXFLAGS "${LLVM_CXXFLAGS} -fno-rtti")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
string(REGEX REPLACE "([0-9]+).*" "\\1" LLVM_VERSION_MAJOR "${LLVM_VERSION_STRING}" )
|
|
||||||
string(REGEX REPLACE "[0-9]+\\.([0-9]+).*[A-Za-z]*" "\\1" LLVM_VERSION_MINOR "${LLVM_VERSION_STRING}" )
|
|
||||||
|
|
||||||
# Use the default CMake facilities for handling QUIET/REQUIRED.
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
|
|
||||||
if(${CMAKE_VERSION} VERSION_LESS "2.8.4")
|
|
||||||
# The VERSION_VAR argument is not supported on pre-2.8.4, work around this.
|
|
||||||
set(VERSION_VAR dummy)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_package_handle_standard_args(LLVM
|
|
||||||
REQUIRED_VARS LLVM_ROOT_DIR LLVM_HOST_TARGET
|
|
||||||
VERSION_VAR LLVM_VERSION_STRING)
|
|
||||||
@@ -26,7 +26,9 @@ function(atdna out)
|
|||||||
get_property(incdirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
|
get_property(incdirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
|
||||||
set(inccli "")
|
set(inccli "")
|
||||||
foreach(dir ${incdirs})
|
foreach(dir ${incdirs})
|
||||||
list(APPEND inccli "-I${dir}")
|
if (NOT dir MATCHES ".*emscripten.*")
|
||||||
|
list(APPEND inccli "-I${dir}")
|
||||||
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Get local defines for atdna
|
# Get local defines for atdna
|
||||||
@@ -56,9 +58,11 @@ function(atdna out)
|
|||||||
if (NOT EXISTS "${CMAKE_OSX_SYSROOT}")
|
if (NOT EXISTS "${CMAKE_OSX_SYSROOT}")
|
||||||
message(FATAL_ERROR "CMAKE_OSX_SYSROOT not set")
|
message(FATAL_ERROR "CMAKE_OSX_SYSROOT not set")
|
||||||
endif()
|
endif()
|
||||||
|
file(GLOB SYSTEM_INCLUDE_DIR "${COMPILER_DIR}/../lib/clang/*/include")
|
||||||
list(APPEND extraargs
|
list(APPEND extraargs
|
||||||
-isysroot ${CMAKE_OSX_SYSROOT}
|
-isysroot ${CMAKE_OSX_SYSROOT}
|
||||||
-stdlib++-isystem "${COMPILER_DIR}/../include/c++/v1")
|
-stdlib++-isystem "${COMPILER_DIR}/../include/c++/v1"
|
||||||
|
-isystem "${SYSTEM_INCLUDE_DIR}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Make target
|
# Make target
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
set(PACKAGE_VERSION "@ATHENA_VERSION@")
|
set(PACKAGE_VERSION "@ATHENA_VERSION_STRING@")
|
||||||
|
|
||||||
# Check whether the requested PACKAGE_FIND_VERSION is compatible
|
# Check whether the requested PACKAGE_FIND_VERSION is compatible
|
||||||
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
|
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
|
||||||
|
|||||||
@@ -92,6 +92,18 @@ function(atdna out incdirs cdefs)
|
|||||||
list(APPEND ins_impdeps ${CMAKE_CURRENT_SOURCE_DIR}/${arg})
|
list(APPEND ins_impdeps ${CMAKE_CURRENT_SOURCE_DIR}/${arg})
|
||||||
endforeach()
|
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
|
# MS extra
|
||||||
unset(extraargs)
|
unset(extraargs)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
@@ -112,9 +124,11 @@ function(atdna out incdirs cdefs)
|
|||||||
if (NOT EXISTS "${CMAKE_OSX_SYSROOT}")
|
if (NOT EXISTS "${CMAKE_OSX_SYSROOT}")
|
||||||
message(FATAL_ERROR "CMAKE_OSX_SYSROOT not set")
|
message(FATAL_ERROR "CMAKE_OSX_SYSROOT not set")
|
||||||
endif()
|
endif()
|
||||||
|
file(GLOB SYSTEM_INCLUDE_DIR "${COMPILER_DIR}/../lib/clang/*/include")
|
||||||
list(APPEND extraargs
|
list(APPEND extraargs
|
||||||
-isysroot ${CMAKE_OSX_SYSROOT}
|
-isysroot ${CMAKE_OSX_SYSROOT}
|
||||||
-stdlib++-isystem "${COMPILER_DIR}/../include/c++/v1")
|
-stdlib++-isystem "${COMPILER_DIR}/../include/c++/v1"
|
||||||
|
-isystem "${SYSTEM_INCLUDE_DIR}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Make target
|
# Make target
|
||||||
@@ -122,8 +136,7 @@ function(atdna out incdirs cdefs)
|
|||||||
# Use Ninja's DEPFILE parser in cooperation with atdna
|
# Use Ninja's DEPFILE parser in cooperation with atdna
|
||||||
add_custom_command(OUTPUT ${out} COMMAND $<TARGET_FILE:atdna>
|
add_custom_command(OUTPUT ${out} COMMAND $<TARGET_FILE:atdna>
|
||||||
ARGS ${extraargs} -o ${out_rel} -MD -MT ${out_rel} -MF ${out_rel}.d
|
ARGS ${extraargs} -o ${out_rel} -MD -MT ${out_rel} -MF ${out_rel}.d
|
||||||
"$<$<BOOL:${incdirs}>:-I$<JOIN:${incdirs},;-I>>"
|
${inccli} ${cdefcli}
|
||||||
"$<$<BOOL:${cdefs}>:-D$<JOIN:${cdefs},;-D>>"
|
|
||||||
"-I${athena_SOURCE_DIR}/include" ${ins}
|
"-I${athena_SOURCE_DIR}/include" ${ins}
|
||||||
DEPENDS atdna ${ins} IMPLICIT_DEPENDS ${ins_impdeps}
|
DEPENDS atdna ${ins} IMPLICIT_DEPENDS ${ins_impdeps}
|
||||||
DEPFILE "${CMAKE_CURRENT_BINARY_DIR}/${out}.d"
|
DEPFILE "${CMAKE_CURRENT_BINARY_DIR}/${out}.d"
|
||||||
@@ -134,8 +147,7 @@ function(atdna out incdirs cdefs)
|
|||||||
# Use CMake's built-in dependency scanner for makefile targets
|
# Use CMake's built-in dependency scanner for makefile targets
|
||||||
add_custom_command(OUTPUT ${out} COMMAND $<TARGET_FILE:atdna>
|
add_custom_command(OUTPUT ${out} COMMAND $<TARGET_FILE:atdna>
|
||||||
ARGS ${extraargs} -o ${out_rel}
|
ARGS ${extraargs} -o ${out_rel}
|
||||||
"$<$<BOOL:${incdirs}>:-I$<JOIN:${incdirs},;-I>>"
|
${inccli} ${cdefcli}
|
||||||
"$<$<BOOL:${cdefs}>:-D$<JOIN:${cdefs},;-D>>"
|
|
||||||
"-I${athena_SOURCE_DIR}/include" ${ins}
|
"-I${athena_SOURCE_DIR}/include" ${ins}
|
||||||
DEPENDS atdna ${ins} IMPLICIT_DEPENDS ${ins_impdeps}
|
DEPENDS atdna ${ins} IMPLICIT_DEPENDS ${ins_impdeps}
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||||
|
|||||||
117
atdna/main.cpp
117
atdna/main.cpp
@@ -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> 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"));
|
static llvm::cl::opt<std::string> StandardCXXLib("stdlib", llvm::cl::desc("Standard C++ library"));
|
||||||
|
|
||||||
@@ -75,6 +76,21 @@ using StreamOut = llvm::raw_pwrite_stream;
|
|||||||
using StreamOut = llvm::raw_fd_ostream;
|
using StreamOut = llvm::raw_fd_ostream;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if LLVM_VERSION_MAJOR >= 12
|
||||||
|
static inline bool GetIntegerConstantExpr(const clang::Expr* expr, llvm::APSInt& out, const clang::ASTContext& ctx) {
|
||||||
|
const auto optional = expr->getIntegerConstantExpr(ctx);
|
||||||
|
if (optional) {
|
||||||
|
out = optional.getValue();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static inline bool GetIntegerConstantExpr(const clang::Expr* expr, llvm::APSInt& out, const clang::ASTContext& ctx) {
|
||||||
|
return expr->isIntegerConstantExpr(out, ctx);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
||||||
clang::ASTContext& context;
|
clang::ASTContext& context;
|
||||||
StreamOut& fileOut;
|
StreamOut& fileOut;
|
||||||
@@ -173,7 +189,12 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
|||||||
for (clang::Attr* attr : field->attrs()) {
|
for (clang::Attr* attr : field->attrs()) {
|
||||||
if (clang::AnnotateAttr* annot = clang::dyn_cast_or_null<clang::AnnotateAttr>(attr)) {
|
if (clang::AnnotateAttr* annot = clang::dyn_cast_or_null<clang::AnnotateAttr>(attr)) {
|
||||||
llvm::StringRef textRef = annot->getAnnotation();
|
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);
|
unsigned long num = strtoul(textRef.data() + 7, nullptr, 16);
|
||||||
std::string tmpS;
|
std::string tmpS;
|
||||||
llvm::raw_string_ostream s(tmpS);
|
llvm::raw_string_ostream s(tmpS);
|
||||||
@@ -241,7 +262,11 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
|||||||
if (needsComma)
|
if (needsComma)
|
||||||
qualType += ", ";
|
qualType += ", ";
|
||||||
llvm::raw_string_ostream OS(qualType);
|
llvm::raw_string_ostream OS(qualType);
|
||||||
|
#if LLVM_VERSION_MAJOR >= 13
|
||||||
|
arg.print(context.getPrintingPolicy(), OS, false);
|
||||||
|
#else
|
||||||
arg.print(context.getPrintingPolicy(), OS);
|
arg.print(context.getPrintingPolicy(), OS);
|
||||||
|
#endif
|
||||||
needsComma = true;
|
needsComma = true;
|
||||||
}
|
}
|
||||||
qualType += '>';
|
qualType += '>';
|
||||||
@@ -264,7 +289,10 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
|||||||
templateStmt += ", ";
|
templateStmt += ", ";
|
||||||
qualType += ", ";
|
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();
|
qualType += nonTypeParm->getName();
|
||||||
needsComma = true;
|
needsComma = true;
|
||||||
}
|
}
|
||||||
@@ -311,7 +339,11 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
|||||||
if (needsComma)
|
if (needsComma)
|
||||||
specializations.back().first += ", ";
|
specializations.back().first += ", ";
|
||||||
llvm::raw_string_ostream OS(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);
|
arg.print(context.getPrintingPolicy(), OS);
|
||||||
|
#endif
|
||||||
needsComma = true;
|
needsComma = true;
|
||||||
}
|
}
|
||||||
specializations.back().first += '>';
|
specializations.back().first += '>';
|
||||||
@@ -327,7 +359,12 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
|||||||
for (clang::Attr* attr : rec->attrs()) {
|
for (clang::Attr* attr : rec->attrs()) {
|
||||||
if (clang::AnnotateAttr* annot = clang::dyn_cast_or_null<clang::AnnotateAttr>(attr)) {
|
if (clang::AnnotateAttr* annot = clang::dyn_cast_or_null<clang::AnnotateAttr>(attr)) {
|
||||||
llvm::StringRef textRef = annot->getAnnotation();
|
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;
|
llvm::SmallVector<llvm::StringRef, 16> specParms;
|
||||||
textRef.substr(10).split(specParms, ',');
|
textRef.substr(10).split(specParms, ',');
|
||||||
int numTuples = int(specParms.size()) / numParms;
|
int numTuples = int(specParms.size()) / numParms;
|
||||||
@@ -595,8 +632,14 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
|||||||
argExpr = static_cast<const clang::ParenExpr*>(argExpr)->getSubExpr();
|
argExpr = static_cast<const clang::ParenExpr*>(argExpr)->getSubExpr();
|
||||||
llvm::raw_string_ostream strStream(sizeExprStr);
|
llvm::raw_string_ostream strStream(sizeExprStr);
|
||||||
argExpr->printPretty(strStream, nullptr, context.getPrintingPolicy());
|
argExpr->printPretty(strStream, nullptr, context.getPrintingPolicy());
|
||||||
} else if (expr->isIntegerConstantExpr(sizeLiteral, context)) {
|
} 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);
|
sizeExprStr = sizeLiteral.toString(10);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -637,8 +680,14 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
|||||||
argExpr = static_cast<const clang::ParenExpr*>(argExpr)->getSubExpr();
|
argExpr = static_cast<const clang::ParenExpr*>(argExpr)->getSubExpr();
|
||||||
llvm::raw_string_ostream strStream2(sizeExprStr);
|
llvm::raw_string_ostream strStream2(sizeExprStr);
|
||||||
argExpr->printPretty(strStream2, nullptr, context.getPrintingPolicy());
|
argExpr->printPretty(strStream2, nullptr, context.getPrintingPolicy());
|
||||||
} else if (expr->isIntegerConstantExpr(sizeLiteral, context)) {
|
} 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);
|
sizeExprStr = sizeLiteral.toString(10);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
} else if (idx == 1) {
|
} else if (idx == 1) {
|
||||||
defaultEndian = false;
|
defaultEndian = false;
|
||||||
@@ -684,8 +733,14 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
|||||||
argExpr = static_cast<const clang::ParenExpr*>(argExpr)->getSubExpr();
|
argExpr = static_cast<const clang::ParenExpr*>(argExpr)->getSubExpr();
|
||||||
llvm::raw_string_ostream strStream(offsetExprStr);
|
llvm::raw_string_ostream strStream(offsetExprStr);
|
||||||
argExpr->printPretty(strStream, nullptr, context.getPrintingPolicy());
|
argExpr->printPretty(strStream, nullptr, context.getPrintingPolicy());
|
||||||
} else if (expr->isIntegerConstantExpr(offsetLiteral, context)) {
|
} 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);
|
offsetExprStr = offsetLiteral.toString(10);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
clang::APValue result;
|
clang::APValue result;
|
||||||
@@ -736,7 +791,7 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
|||||||
for (const clang::TemplateArgument& arg : *tsType) {
|
for (const clang::TemplateArgument& arg : *tsType) {
|
||||||
if (arg.getKind() == clang::TemplateArgument::Expression) {
|
if (arg.getKind() == clang::TemplateArgument::Expression) {
|
||||||
const clang::Expr* expr = arg.getAsExpr();
|
const clang::Expr* expr = arg.getAsExpr();
|
||||||
if (!expr->isIntegerConstantExpr(align, context)) {
|
if (!GetIntegerConstantExpr(expr, align, context)) {
|
||||||
clang::DiagnosticBuilder diag = context.getDiagnostics().Report(expr->getExprLoc(), AthenaError);
|
clang::DiagnosticBuilder diag = context.getDiagnostics().Report(expr->getExprLoc(), AthenaError);
|
||||||
diag.AddString("Unable to use non-constant align expression in Athena");
|
diag.AddString("Unable to use non-constant align expression in Athena");
|
||||||
diag.AddSourceRange(clang::CharSourceRange(expr->getSourceRange(), true));
|
diag.AddSourceRange(clang::CharSourceRange(expr->getSourceRange(), true));
|
||||||
@@ -750,8 +805,15 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
|||||||
|
|
||||||
const int64_t alignVal = align.getSExtValue();
|
const int64_t alignVal = align.getSExtValue();
|
||||||
if (alignVal) {
|
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),
|
outputNodes.emplace_back(NodeType::DoAlign, std::move(fieldName),
|
||||||
"<Op>("s.append(align.toString(10, true)).append(", s)"), false);
|
"<Op>("s.append(align.toString(10, true)).append(", s)"), false);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const clang::NamedDecl* nd = tsDecl->getTemplatedDecl();
|
const clang::NamedDecl* nd = tsDecl->getTemplatedDecl();
|
||||||
@@ -989,8 +1051,14 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
|||||||
argExpr = static_cast<const clang::ParenExpr*>(argExpr)->getSubExpr();
|
argExpr = static_cast<const clang::ParenExpr*>(argExpr)->getSubExpr();
|
||||||
llvm::raw_string_ostream strStream(sizeExprStr);
|
llvm::raw_string_ostream strStream(sizeExprStr);
|
||||||
argExpr->printPretty(strStream, nullptr, context.getPrintingPolicy());
|
argExpr->printPretty(strStream, nullptr, context.getPrintingPolicy());
|
||||||
} else if (expr->isIntegerConstantExpr(sizeLiteral, context)) {
|
} 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);
|
sizeExprStr = sizeLiteral.toString(10);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1032,8 +1100,14 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
|||||||
argExpr = static_cast<const clang::ParenExpr*>(argExpr)->getSubExpr();
|
argExpr = static_cast<const clang::ParenExpr*>(argExpr)->getSubExpr();
|
||||||
llvm::raw_string_ostream strStream2(sizeExprStr);
|
llvm::raw_string_ostream strStream2(sizeExprStr);
|
||||||
argExpr->printPretty(strStream2, nullptr, context.getPrintingPolicy());
|
argExpr->printPretty(strStream2, nullptr, context.getPrintingPolicy());
|
||||||
} else if (expr->isIntegerConstantExpr(sizeLiteral, context)) {
|
} 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);
|
sizeExprStr = sizeLiteral.toString(10);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
} else if (idx == 1) {
|
} else if (idx == 1) {
|
||||||
llvm::raw_string_ostream strStream(endianExprStr);
|
llvm::raw_string_ostream strStream(endianExprStr);
|
||||||
@@ -1231,7 +1305,11 @@ public:
|
|||||||
std::unique_ptr<StreamOut> fileout;
|
std::unique_ptr<StreamOut> fileout;
|
||||||
StreamOut* fileoutOld;
|
StreamOut* fileoutOld;
|
||||||
if (OutputFilename.size())
|
if (OutputFilename.size())
|
||||||
|
#if LLVM_VERSION_MAJOR >= 12
|
||||||
|
fileout = MakeStreamOut(compiler.createOutputFile(OutputFilename, false, true, true), fileoutOld);
|
||||||
|
#else
|
||||||
fileout = MakeStreamOut(compiler.createOutputFile(OutputFilename, false, true, "", "", true), fileoutOld);
|
fileout = MakeStreamOut(compiler.createOutputFile(OutputFilename, false, true, "", "", true), fileoutOld);
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
fileout = MakeStreamOut(compiler.createDefaultOutputFile(false, "a", "cpp"), fileoutOld);
|
fileout = MakeStreamOut(compiler.createDefaultOutputFile(false, "a", "cpp"), fileoutOld);
|
||||||
AthenaError =
|
AthenaError =
|
||||||
@@ -1247,14 +1325,17 @@ int main(int argc, const char** argv) {
|
|||||||
llvm::cl::PrintHelpMessage();
|
llvm::cl::PrintHelpMessage();
|
||||||
|
|
||||||
std::vector<std::string> args = {
|
std::vector<std::string> args = {
|
||||||
XSTR(ATDNA_ARGV0),
|
XSTR(ATDNA_ARGV0),
|
||||||
"-fsyntax-only",
|
"-fsyntax-only",
|
||||||
"-std=c++2a",
|
"-std=c++2a",
|
||||||
"-D__atdna__=1",
|
#if __x86_64__
|
||||||
"-Wno-expansion-to-defined",
|
"-mno-sse",
|
||||||
"-Wno-nullability-completeness",
|
#endif
|
||||||
"-Werror=shadow-field",
|
"-D__atdna__=1",
|
||||||
"-I" XSTR(INSTALL_PREFIX) "/include/Athena",
|
"-Wno-expansion-to-defined",
|
||||||
|
"-Wno-nullability-completeness",
|
||||||
|
"-Werror=shadow-field",
|
||||||
|
"-I" XSTR(INSTALL_PREFIX) "/include/Athena",
|
||||||
};
|
};
|
||||||
for (int a = 1; a < argc; ++a) {
|
for (int a = 1; a < argc; ++a) {
|
||||||
args.emplace_back(argv[a]);
|
args.emplace_back(argv[a]);
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ BEGIN
|
|||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "Jackoalan / Antidote"
|
VALUE "CompanyName", "Jackoalan / Antidote"
|
||||||
VALUE "FileDescription", "ATDNA"
|
VALUE "FileDescription", "ATDNA"
|
||||||
VALUE "FileVersion", "@ATHENA_MAJOR_VERSION@.@ATHENA_MINOR_VERSION@.@ATHENA_PATCH_VERSION@"
|
VALUE "FileVersion", "@ATHENA_VERSION@"
|
||||||
VALUE "LegalCopyright", "Copyright (C) 2016 Jackoalan / Antidote"
|
VALUE "LegalCopyright", "Copyright (C) 2016 Jackoalan / Antidote"
|
||||||
VALUE "InternalName", "atdna"
|
VALUE "InternalName", "atdna"
|
||||||
VALUE "OriginalFilename", "atdna.exe"
|
VALUE "OriginalFilename", "atdna.exe"
|
||||||
VALUE "ProductName", "ATDNA"
|
VALUE "ProductName", "ATDNA"
|
||||||
VALUE "ProductVersion", "@ATHENA_MAJOR_VERSION@.@ATHENA_MINOR_VERSION@.@ATHENA_PATCH_VERSION@"
|
VALUE "ProductVersion", "@ATHENA_VERSION@"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|||||||
51
cmake/FindDiaSDK.cmake
Normal file
51
cmake/FindDiaSDK.cmake
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
# From https://github.com/microsoft/DirectXShaderCompiler/blob/18c9e114f9c314f93e68fbc72ce207d4ed2e65ae/cmake/modules/FindDiaSDK.cmake
|
||||||
|
# This file is distributed under the University of Illinois Open Source
|
||||||
|
|
||||||
|
# Find the DIA SDK path.
|
||||||
|
# It will typically look something like this:
|
||||||
|
# C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\DIA SDK\include
|
||||||
|
|
||||||
|
# CMAKE_GENERATOR_INSTANCE has the location of Visual Studio used
|
||||||
|
# i.e. C:/Program Files (x86)/Microsoft Visual Studio/2019/Community
|
||||||
|
set(VS_PATH ${CMAKE_GENERATOR_INSTANCE})
|
||||||
|
get_filename_component(VS_DIA_INC_PATH "${VS_PATH}/DIA SDK/include" ABSOLUTE CACHE)
|
||||||
|
|
||||||
|
# Starting in VS 15.2, vswhere is included.
|
||||||
|
# Unclear what the right component to search for is, might be Microsoft.VisualStudio.Component.VC.DiagnosticTools
|
||||||
|
# (although the friendly name of that is C++ profiling tools). The toolset is the most likely target.
|
||||||
|
set(PROGRAMFILES_X86 "ProgramFiles(x86)")
|
||||||
|
execute_process(
|
||||||
|
COMMAND "$ENV{${PROGRAMFILES_X86}}/Microsoft Visual Studio/Installer/vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
|
||||||
|
OUTPUT_VARIABLE VSWHERE_LATEST
|
||||||
|
ERROR_QUIET
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
|
||||||
|
find_path(DIASDK_INCLUDE_DIR # Set variable DIASDK_INCLUDE_DIR
|
||||||
|
dia2.h # Find a path with dia2.h
|
||||||
|
HINTS "${VS_DIA_INC_PATH}"
|
||||||
|
HINTS "${VSWHERE_LATEST}/DIA SDK/include"
|
||||||
|
DOC "path to DIA SDK header files"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if ((CMAKE_GENERATOR_PLATFORM STREQUAL "x64") OR ("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "x64"))
|
||||||
|
find_library(DIASDK_GUIDS_LIBRARY NAMES diaguids.lib HINTS ${DIASDK_INCLUDE_DIR}/../lib/amd64 )
|
||||||
|
elseif ((CMAKE_GENERATOR_PLATFORM STREQUAL "ARM") OR ("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM"))
|
||||||
|
find_library(DIASDK_GUIDS_LIBRARY NAMES diaguids.lib HINTS ${DIASDK_INCLUDE_DIR}/../lib/arm )
|
||||||
|
elseif ((CMAKE_GENERATOR_PLATFORM MATCHES "ARM64.*") OR ("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" MATCHES "ARM64.*"))
|
||||||
|
find_library(DIASDK_GUIDS_LIBRARY NAMES diaguids.lib HINTS ${DIASDK_INCLUDE_DIR}/../lib/arm64 )
|
||||||
|
else ((CMAKE_GENERATOR_PLATFORM STREQUAL "x64") OR ("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "x64"))
|
||||||
|
find_library(DIASDK_GUIDS_LIBRARY NAMES diaguids.lib HINTS ${DIASDK_INCLUDE_DIR}/../lib )
|
||||||
|
endif((CMAKE_GENERATOR_PLATFORM STREQUAL "x64") OR ("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "x64"))
|
||||||
|
|
||||||
|
set(DIASDK_LIBRARIES ${DIASDK_GUIDS_LIBRARY})
|
||||||
|
set(DIASDK_INCLUDE_DIRS ${DIASDK_INCLUDE_DIR})
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
# handle the QUIETLY and REQUIRED arguments and set DIASDK_FOUND to TRUE
|
||||||
|
# if all listed variables are TRUE
|
||||||
|
find_package_handle_standard_args(DiaSDK DEFAULT_MSG
|
||||||
|
DIASDK_LIBRARIES DIASDK_INCLUDE_DIR)
|
||||||
|
|
||||||
|
mark_as_advanced(DIASDK_INCLUDE_DIRS DIASDK_LIBRARIES)
|
||||||
1
extern/CMakeLists.txt
vendored
1
extern/CMakeLists.txt
vendored
@@ -7,7 +7,6 @@ add_subdirectory(yaml)
|
|||||||
if(NOT TARGET fmt)
|
if(NOT TARGET fmt)
|
||||||
add_subdirectory(fmt)
|
add_subdirectory(fmt)
|
||||||
target_compile_definitions(fmt PUBLIC
|
target_compile_definitions(fmt PUBLIC
|
||||||
FMT_STRING_ALIAS=1
|
|
||||||
FMT_ARM_ABI_COMPATIBILITY=1
|
FMT_ARM_ABI_COMPATIBILITY=1
|
||||||
FMT_EXCEPTIONS=0)
|
FMT_EXCEPTIONS=0)
|
||||||
target_compile_definitions(fmt INTERFACE
|
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
2
extern/yaml/src/yaml_private.h
vendored
2
extern/yaml/src/yaml_private.h
vendored
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <yaml.h>
|
#include <athena/yaml.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|||||||
88
extern/zlib/CMakeLists.txt
vendored
88
extern/zlib/CMakeLists.txt
vendored
@@ -1,40 +1,48 @@
|
|||||||
if(NOT WIN32 AND NOT NX) # remove when specter/freetype is gone
|
if (APPLE)
|
||||||
find_library(ZLIB_LIB NAMES zlib z)
|
# always use toolchain zlib
|
||||||
endif()
|
set(ZLIB_REQUIRED REQUIRED)
|
||||||
if(NOT ZLIB_LIB)
|
endif ()
|
||||||
message(STATUS "Using Athena's built-in zlib")
|
find_package(ZLIB ${ZLIB_REQUIRED})
|
||||||
add_library(z
|
if (ZLIB_FOUND)
|
||||||
adler32.c
|
add_library(z INTERFACE)
|
||||||
compress.c
|
target_link_libraries(z INTERFACE ${ZLIB_LIBRARIES})
|
||||||
crc32.c
|
target_include_directories(z INTERFACE ${ZLIB_INCLUDE_DIRS})
|
||||||
deflate.c
|
set(ZLIB_LIBRARIES z CACHE STRING "zlib libraries" FORCE)
|
||||||
infback.c
|
set(ATHENA_ZLIB NO CACHE BOOL "Using built-in zlib" FORCE)
|
||||||
inffast.c
|
else ()
|
||||||
inflate.c
|
message(STATUS "Using Athena's built-in zlib")
|
||||||
inftrees.c
|
add_library(z
|
||||||
trees.c
|
adler32.c
|
||||||
uncompr.c
|
compress.c
|
||||||
zutil.c
|
crc32.c
|
||||||
crc32.h
|
deflate.c
|
||||||
deflate.h
|
infback.c
|
||||||
gzguts.h
|
inffast.c
|
||||||
inffast.h
|
inflate.c
|
||||||
inffixed.h
|
inftrees.c
|
||||||
inflate.h
|
trees.c
|
||||||
inftrees.h
|
uncompr.c
|
||||||
trees.h
|
zutil.c
|
||||||
zconf.h
|
include/crc32.h
|
||||||
zlib.h
|
include/deflate.h
|
||||||
zutil.h)
|
include/gzguts.h
|
||||||
if(WIN32 AND NOT UNIX)
|
include/inffast.h
|
||||||
install(FILES zconf.h zlib.h DESTINATION include COMPONENT zlib)
|
include/inffixed.h
|
||||||
install(TARGETS z DESTINATION lib COMPONENT zlib)
|
include/inflate.h
|
||||||
else()
|
include/inftrees.h
|
||||||
target_compile_options(z PRIVATE -Wno-implicit-fallthrough)
|
include/trees.h
|
||||||
endif()
|
include/zconf.h
|
||||||
set(ZLIB_LIBRARIES z CACHE PATH "Zlib libraries" FORCE)
|
include/zlib.h
|
||||||
set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "Zlib include path" FORCE)
|
include/zutil.h)
|
||||||
else()
|
if (WIN32 AND NOT UNIX)
|
||||||
set(ZLIB_LIBRARIES ${ZLIB_LIB} CACHE PATH "Zlib libraries" FORCE)
|
install(FILES include/zconf.h include/zlib.h DESTINATION include COMPONENT zlib)
|
||||||
find_path(ZLIB_INCLUDE_DIR zlib.h)
|
install(TARGETS z DESTINATION lib COMPONENT zlib)
|
||||||
endif()
|
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 ()
|
||||||
|
|||||||
@@ -147,18 +147,20 @@ struct BinarySize {
|
|||||||
}
|
}
|
||||||
template <class T, Endian DNAE>
|
template <class T, Endian DNAE>
|
||||||
static std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& s) {
|
static std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& s) {
|
||||||
for (auto& v : var)
|
for (auto& v : var) {
|
||||||
BinarySize<PropOp>::Do<std::remove_reference_t<decltype(v)>, DNAE>(id, v, s);
|
BinarySize<PropOp>::template Do<std::remove_reference_t<decltype(v)>, DNAE>(id, v, s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
template <class T, Endian DNAE>
|
template <class T, Endian DNAE>
|
||||||
static void DoSize(const PropId& id, T& var, StreamT& s) {
|
static void DoSize(const PropId& id, T& var, StreamT& s) {
|
||||||
BinarySize<PropOp>::Do<T, DNAE>(id, var, s);
|
BinarySize<PropOp>::template Do<T, DNAE>(id, var, s);
|
||||||
}
|
}
|
||||||
template <class T, class S, Endian DNAE>
|
template <class T, class S, Endian DNAE>
|
||||||
static std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
|
static std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
|
||||||
StreamT& s) {
|
StreamT& s) {
|
||||||
for (T& v : vector)
|
for (T& v : vector) {
|
||||||
BinarySize<PropOp>::Do<T, DNAE>(id, v, s);
|
BinarySize<PropOp>::template Do<T, DNAE>(id, v, s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
template <class T, class S, Endian DNAE>
|
template <class T, class S, Endian DNAE>
|
||||||
static std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
|
static std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
|
||||||
@@ -255,7 +257,7 @@ struct PropCount {
|
|||||||
}
|
}
|
||||||
template <class T, Endian DNAE>
|
template <class T, Endian DNAE>
|
||||||
static void DoSize(const PropId& id, T& var, StreamT& s) {
|
static void DoSize(const PropId& id, T& var, StreamT& s) {
|
||||||
PropCount<PropOp>::Do<T, DNAE>(id, var, s);
|
PropCount<PropOp>::template Do<T, DNAE>(id, var, s);
|
||||||
}
|
}
|
||||||
template <class T, class S, Endian DNAE>
|
template <class T, class S, Endian DNAE>
|
||||||
static void Do(const PropId& id, std::vector<T>& vector, const S& count, StreamT& s) {
|
static void Do(const PropId& id, std::vector<T>& vector, const S& count, StreamT& s) {
|
||||||
@@ -327,12 +329,13 @@ struct Read {
|
|||||||
}
|
}
|
||||||
template <class T, Endian DNAE>
|
template <class T, Endian DNAE>
|
||||||
static std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& s) {
|
static std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& s) {
|
||||||
for (auto& v : var)
|
for (auto& v : var) {
|
||||||
Read<PropOp>::Do<std::remove_reference_t<decltype(v)>, DNAE>(id, v, s);
|
Read<PropOp>::template Do<std::remove_reference_t<decltype(v)>, DNAE>(id, v, s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
template <class T, Endian DNAE>
|
template <class T, Endian DNAE>
|
||||||
static void DoSize(const PropId& id, T& var, StreamT& s) {
|
static void DoSize(const PropId& id, T& var, StreamT& s) {
|
||||||
Read<PropOp>::Do<T, DNAE>(id, var, s);
|
Read<PropOp>::template Do<T, DNAE>(id, var, s);
|
||||||
}
|
}
|
||||||
template <class T, class S, Endian DNAE>
|
template <class T, class S, Endian DNAE>
|
||||||
static std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
|
static std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
|
||||||
@@ -341,7 +344,7 @@ struct Read {
|
|||||||
vector.reserve(count);
|
vector.reserve(count);
|
||||||
for (size_t i = 0; i < static_cast<size_t>(count); ++i) {
|
for (size_t i = 0; i < static_cast<size_t>(count); ++i) {
|
||||||
vector.emplace_back();
|
vector.emplace_back();
|
||||||
Read<PropOp>::Do<T, DNAE>(id, vector.back(), r);
|
Read<PropOp>::template Do<T, DNAE>(id, vector.back(), r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
template <class T, class S, Endian DNAE>
|
template <class T, class S, Endian DNAE>
|
||||||
@@ -483,18 +486,20 @@ struct Write {
|
|||||||
}
|
}
|
||||||
template <class T, Endian DNAE>
|
template <class T, Endian DNAE>
|
||||||
static std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& s) {
|
static std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& s) {
|
||||||
for (auto& v : var)
|
for (auto& v : var) {
|
||||||
Write<PropOp>::Do<std::remove_reference_t<decltype(v)>, DNAE>(id, v, s);
|
Write<PropOp>::template Do<std::remove_reference_t<decltype(v)>, DNAE>(id, v, s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
template <class T, Endian DNAE>
|
template <class T, Endian DNAE>
|
||||||
static void DoSize(const PropId& id, T& var, StreamT& s) {
|
static void DoSize(const PropId& id, T& var, StreamT& s) {
|
||||||
Write<PropOp>::Do<T, DNAE>(id, var, s);
|
Write<PropOp>::template Do<T, DNAE>(id, var, s);
|
||||||
}
|
}
|
||||||
template <class T, class S, Endian DNAE>
|
template <class T, class S, Endian DNAE>
|
||||||
static std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
|
static std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
|
||||||
StreamT& w) {
|
StreamT& w) {
|
||||||
for (T& v : vector)
|
for (T& v : vector) {
|
||||||
Write<PropOp>::Do<T, DNAE>(id, v, w);
|
Write<PropOp>::template Do<T, DNAE>(id, v, w);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
template <class T, class S, Endian DNAE>
|
template <class T, class S, Endian DNAE>
|
||||||
static std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
|
static std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
|
||||||
@@ -596,9 +601,11 @@ struct ReadYaml {
|
|||||||
template <class T, Endian DNAE>
|
template <class T, Endian DNAE>
|
||||||
static std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& r) {
|
static std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& r) {
|
||||||
size_t _count;
|
size_t _count;
|
||||||
if (auto __v = r.enterSubVector(id.name, _count))
|
if (auto __v = r.enterSubVector(id.name, _count)) {
|
||||||
for (size_t i = 0; i < _count && i < std::extent_v<T>; ++i)
|
for (size_t i = 0; i < _count && i < std::extent_v<T>; ++i) {
|
||||||
ReadYaml<PropOp>::Do<std::remove_reference_t<decltype(var[i])>, DNAE>({}, var[i], r);
|
ReadYaml<PropOp>::template Do<std::remove_reference_t<decltype(var[i])>, DNAE>({}, var[i], r);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
template <class T, Endian DNAE>
|
template <class T, Endian DNAE>
|
||||||
static void DoSize(const PropId& id, T& var, StreamT& s) {
|
static void DoSize(const PropId& id, T& var, StreamT& s) {
|
||||||
@@ -613,7 +620,7 @@ struct ReadYaml {
|
|||||||
vector.reserve(_count);
|
vector.reserve(_count);
|
||||||
for (size_t i = 0; i < _count; ++i) {
|
for (size_t i = 0; i < _count; ++i) {
|
||||||
vector.emplace_back();
|
vector.emplace_back();
|
||||||
ReadYaml<PropOp>::Do<T, DNAE>({}, vector.back(), r);
|
ReadYaml<PropOp>::template Do<T, DNAE>({}, vector.back(), r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Horrible reference abuse (but it works) */
|
/* Horrible reference abuse (but it works) */
|
||||||
@@ -712,9 +719,11 @@ struct WriteYaml {
|
|||||||
}
|
}
|
||||||
template <class T, Endian DNAE>
|
template <class T, Endian DNAE>
|
||||||
static std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& w) {
|
static std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& w) {
|
||||||
if (auto __v = w.enterSubVector(id.name))
|
if (auto __v = w.enterSubVector(id.name)) {
|
||||||
for (auto& v : var)
|
for (auto& v : var) {
|
||||||
WriteYaml<PropOp>::Do<std::remove_reference_t<decltype(v)>, DNAE>({}, v, w);
|
WriteYaml<PropOp>::template Do<std::remove_reference_t<decltype(v)>, DNAE>({}, v, w);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
template <class T, Endian DNAE>
|
template <class T, Endian DNAE>
|
||||||
static void DoSize(const PropId& id, T& var, StreamT& s) {
|
static void DoSize(const PropId& id, T& var, StreamT& s) {
|
||||||
@@ -723,9 +732,11 @@ struct WriteYaml {
|
|||||||
template <class T, class S, Endian DNAE>
|
template <class T, class S, Endian DNAE>
|
||||||
static std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
|
static std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
|
||||||
StreamT& w) {
|
StreamT& w) {
|
||||||
if (auto __v = w.enterSubVector(id.name))
|
if (auto __v = w.enterSubVector(id.name)) {
|
||||||
for (T& v : vector)
|
for (T& v : vector) {
|
||||||
WriteYaml<PropOp>::Do<T, DNAE>(id, v, w);
|
WriteYaml<PropOp>::template Do<T, DNAE>(id, v, w);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
template <class T, class S, Endian DNAE>
|
template <class T, class S, Endian DNAE>
|
||||||
static std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
|
static std::enable_if_t<std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
using mode_t = int;
|
using mode_t = int;
|
||||||
|
#else
|
||||||
|
#include <sys/stat.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace athena {
|
namespace athena {
|
||||||
|
|||||||
@@ -1,14 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#if _WIN32
|
|
||||||
#ifndef WIN32_LEAN_AND_MEAN
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#endif
|
|
||||||
#include <windows.h>
|
|
||||||
#else
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@@ -40,8 +32,7 @@ public:
|
|||||||
|
|
||||||
void open();
|
void open();
|
||||||
void close();
|
void close();
|
||||||
bool isOpen() const { return m_fileHandle != 0; }
|
bool isOpen() const { return m_fileHandle != nullptr; }
|
||||||
bool save();
|
|
||||||
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current) override;
|
void seek(atInt64 pos, SeekOrigin origin = SeekOrigin::Current) override;
|
||||||
atUint64 position() const override;
|
atUint64 position() const override;
|
||||||
atUint64 length() const override;
|
atUint64 length() const override;
|
||||||
@@ -50,7 +41,7 @@ public:
|
|||||||
void setCacheSize(const atInt32 blockSize);
|
void setCacheSize(const atInt32 blockSize);
|
||||||
|
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
using HandleType = HANDLE;
|
using HandleType = void*;
|
||||||
#else
|
#else
|
||||||
using HandleType = FILE*;
|
using HandleType = FILE*;
|
||||||
#endif
|
#endif
|
||||||
@@ -64,6 +55,7 @@ protected:
|
|||||||
std::string m_filename;
|
std::string m_filename;
|
||||||
#endif
|
#endif
|
||||||
HandleType m_fileHandle;
|
HandleType m_fileHandle;
|
||||||
|
atUint64 m_fileSize;
|
||||||
std::unique_ptr<atUint8[]> m_cacheData;
|
std::unique_ptr<atUint8[]> m_cacheData;
|
||||||
atInt32 m_blockSize;
|
atInt32 m_blockSize;
|
||||||
atInt32 m_curBlock;
|
atInt32 m_curBlock;
|
||||||
|
|||||||
@@ -1,13 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#ifndef WIN32_LEAN_AND_MEAN
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#endif
|
|
||||||
#include <windows.h>
|
|
||||||
#else
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "athena/IStreamWriter.hpp"
|
#include "athena/IStreamWriter.hpp"
|
||||||
#include "athena/Types.hpp"
|
#include "athena/Types.hpp"
|
||||||
@@ -43,7 +36,7 @@ public:
|
|||||||
void writeUBytes(const atUint8* data, atUint64 len) override;
|
void writeUBytes(const atUint8* data, atUint64 len) override;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
using HandleType = HANDLE;
|
using HandleType = void*;
|
||||||
#else
|
#else
|
||||||
using HandleType = FILE*;
|
using HandleType = FILE*;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
#endif
|
#endif
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
#if defined(GEKKO) || defined(__SWITCH__)
|
#if defined(GEKKO) || defined(__SWITCH__) || defined(EMSCRIPTEN)
|
||||||
#include "gekko_support.h"
|
#include "gekko_support.h"
|
||||||
typedef struct stat atStat64_t;
|
typedef struct stat atStat64_t;
|
||||||
#define atStat64 stat
|
#define atStat64 stat
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <yaml.h>
|
#include "yaml.h"
|
||||||
|
|
||||||
#include "athena/Types.hpp"
|
#include "athena/Types.hpp"
|
||||||
|
|
||||||
|
|||||||
@@ -1518,6 +1518,11 @@ public:
|
|||||||
const __simd_storage<_Up, __simd_abi<_StorageKind::_Array, __Unum_element>>& other) {
|
const __simd_storage<_Up, __simd_abi<_StorageKind::_Array, __Unum_element>>& other) {
|
||||||
std::copy(other.__native().begin(), other.__native().end(), __storage_.begin());
|
std::copy(other.__native().begin(), other.__native().end(), __storage_.begin());
|
||||||
}
|
}
|
||||||
|
template <typename... _T2, std::enable_if_t<(... && std::is_convertible_v<_T2, _Tp>), bool> = true,
|
||||||
|
std::enable_if_t<sizeof...(_T2) == __num_element, bool> = true>
|
||||||
|
constexpr __simd_storage(_T2... values) : __storage_{values...} {}
|
||||||
|
template <std::enable_if_t<__num_element == 4, bool> = true>
|
||||||
|
constexpr __simd_storage(_Tp __rv) : __storage_{__rv, __rv, __rv, __rv} {}
|
||||||
constexpr const storage_type& __native() const { return __storage_; }
|
constexpr const storage_type& __native() const { return __storage_; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ using namespace std;
|
|||||||
#elif __ARM_NEON
|
#elif __ARM_NEON
|
||||||
#include "simd_neon.hpp"
|
#include "simd_neon.hpp"
|
||||||
#else
|
#else
|
||||||
namespace simd_abi {
|
namespace athena::_simd::simd_abi {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct athena_native {};
|
struct athena_native {};
|
||||||
template <>
|
template <>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public:
|
|||||||
using storage_type = __m128;
|
using storage_type = __m128;
|
||||||
storage_type __storage_{};
|
storage_type __storage_{};
|
||||||
[[nodiscard]] inline float __get(size_t __index) const noexcept {
|
[[nodiscard]] inline float __get(size_t __index) const noexcept {
|
||||||
#if _MSC_VER && !defined(__clang__)
|
#if _MSC_VER
|
||||||
alignas(16) std::array<float, 4> sse_data;
|
alignas(16) std::array<float, 4> sse_data;
|
||||||
_mm_store_ps(sse_data.data(), __storage_);
|
_mm_store_ps(sse_data.data(), __storage_);
|
||||||
return sse_data[__index];
|
return sse_data[__index];
|
||||||
@@ -40,7 +40,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
inline void __set(size_t __index, float __val) noexcept {
|
inline void __set(size_t __index, float __val) noexcept {
|
||||||
#if _MSC_VER && !defined(__clang__)
|
#if _MSC_VER
|
||||||
alignas(16) std::array<float, 4> sse_data;
|
alignas(16) std::array<float, 4> sse_data;
|
||||||
_mm_store_ps(sse_data.data(), __storage_);
|
_mm_store_ps(sse_data.data(), __storage_);
|
||||||
sse_data[__index] = __val;
|
sse_data[__index] = __val;
|
||||||
@@ -210,7 +210,7 @@ public:
|
|||||||
using storage_type = std::array<__m128d, 2>;
|
using storage_type = std::array<__m128d, 2>;
|
||||||
storage_type __storage_{};
|
storage_type __storage_{};
|
||||||
[[nodiscard]] inline double __get(size_t __index) const noexcept {
|
[[nodiscard]] inline double __get(size_t __index) const noexcept {
|
||||||
#if _MSC_VER && !defined(__clang__)
|
#if _MSC_VER
|
||||||
alignas(16) std::array<double, 2> sse_data;
|
alignas(16) std::array<double, 2> sse_data;
|
||||||
_mm_store_pd(sse_data.data(), __storage_[__index / 2]);
|
_mm_store_pd(sse_data.data(), __storage_[__index / 2]);
|
||||||
return sse_data[__index % 2];
|
return sse_data[__index % 2];
|
||||||
@@ -219,13 +219,13 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
inline void __set(size_t __index, double __val) noexcept {
|
inline void __set(size_t __index, double __val) noexcept {
|
||||||
#if _MSC_VER && !defined(__clang__)
|
#if _MSC_VER
|
||||||
alignas(16) std::array<double, 2> sse_data;
|
alignas(16) std::array<double, 2> sse_data;
|
||||||
_mm_store_pd(sse_data.data(), __storage_[__index / 2]);
|
_mm_store_pd(sse_data.data(), __storage_[__index / 2]);
|
||||||
sse_data[__index % 2] = __val;
|
sse_data[__index % 2] = __val;
|
||||||
__storage_[__index / 2] = _mm_load_pd(sse_data.data());
|
__storage_[__index / 2] = _mm_load_pd(sse_data.data());
|
||||||
#else
|
#else
|
||||||
__storage_[__index / 2][__index % 2] = __val;
|
__storage_[__index / 2][__index % 2] = __val;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
// Make GCC happy
|
// Make GCC happy
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ libdir=${prefix}/lib
|
|||||||
|
|
||||||
Name: libAthena
|
Name: libAthena
|
||||||
Description: Basic cross platform IO library
|
Description: Basic cross platform IO library
|
||||||
Version: @ATHENA_VERSION@
|
Version: @ATHENA_VERSION_STRING@
|
||||||
Cflags: -I${includedir}/Athena
|
Cflags: -I${includedir}/Athena
|
||||||
Libs: -L${libdir} -lathena-core -lathena-sakura -lathena-zelda -lathena-wiiSave
|
Libs: -L${libdir} -lathena-core -lathena-sakura -lathena-zelda -lathena-wiiSave
|
||||||
Requires: zlib
|
Requires: zlib
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ void FileReader::open() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_fileSize = utility::fileSize(m_filename);
|
||||||
|
|
||||||
// reset error
|
// reset error
|
||||||
m_hasError = false;
|
m_hasError = false;
|
||||||
}
|
}
|
||||||
@@ -112,7 +114,7 @@ atUint64 FileReader::length() const {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return utility::fileSize(m_filename);
|
return m_fileSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
atUint64 FileReader::readUBytesToBuf(void* buf, atUint64 len) {
|
atUint64 FileReader::readUBytesToBuf(void* buf, atUint64 len) {
|
||||||
@@ -126,11 +128,10 @@ atUint64 FileReader::readUBytesToBuf(void* buf, atUint64 len) {
|
|||||||
if (m_blockSize <= 0)
|
if (m_blockSize <= 0)
|
||||||
return fread(buf, 1, len, m_fileHandle);
|
return fread(buf, 1, len, m_fileHandle);
|
||||||
else {
|
else {
|
||||||
atUint64 fs = utility::fileSize(m_filename);
|
if (m_offset >= m_fileSize)
|
||||||
if (m_offset >= fs)
|
|
||||||
return 0;
|
return 0;
|
||||||
if (m_offset + len >= fs)
|
if (m_offset + len >= m_fileSize)
|
||||||
len = fs - m_offset;
|
len = m_fileSize - m_offset;
|
||||||
|
|
||||||
size_t block = m_offset / m_blockSize;
|
size_t block = m_offset / m_blockSize;
|
||||||
atUint64 cacheOffset = m_offset % m_blockSize;
|
atUint64 cacheOffset = m_offset % m_blockSize;
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
#include "athena/FileReader.hpp"
|
#include "athena/FileReader.hpp"
|
||||||
|
|
||||||
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
#include "win32_largefilewrapper.h"
|
#include "win32_largefilewrapper.h"
|
||||||
|
|
||||||
namespace athena::io {
|
namespace athena::io {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||||
#include "osx_largefilewrapper.h"
|
#include "osx_largefilewrapper.h"
|
||||||
#elif defined(GEKKO) || defined(__SWITCH__)
|
#elif defined(GEKKO) || defined(__SWITCH__)
|
||||||
#include "gekko_support.h"
|
#include "athena/gekko_support.h"
|
||||||
#include "osx_largefilewrapper.h"
|
#include "osx_largefilewrapper.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
#include "athena/FileWriter.hpp"
|
#include "athena/FileWriter.hpp"
|
||||||
|
|
||||||
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
|
#include <windows.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ MemoryReader::MemoryReader(const void* data, atUint64 length, bool takeOwnership
|
|||||||
|
|
||||||
MemoryReader::~MemoryReader() {
|
MemoryReader::~MemoryReader() {
|
||||||
if (m_owns)
|
if (m_owns)
|
||||||
delete[] reinterpret_cast<const atUint8*>(m_data);
|
delete[] static_cast<const atUint8*>(m_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
MemoryCopyReader::MemoryCopyReader(const void* data, atUint64 length) : MemoryReader(data, length, false) {
|
MemoryCopyReader::MemoryCopyReader(const void* data, atUint64 length) : MemoryReader(data, length, false) {
|
||||||
@@ -111,7 +111,7 @@ atUint64 MemoryReader::readUBytesToBuf(void* buf, atUint64 length) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
length = std::min(length, m_length - m_position);
|
length = std::min(length, m_length - m_position);
|
||||||
memmove(buf, reinterpret_cast<const atUint8*>(m_data) + m_position, length);
|
memmove(buf, static_cast<const atUint8*>(m_data) + m_position, length);
|
||||||
m_position += length;
|
m_position += length;
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ void MemoryWriter::writeUBytes(const atUint8* data, atUint64 length) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
memmove(reinterpret_cast<atInt8*>(m_data + m_position), data, length);
|
memmove(m_data + m_position, data, length);
|
||||||
|
|
||||||
m_position += length;
|
m_position += length;
|
||||||
}
|
}
|
||||||
@@ -248,7 +248,7 @@ void MemoryCopyWriter::writeUBytes(const atUint8* data, atUint64 length) {
|
|||||||
if (m_position + length > m_length)
|
if (m_position + length > m_length)
|
||||||
resize(m_position + length);
|
resize(m_position + length);
|
||||||
|
|
||||||
memmove(reinterpret_cast<atInt8*>(m_data + m_position), data, length);
|
memmove(m_data + m_position, data, length);
|
||||||
|
|
||||||
m_position += length;
|
m_position += length;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include "utf8proc.h"
|
#include "athena/utf8proc.h"
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#if defined(GEKKO) || defined(__SWITCH__)
|
#if defined(GEKKO) || defined(__SWITCH__)
|
||||||
#include "gekko_support.h"
|
#include "athena/gekko_support.h"
|
||||||
#define SYMLOOP_MAX 8
|
#define SYMLOOP_MAX 8
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
|||||||
Reference in New Issue
Block a user