mirror of
https://github.com/libAthena/athena.git
synced 2025-12-08 13:15:05 +00:00
Compare commits
24 Commits
a87e8bb39f
...
11b86d7634
| Author | SHA1 | Date | |
|---|---|---|---|
| 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-*'
|
||||
197
.github/workflows/build.yml
vendored
Normal file
197
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,197 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build-linux-x86_64:
|
||||
name: Build Linux (GCC x86_64)
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get -y update
|
||||
sudo apt-get -y install cmake ninja-build ccache llvm-11-dev libclang-11-dev clang-11
|
||||
|
||||
- name: Configure ccache
|
||||
uses: hendrikmuhs/ccache-action@v1
|
||||
with:
|
||||
key: ubuntu-20.04-gcc
|
||||
max-size: 1G
|
||||
|
||||
- name: Configure CMake
|
||||
run: |
|
||||
cmake -B build . -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DClang_DIR=/usr/lib/cmake/clang-11 \
|
||||
-DATDNA_DYNAMIC_LLVM=OFF -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
|
||||
- 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-20.04
|
||||
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
|
||||
distro: ubuntu20.04
|
||||
githubToken: ${{github.token}}
|
||||
dockerRunArgs: |
|
||||
--volume "${PWD}:/workspace"
|
||||
install: |
|
||||
apt-get -y update
|
||||
apt-get -y install build-essential cmake ninja-build llvm-11-dev libclang-11-dev clang-11
|
||||
run: |
|
||||
cmake -B build . -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DClang_DIR=/usr/lib/cmake/clang-11 -DATDNA_DYNAMIC_LLVM=OFF
|
||||
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-10.15
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
brew update
|
||||
brew install ninja ccache
|
||||
# universal clang+llvm from macports
|
||||
curl -LSfs https://axiodl.com/files/clang-11-11.1.0_1.mpkg -o /tmp/clang-11-11.1.0_1.mpkg
|
||||
sudo installer -pkg /tmp/clang-11-11.1.0_1.mpkg -target /
|
||||
|
||||
- name: Configure ccache
|
||||
uses: hendrikmuhs/ccache-action@v1
|
||||
with:
|
||||
key: macos-10.15-appleclang
|
||||
max-size: 1G
|
||||
|
||||
- name: Configure CMake
|
||||
run: |
|
||||
cmake -B build . -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" \
|
||||
-DLLVM_ROOT_DIR=/opt/local/libexec/llvm-11 \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
|
||||
- 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: athena-macos-universal
|
||||
path: |
|
||||
build/athena-*.tar.gz
|
||||
|
||||
build-win32-amd64:
|
||||
name: Build Windows (MSVC AMD64)
|
||||
runs-on: windows-2019
|
||||
env:
|
||||
LLVM_VERSION: 10.0.1
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: Install LLVM
|
||||
run: |
|
||||
$TempDir = "$env:RUNNER_WORKSPACE\temp"
|
||||
$Filename = "LLVM-$env:LLVM_VERSION-win64.exe"
|
||||
New-Item -Path "$TempDir" -ItemType Directory -ea 0
|
||||
(New-Object Net.WebClient).DownloadFile("https://axiodl.com/files/$Filename", "$TempDir\$Filename")
|
||||
Start-Process "$TempDir\$Filename" -ArgumentList "/S /D=$env:RUNNER_WORKSPACE\LLVM" -Wait
|
||||
|
||||
- name: Install dependencies
|
||||
run: choco install ninja
|
||||
|
||||
- name: Enable Visual Studio environment
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
|
||||
- name: Configure CMake
|
||||
run: |
|
||||
$workspace = $env:RUNNER_WORKSPACE -replace '\\', '/'
|
||||
cmake -B build . -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo `
|
||||
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded `
|
||||
-DLLVM_ROOT_DIR="$workspace/LLVM"
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build --target package --verbose
|
||||
|
||||
- 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/*/*
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -18,4 +18,7 @@ PKGBUILD
|
||||
**/doc
|
||||
**/obj
|
||||
**/Makefile
|
||||
|
||||
/build
|
||||
/out
|
||||
/cmake-build-*
|
||||
/.idea
|
||||
@@ -1,4 +1,4 @@
|
||||
set(PACKAGE_VERSION "@ATHENA_VERSION@")
|
||||
set(PACKAGE_VERSION "@ATHENA_VERSION_STRING@")
|
||||
|
||||
# Check whether the requested PACKAGE_FIND_VERSION is compatible
|
||||
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
|
||||
|
||||
195
CMakeLists.txt
195
CMakeLists.txt
@@ -1,21 +1,138 @@
|
||||
cmake_minimum_required(VERSION 3.10 FATAL_ERROR) # because of c++17
|
||||
# Set MSVC runtime library flags from CMAKE_MSVC_RUNTIME_LIBRARY
|
||||
cmake_policy(SET CMP0091 NEW)
|
||||
project(athena)
|
||||
if (NOT MSVC)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
endif()
|
||||
|
||||
##################
|
||||
# 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_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)
|
||||
set(ATHENA_MINOR_VERSION 3)
|
||||
set(ATHENA_PATCH_VERSION 0)
|
||||
set(ATHENA_VERSION
|
||||
${ATHENA_MAJOR_VERSION}.${ATHENA_MINOR_VERSION}.${ATHENA_PATCH_VERSION})
|
||||
execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --symbolic-full-name HEAD
|
||||
OUTPUT_VARIABLE athena_git_head_symbolic
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
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_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_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_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_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})
|
||||
file(APPEND "$ENV{GITHUB_ENV}" "ATHENA_VERSION=${ATHENA_WC_DESCRIBE}")
|
||||
endif()
|
||||
|
||||
project(athena VERSION ${ATHENA_VERSION} LANGUAGES C CXX)
|
||||
|
||||
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 #
|
||||
@@ -68,8 +185,8 @@ add_library(athena-core
|
||||
include/athena/YAMLCommon.hpp
|
||||
include/athena/YAMLDocReader.hpp
|
||||
include/athena/YAMLDocWriter.hpp
|
||||
include/yaml.h
|
||||
include/utf8proc.h
|
||||
include/athena/yaml.h
|
||||
include/athena/utf8proc.h
|
||||
)
|
||||
if(WIN32)
|
||||
target_sources(athena-core PRIVATE
|
||||
@@ -97,7 +214,7 @@ else()
|
||||
if(GEKKO OR NX)
|
||||
target_sources(athena-core PRIVATE
|
||||
src/gekko_support.c
|
||||
include/gekko_support.h
|
||||
include/athena/gekko_support.h
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
@@ -200,11 +317,7 @@ set(ATHENA_ICO ${CMAKE_CURRENT_SOURCE_DIR}/Athena.ico)
|
||||
# Offer the user the choice of overriding the installation directories
|
||||
set(INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries")
|
||||
set(INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files")
|
||||
if(WIN32 AND NOT CYGWIN)
|
||||
set(INSTALL_CMAKE_DIR cmake)
|
||||
else()
|
||||
set(INSTALL_CMAKE_DIR lib/cmake/athena)
|
||||
endif()
|
||||
set(INSTALL_CMAKE_DIR lib/cmake/athena)
|
||||
|
||||
# Make relative paths absolute (needed later on)
|
||||
foreach(p LIB INCLUDE CMAKE)
|
||||
@@ -217,8 +330,8 @@ foreach(p LIB INCLUDE CMAKE)
|
||||
endforeach()
|
||||
|
||||
# Define installs
|
||||
install(DIRECTORY include DESTINATION ${INSTALL_INCLUDE_DIR}/athena COMPONENT athena)
|
||||
install(DIRECTORY extern/fmt/include DESTINATION ${INSTALL_INCLUDE_DIR}/fmt COMPONENT athena)
|
||||
install(DIRECTORY include/athena DESTINATION ${INSTALL_INCLUDE_DIR} COMPONENT athena)
|
||||
install(DIRECTORY extern/fmt/include/fmt DESTINATION ${INSTALL_INCLUDE_DIR} COMPONENT athena)
|
||||
install(TARGETS athena-core fmt
|
||||
DESTINATION ${INSTALL_LIB_DIR} EXPORT AthenaTargets COMPONENT athena)
|
||||
if(WIN32 AND NOT CYGWIN)
|
||||
@@ -272,13 +385,13 @@ add_subdirectory(atdna)
|
||||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
# Test target
|
||||
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")
|
||||
set_target_properties(atdna-test PROPERTIES SUFFIX ".elf")
|
||||
target_link_libraries(atdna-test athena-core nx)
|
||||
else()
|
||||
target_link_libraries(atdna-test athena-core)
|
||||
endif()
|
||||
target_atdna(atdna-test atdna_test.cpp atdna/test.hpp)
|
||||
endif()
|
||||
|
||||
#########
|
||||
@@ -287,25 +400,37 @@ endif()
|
||||
|
||||
include(InstallRequiredSystemLibraries)
|
||||
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_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR ${ATHENA_MAJOR_VERSION})
|
||||
set(CPACK_PACKAGE_VERSION_MINOR ${ATHENA_MINOR_VERSION})
|
||||
set(CPACK_PACKAGE_VERSION_PATCH ${ATHENA_PATCH_VERSION})
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "athena")
|
||||
if(WIN32 AND NOT UNIX)
|
||||
# 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.
|
||||
set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "athena")
|
||||
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\AthenaNSIS.bmp")
|
||||
set(CPACK_NSIS_MODIFY_PATH ON)
|
||||
set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\Athena.ico")
|
||||
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\Athena.ico")
|
||||
set(CPACK_NSIS_INSTALLED_ICON_NAME "Uninstall.exe")
|
||||
set(CPACK_NSIS_DISPLAY_NAME "Athena")
|
||||
set(CPACK_NSIS_URL_INFO_ABOUT "http://libathena.github.io")
|
||||
set(CPACK_NSIS_CONTACT "antidote.crk@gmail.com")
|
||||
endif()
|
||||
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
|
||||
|
||||
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" ARCHITECTURE_NAME)
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL Windows)
|
||||
set(SYSTEM_NAME win32)
|
||||
elseif (CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
||||
set(SYSTEM_NAME macos)
|
||||
list(LENGTH CMAKE_OSX_ARCHITECTURES num_archs)
|
||||
if (num_archs GREATER 1)
|
||||
set(ARCHITECTURE_NAME universal)
|
||||
elseif(num_archs EQUAL 1)
|
||||
set(ARCHITECTURE_NAME ${CMAKE_OSX_ARCHITECTURES})
|
||||
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)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# PKGBUILD for libAthena
|
||||
_pkgname=libathena
|
||||
pkgname=$_pkgname-git
|
||||
pkgver=@ATHENA_VERSION@
|
||||
pkgver=@ATHENA_VERSION_STRING@
|
||||
pkgrel=1
|
||||
pkgdesc="Basic cross platform IO library"
|
||||
arch=('i686' 'x86_64')
|
||||
|
||||
@@ -2,19 +2,28 @@
|
||||
# ATDNA Build #
|
||||
###############
|
||||
|
||||
if(NOT CMAKE_CROSSCOMPILING)
|
||||
|
||||
string(REPLACE -stdlib=libc++ "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
if(NOT TARGET atdna AND NOT CMAKE_CROSSCOMPILING)
|
||||
|
||||
get_directory_property(ATDNA_DEFINES COMPILE_DEFINITIONS)
|
||||
list(REMOVE_ITEM ATDNA_DEFINES _GLIBCXX_DEBUG=1)
|
||||
set_directory_properties(PROPERTIES COMPILE_DEFINITIONS "${ATDNA_DEFINES}")
|
||||
|
||||
# Find dependencies
|
||||
include(FindLLVM.cmake)
|
||||
if(NOT LLVM_FOUND)
|
||||
message(STATUS "Unable to locate LLVM installation; skipping atdna")
|
||||
else()
|
||||
if (NOT "${LLVM_ROOT_DIR}" STREQUAL "")
|
||||
# use existing LLVM_ROOT_DIR
|
||||
elseif (APPLE AND CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
|
||||
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")
|
||||
option(ATDNA_DYNAMIC_LLVM "Use dynamic library targets when linking LLVM" ON)
|
||||
@@ -22,100 +31,40 @@ else()
|
||||
option(ATDNA_DYNAMIC_LLVM "Use dynamic library targets when linking LLVM" OFF)
|
||||
endif()
|
||||
|
||||
if(ATDNA_DYNAMIC_LLVM)
|
||||
find_library(CLANGCPP_LIB clang-cpp HINTS "${LLVM_ROOT_DIR}/lib")
|
||||
if (NOT CLANGCPP_LIB)
|
||||
list(APPEND LLVM_LIBS
|
||||
clangFrontend
|
||||
clangTooling
|
||||
clangDriver
|
||||
clangSerialization
|
||||
clangParse
|
||||
clangSema
|
||||
clangAnalysis
|
||||
clangEdit
|
||||
clangAST
|
||||
clangLex
|
||||
clangBasic
|
||||
LLVM)
|
||||
else()
|
||||
list(APPEND LLVM_LIBS
|
||||
clang-cpp
|
||||
LLVM)
|
||||
endif()
|
||||
list(APPEND CLANG_LIBS clangTooling)
|
||||
set(LLVM_LIBS "")
|
||||
|
||||
if (ATDNA_DYNAMIC_LLVM)
|
||||
list(APPEND LLVM_LIBS LLVM)
|
||||
else()
|
||||
find_library(LLVMDEMANGLE_LIB LLVMDemangle HINTS "${LLVM_ROOT_DIR}/lib")
|
||||
find_library(LLVMBINARYFORMAT_LIB LLVMBinaryFormat HINTS "${LLVM_ROOT_DIR}/lib")
|
||||
if (NOT LLVMDEMANGLE_LIB)
|
||||
set(LLVMDEMANGLE_LIB "")
|
||||
function(recursive_remove_library target library)
|
||||
get_target_property(target_dependencies ${target} INTERFACE_LINK_LIBRARIES)
|
||||
foreach(dep ${target_dependencies})
|
||||
if (NOT "${dep}" STREQUAL "${library}" AND TARGET "${dep}")
|
||||
recursive_remove_library(${dep} ${library})
|
||||
endif()
|
||||
if (NOT LLVMBINARYFORMAT_LIB)
|
||||
set(LLVMBINARYFORMAT_LIB "")
|
||||
endif()
|
||||
find_library(CLANG_CPP_LIB clang-cpp HINTS "${LLVM_ROOT_DIR}/lib")
|
||||
if (NOT CLANG_CPP_LIB)
|
||||
list(APPEND CLANG_LIBS
|
||||
clangFrontend
|
||||
clangTooling
|
||||
clangDriver
|
||||
clangSerialization
|
||||
clangParse
|
||||
clangSema
|
||||
clangAnalysis
|
||||
clangEdit
|
||||
clangAST
|
||||
clangLex
|
||||
clangBasic)
|
||||
else()
|
||||
list(APPEND CLANG_LIBS
|
||||
clang-cpp)
|
||||
endforeach()
|
||||
list(FIND target_dependencies "${library}" list_index)
|
||||
if (${list_index} GREATER -1)
|
||||
list(REMOVE_AT target_dependencies ${list_index})
|
||||
set_property(TARGET ${target} PROPERTY INTERFACE_LINK_LIBRARIES "${target_dependencies}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
list(APPEND LLVM_LIBS
|
||||
${CLANG_LIBS}
|
||||
LLVMCore
|
||||
LLVMOption
|
||||
LLVMMCParser
|
||||
LLVMBitReader
|
||||
${LLVMBINARYFORMAT_LIB}
|
||||
LLVMMC
|
||||
LLVMProfileData
|
||||
LLVMSupport
|
||||
LLVMRemarks
|
||||
LLVMBitStreamReader
|
||||
${LLVMDEMANGLE_LIB}
|
||||
LLVMFrontendOpenMP)
|
||||
endif()
|
||||
|
||||
string(FIND ${LLVM_VERSION_STRING} "svn" SVN_FILTER_IDX)
|
||||
if(NOT SVN_FILTER_IDX EQUAL -1)
|
||||
string(SUBSTRING ${LLVM_VERSION_STRING} 0 ${SVN_FILTER_IDX} LLVM_VERSION_BASE)
|
||||
else()
|
||||
set(LLVM_VERSION_BASE ${LLVM_VERSION_STRING})
|
||||
endif()
|
||||
|
||||
set(CLANG_INCLUDE_DIR ${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_BASE}/include
|
||||
CACHE PATH "Clang include dir" FORCE)
|
||||
|
||||
if(UNIX)
|
||||
list(APPEND PLAT_LIBS z pthread curses)
|
||||
if (APPLE)
|
||||
list(APPEND PLAT_LIBS dl)
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
list(APPEND PLAT_LIBS dl tinfo)
|
||||
endif()
|
||||
elseif(WIN32)
|
||||
list(APPEND PLAT_LIBS Version)
|
||||
# Remove LLVM dynamic library from Clang dependencies
|
||||
foreach (lib ${CLANG_LIBS})
|
||||
recursive_remove_library(${lib} LLVM)
|
||||
endforeach ()
|
||||
# Add LLVM static libs
|
||||
list(APPEND LLVM_LIBS LLVMFrontendOpenMP LLVMOption)
|
||||
# Hack around link order issues
|
||||
target_link_libraries(clangAST INTERFACE LLVMFrontendOpenMP)
|
||||
endif()
|
||||
|
||||
# Offer the user the choice of overriding the installation directories
|
||||
set(INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files")
|
||||
set(INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables")
|
||||
if(WIN32 AND NOT CYGWIN)
|
||||
set(INSTALL_CMAKE_DIR cmake)
|
||||
else()
|
||||
set(INSTALL_CMAKE_DIR lib/cmake/atdna)
|
||||
endif()
|
||||
set(INSTALL_CMAKE_DIR lib/cmake/atdna)
|
||||
|
||||
# Make relative paths absolute (needed later on)
|
||||
foreach(p BIN INCLUDE CMAKE)
|
||||
@@ -135,14 +84,13 @@ endif()
|
||||
|
||||
# ATDNA target
|
||||
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})
|
||||
target_compile_definitions(atdna PRIVATE
|
||||
INSTALL_PREFIX=${ABS_INSTALL_BIN_DIR}
|
||||
__STDC_LIMIT_MACROS=1
|
||||
__STDC_CONSTANT_MACROS=1
|
||||
ATDNA_ARGV0=${LLVM_ROOT_DIR}/bin/clang-tool)
|
||||
target_include_directories(atdna PRIVATE ${LLVM_INCLUDE_DIRS})
|
||||
target_link_directories(atdna PRIVATE ${LLVM_LIBRARY_DIRS})
|
||||
ATDNA_ARGV0=clang-tool)
|
||||
target_include_directories(atdna PRIVATE ${CLANG_INCLUDE_DIRS})
|
||||
# Clang 10.0.x headers currently broken with C++20
|
||||
set_property(TARGET atdna PROPERTY CXX_STANDARD 17)
|
||||
if(MSVC)
|
||||
@@ -150,12 +98,12 @@ if(MSVC)
|
||||
target_compile_options(atdna PRIVATE /GR- /D_ITERATOR_DEBUG_LEVEL=0)
|
||||
set_property(TARGET atdna PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
|
||||
else()
|
||||
target_compile_options(atdna PRIVATE -fno-rtti -Wno-error)
|
||||
target_compile_options(atdna PRIVATE -fno-rtti -fvisibility=hidden -Wno-error)
|
||||
endif()
|
||||
|
||||
# Define installs
|
||||
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 #
|
||||
@@ -197,6 +145,6 @@ endif()
|
||||
|
||||
endif()
|
||||
|
||||
include(atdnaHelpers.cmake)
|
||||
|
||||
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)
|
||||
@@ -56,9 +56,11 @@ function(atdna out)
|
||||
if (NOT EXISTS "${CMAKE_OSX_SYSROOT}")
|
||||
message(FATAL_ERROR "CMAKE_OSX_SYSROOT not set")
|
||||
endif()
|
||||
file(GLOB SYSTEM_INCLUDE_DIR "${COMPILER_DIR}/../lib/clang/*/include")
|
||||
list(APPEND extraargs
|
||||
-isysroot ${CMAKE_OSX_SYSROOT}
|
||||
-stdlib++-isystem "${COMPILER_DIR}/../include/c++/v1")
|
||||
-stdlib++-isystem "${COMPILER_DIR}/../include/c++/v1"
|
||||
-isystem "${SYSTEM_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
# 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
|
||||
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
|
||||
|
||||
@@ -112,9 +112,11 @@ function(atdna out incdirs cdefs)
|
||||
if (NOT EXISTS "${CMAKE_OSX_SYSROOT}")
|
||||
message(FATAL_ERROR "CMAKE_OSX_SYSROOT not set")
|
||||
endif()
|
||||
file(GLOB SYSTEM_INCLUDE_DIR "${COMPILER_DIR}/../lib/clang/*/include")
|
||||
list(APPEND extraargs
|
||||
-isysroot ${CMAKE_OSX_SYSROOT}
|
||||
-stdlib++-isystem "${COMPILER_DIR}/../include/c++/v1")
|
||||
-stdlib++-isystem "${COMPILER_DIR}/../include/c++/v1"
|
||||
-isystem "${SYSTEM_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
# Make target
|
||||
|
||||
@@ -75,6 +75,21 @@ using StreamOut = llvm::raw_pwrite_stream;
|
||||
using StreamOut = llvm::raw_fd_ostream;
|
||||
#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> {
|
||||
clang::ASTContext& context;
|
||||
StreamOut& fileOut;
|
||||
@@ -595,7 +610,7 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
||||
argExpr = static_cast<const clang::ParenExpr*>(argExpr)->getSubExpr();
|
||||
llvm::raw_string_ostream strStream(sizeExprStr);
|
||||
argExpr->printPretty(strStream, nullptr, context.getPrintingPolicy());
|
||||
} else if (expr->isIntegerConstantExpr(sizeLiteral, context)) {
|
||||
} else if (GetIntegerConstantExpr(expr, sizeLiteral, context)) {
|
||||
sizeExprStr = sizeLiteral.toString(10);
|
||||
}
|
||||
}
|
||||
@@ -637,7 +652,7 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
||||
argExpr = static_cast<const clang::ParenExpr*>(argExpr)->getSubExpr();
|
||||
llvm::raw_string_ostream strStream2(sizeExprStr);
|
||||
argExpr->printPretty(strStream2, nullptr, context.getPrintingPolicy());
|
||||
} else if (expr->isIntegerConstantExpr(sizeLiteral, context)) {
|
||||
} else if (GetIntegerConstantExpr(expr, sizeLiteral, context)) {
|
||||
sizeExprStr = sizeLiteral.toString(10);
|
||||
}
|
||||
} else if (idx == 1) {
|
||||
@@ -684,7 +699,7 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
||||
argExpr = static_cast<const clang::ParenExpr*>(argExpr)->getSubExpr();
|
||||
llvm::raw_string_ostream strStream(offsetExprStr);
|
||||
argExpr->printPretty(strStream, nullptr, context.getPrintingPolicy());
|
||||
} else if (expr->isIntegerConstantExpr(offsetLiteral, context)) {
|
||||
} else if (GetIntegerConstantExpr(expr, offsetLiteral, context)) {
|
||||
offsetExprStr = offsetLiteral.toString(10);
|
||||
}
|
||||
} else {
|
||||
@@ -736,7 +751,7 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
||||
for (const clang::TemplateArgument& arg : *tsType) {
|
||||
if (arg.getKind() == clang::TemplateArgument::Expression) {
|
||||
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);
|
||||
diag.AddString("Unable to use non-constant align expression in Athena");
|
||||
diag.AddSourceRange(clang::CharSourceRange(expr->getSourceRange(), true));
|
||||
@@ -989,7 +1004,7 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
||||
argExpr = static_cast<const clang::ParenExpr*>(argExpr)->getSubExpr();
|
||||
llvm::raw_string_ostream strStream(sizeExprStr);
|
||||
argExpr->printPretty(strStream, nullptr, context.getPrintingPolicy());
|
||||
} else if (expr->isIntegerConstantExpr(sizeLiteral, context)) {
|
||||
} else if (GetIntegerConstantExpr(expr, sizeLiteral, context)) {
|
||||
sizeExprStr = sizeLiteral.toString(10);
|
||||
}
|
||||
}
|
||||
@@ -1032,7 +1047,7 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
|
||||
argExpr = static_cast<const clang::ParenExpr*>(argExpr)->getSubExpr();
|
||||
llvm::raw_string_ostream strStream2(sizeExprStr);
|
||||
argExpr->printPretty(strStream2, nullptr, context.getPrintingPolicy());
|
||||
} else if (expr->isIntegerConstantExpr(sizeLiteral, context)) {
|
||||
} else if (GetIntegerConstantExpr(expr, sizeLiteral, context)) {
|
||||
sizeExprStr = sizeLiteral.toString(10);
|
||||
}
|
||||
} else if (idx == 1) {
|
||||
@@ -1231,7 +1246,11 @@ public:
|
||||
std::unique_ptr<StreamOut> fileout;
|
||||
StreamOut* fileoutOld;
|
||||
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);
|
||||
#endif
|
||||
else
|
||||
fileout = MakeStreamOut(compiler.createDefaultOutputFile(false, "a", "cpp"), fileoutOld);
|
||||
AthenaError =
|
||||
@@ -1250,6 +1269,9 @@ int main(int argc, const char** argv) {
|
||||
XSTR(ATDNA_ARGV0),
|
||||
"-fsyntax-only",
|
||||
"-std=c++2a",
|
||||
#if __x86_64__
|
||||
"-mno-sse",
|
||||
#endif
|
||||
"-D__atdna__=1",
|
||||
"-Wno-expansion-to-defined",
|
||||
"-Wno-nullability-completeness",
|
||||
|
||||
@@ -17,12 +17,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Jackoalan / Antidote"
|
||||
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 "InternalName", "atdna"
|
||||
VALUE "OriginalFilename", "atdna.exe"
|
||||
VALUE "ProductName", "ATDNA"
|
||||
VALUE "ProductVersion", "@ATHENA_MAJOR_VERSION@.@ATHENA_MINOR_VERSION@.@ATHENA_PATCH_VERSION@"
|
||||
VALUE "ProductVersion", "@ATHENA_VERSION@"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
2
extern/yaml/src/yaml_private.h
vendored
2
extern/yaml/src/yaml_private.h
vendored
@@ -1,7 +1,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <yaml.h>
|
||||
#include <athena/yaml.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
|
||||
11
extern/zlib/CMakeLists.txt
vendored
11
extern/zlib/CMakeLists.txt
vendored
@@ -1,4 +1,9 @@
|
||||
if(NOT WIN32 AND NOT NX) # remove when specter/freetype is gone
|
||||
if (APPLE)
|
||||
# use toolchain zlib
|
||||
find_package(ZLIB REQUIRED)
|
||||
set(ZLIB_LIBRARIES ZLIB::ZLIB)
|
||||
else()
|
||||
if(NOT WIN32 AND NOT NX) # remove WIN32 when specter/freetype is gone
|
||||
find_library(ZLIB_LIB NAMES zlib z)
|
||||
endif()
|
||||
if(NOT ZLIB_LIB)
|
||||
@@ -36,5 +41,7 @@ set(ZLIB_LIBRARIES z CACHE PATH "Zlib libraries" FORCE)
|
||||
set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "Zlib include path" FORCE)
|
||||
else()
|
||||
set(ZLIB_LIBRARIES ${ZLIB_LIB} CACHE PATH "Zlib libraries" FORCE)
|
||||
find_path(ZLIB_INCLUDE_DIR zlib.h)
|
||||
find_path(ZLIB_INCLUDE_DIR zlib.h PATHS "${PNG_LIB}/../../include")
|
||||
message(STATUS "Using zlib at ${ZLIB_LIB}, include: ${ZLIB_INCLUDE_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
@@ -147,18 +147,20 @@ struct BinarySize {
|
||||
}
|
||||
template <class T, Endian DNAE>
|
||||
static std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& s) {
|
||||
for (auto& v : var)
|
||||
BinarySize<PropOp>::Do<std::remove_reference_t<decltype(v)>, DNAE>(id, v, s);
|
||||
for (auto& v : var) {
|
||||
BinarySize<PropOp>::template Do<std::remove_reference_t<decltype(v)>, DNAE>(id, v, s);
|
||||
}
|
||||
}
|
||||
template <class T, Endian DNAE>
|
||||
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>
|
||||
static std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
|
||||
StreamT& s) {
|
||||
for (T& v : vector)
|
||||
BinarySize<PropOp>::Do<T, DNAE>(id, v, s);
|
||||
for (T& v : vector) {
|
||||
BinarySize<PropOp>::template Do<T, DNAE>(id, v, s);
|
||||
}
|
||||
}
|
||||
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,
|
||||
@@ -255,7 +257,7 @@ struct PropCount {
|
||||
}
|
||||
template <class T, Endian DNAE>
|
||||
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>
|
||||
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>
|
||||
static std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& s) {
|
||||
for (auto& v : var)
|
||||
Read<PropOp>::Do<std::remove_reference_t<decltype(v)>, DNAE>(id, v, s);
|
||||
for (auto& v : var) {
|
||||
Read<PropOp>::template Do<std::remove_reference_t<decltype(v)>, DNAE>(id, v, s);
|
||||
}
|
||||
}
|
||||
template <class T, Endian DNAE>
|
||||
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>
|
||||
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);
|
||||
for (size_t i = 0; i < static_cast<size_t>(count); ++i) {
|
||||
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>
|
||||
@@ -483,18 +486,20 @@ struct Write {
|
||||
}
|
||||
template <class T, Endian DNAE>
|
||||
static std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& s) {
|
||||
for (auto& v : var)
|
||||
Write<PropOp>::Do<std::remove_reference_t<decltype(v)>, DNAE>(id, v, s);
|
||||
for (auto& v : var) {
|
||||
Write<PropOp>::template Do<std::remove_reference_t<decltype(v)>, DNAE>(id, v, s);
|
||||
}
|
||||
}
|
||||
template <class T, Endian DNAE>
|
||||
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>
|
||||
static std::enable_if_t<!std::is_same_v<T, bool>> Do(const PropId& id, std::vector<T>& vector, const S& count,
|
||||
StreamT& w) {
|
||||
for (T& v : vector)
|
||||
Write<PropOp>::Do<T, DNAE>(id, v, w);
|
||||
for (T& v : vector) {
|
||||
Write<PropOp>::template Do<T, DNAE>(id, v, w);
|
||||
}
|
||||
}
|
||||
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,
|
||||
@@ -596,9 +601,11 @@ struct ReadYaml {
|
||||
template <class T, Endian DNAE>
|
||||
static std::enable_if_t<std::is_array_v<T>> Do(const PropId& id, T& var, StreamT& r) {
|
||||
size_t _count;
|
||||
if (auto __v = r.enterSubVector(id.name, _count))
|
||||
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);
|
||||
if (auto __v = r.enterSubVector(id.name, _count)) {
|
||||
for (size_t i = 0; i < _count && i < std::extent_v<T>; ++i) {
|
||||
ReadYaml<PropOp>::template Do<std::remove_reference_t<decltype(var[i])>, DNAE>({}, var[i], r);
|
||||
}
|
||||
}
|
||||
}
|
||||
template <class T, Endian DNAE>
|
||||
static void DoSize(const PropId& id, T& var, StreamT& s) {
|
||||
@@ -613,7 +620,7 @@ struct ReadYaml {
|
||||
vector.reserve(_count);
|
||||
for (size_t i = 0; i < _count; ++i) {
|
||||
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) */
|
||||
@@ -712,9 +719,11 @@ struct WriteYaml {
|
||||
}
|
||||
template <class T, Endian DNAE>
|
||||
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))
|
||||
for (auto& v : var)
|
||||
WriteYaml<PropOp>::Do<std::remove_reference_t<decltype(v)>, DNAE>({}, v, w);
|
||||
if (auto __v = w.enterSubVector(id.name)) {
|
||||
for (auto& v : var) {
|
||||
WriteYaml<PropOp>::template Do<std::remove_reference_t<decltype(v)>, DNAE>({}, v, w);
|
||||
}
|
||||
}
|
||||
}
|
||||
template <class T, Endian DNAE>
|
||||
static void DoSize(const PropId& id, T& var, StreamT& s) {
|
||||
@@ -723,9 +732,11 @@ struct WriteYaml {
|
||||
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,
|
||||
StreamT& w) {
|
||||
if (auto __v = w.enterSubVector(id.name))
|
||||
for (T& v : vector)
|
||||
WriteYaml<PropOp>::Do<T, DNAE>(id, v, w);
|
||||
if (auto __v = w.enterSubVector(id.name)) {
|
||||
for (T& v : vector) {
|
||||
WriteYaml<PropOp>::template Do<T, DNAE>(id, v, w);
|
||||
}
|
||||
}
|
||||
}
|
||||
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,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <yaml.h>
|
||||
#include "yaml.h"
|
||||
|
||||
#include "athena/Types.hpp"
|
||||
|
||||
|
||||
@@ -1518,6 +1518,11 @@ public:
|
||||
const __simd_storage<_Up, __simd_abi<_StorageKind::_Array, __Unum_element>>& other) {
|
||||
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_; }
|
||||
};
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ using namespace std;
|
||||
#elif __ARM_NEON
|
||||
#include "simd_neon.hpp"
|
||||
#else
|
||||
namespace simd_abi {
|
||||
namespace athena::_simd::simd_abi {
|
||||
template <typename T>
|
||||
struct athena_native {};
|
||||
template <>
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
using storage_type = __m128;
|
||||
storage_type __storage_{};
|
||||
[[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;
|
||||
_mm_store_ps(sse_data.data(), __storage_);
|
||||
return sse_data[__index];
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
#endif
|
||||
}
|
||||
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;
|
||||
_mm_store_ps(sse_data.data(), __storage_);
|
||||
sse_data[__index] = __val;
|
||||
@@ -210,7 +210,7 @@ public:
|
||||
using storage_type = std::array<__m128d, 2>;
|
||||
storage_type __storage_{};
|
||||
[[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;
|
||||
_mm_store_pd(sse_data.data(), __storage_[__index / 2]);
|
||||
return sse_data[__index % 2];
|
||||
@@ -219,7 +219,7 @@ public:
|
||||
#endif
|
||||
}
|
||||
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;
|
||||
_mm_store_pd(sse_data.data(), __storage_[__index / 2]);
|
||||
sse_data[__index % 2] = __val;
|
||||
|
||||
@@ -4,7 +4,7 @@ libdir=${prefix}/lib
|
||||
|
||||
Name: libAthena
|
||||
Description: Basic cross platform IO library
|
||||
Version: @ATHENA_VERSION@
|
||||
Version: @ATHENA_VERSION_STRING@
|
||||
Cflags: -I${includedir}/Athena
|
||||
Libs: -L${libdir} -lathena-core -lathena-sakura -lathena-zelda -lathena-wiiSave
|
||||
Requires: zlib
|
||||
|
||||
@@ -21,7 +21,7 @@ MemoryReader::MemoryReader(const void* data, atUint64 length, bool takeOwnership
|
||||
|
||||
MemoryReader::~MemoryReader() {
|
||||
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) {
|
||||
@@ -111,7 +111,7 @@ atUint64 MemoryReader::readUBytesToBuf(void* buf, atUint64 length) {
|
||||
}
|
||||
|
||||
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;
|
||||
return length;
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ void MemoryWriter::writeUBytes(const atUint8* data, atUint64 length) {
|
||||
return;
|
||||
}
|
||||
|
||||
memmove(reinterpret_cast<atInt8*>(m_data + m_position), data, length);
|
||||
memmove(m_data + m_position, data, length);
|
||||
|
||||
m_position += length;
|
||||
}
|
||||
@@ -248,7 +248,7 @@ void MemoryCopyWriter::writeUBytes(const atUint8* data, atUint64 length) {
|
||||
if (m_position + length > m_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;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include "utf8proc.h"
|
||||
#include "athena/utf8proc.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <functional>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#if defined(GEKKO) || defined(__SWITCH__)
|
||||
#include "gekko_support.h"
|
||||
#include "athena/gekko_support.h"
|
||||
#define SYMLOOP_MAX 8
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
Reference in New Issue
Block a user