mirror of
https://github.com/libAthena/athena.git
synced 2025-12-09 13:38:03 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 67d788ae4e | |||
| 4f8927d95c | |||
| 5c697c006f | |||
| f9545db293 | |||
| cee01a8df1 | |||
| 88b0ed137c | |||
| 50991752f8 | |||
| cce4b5e2c7 |
69
.github/workflows/build.yml
vendored
69
.github/workflows/build.yml
vendored
@@ -5,54 +5,43 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
BUILDCACHE_VERSION: v0.27.0
|
BUILDCACHE_VERSION: v0.28.3
|
||||||
BUILDCACHE_ACCURACY: STRICT
|
BUILDCACHE_ACCURACY: STRICT
|
||||||
BUILDCACHE_MAX_CACHE_SIZE: 1073741824 # 1GiB
|
BUILDCACHE_MAX_CACHE_SIZE: 1073741824 # 1GiB
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-linux-x86_64:
|
build-linux-x86_64:
|
||||||
name: Build Linux (GCC x86_64)
|
name: Build Linux (GCC x86_64)
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: alpine:3.17
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
LLVM_MAJOR: 15
|
||||||
BUILDCACHE_DIR: ${{github.workspace}}/.buildcache
|
BUILDCACHE_DIR: ${{github.workspace}}/.buildcache
|
||||||
|
|
||||||
steps:
|
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
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
sudo apt-get -y update
|
|
||||||
sudo apt-get -y install cmake ninja-build llvm-11-dev libclang-11-dev clang-11 zlib1g-dev
|
|
||||||
|
|
||||||
# setup buildcache
|
|
||||||
curl -LSfs https://github.com/mbitsnbites/buildcache/releases/download/$BUILDCACHE_VERSION/buildcache-linux.tar.gz | tar xz -C "$RUNNER_WORKSPACE"
|
|
||||||
echo "$RUNNER_WORKSPACE"/buildcache/bin >> $GITHUB_PATH
|
|
||||||
|
|
||||||
- name: Restore buildcache
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ${{env.BUILDCACHE_DIR}}
|
|
||||||
key: buildcache-ubuntu-20.04-x86_64
|
|
||||||
|
|
||||||
- name: Configure CMake
|
- name: Configure CMake
|
||||||
run: |
|
run: |
|
||||||
cmake -B build . -GNinja \
|
cmake -B build . -GNinja \
|
||||||
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
|
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
|
||||||
-DATDNA_DYNAMIC_LLVM=OFF \
|
-DATDNA_DYNAMIC_LLVM:BOOL=OFF \
|
||||||
-DClang_DIR:PATH=/usr/lib/cmake/clang-11 \
|
-DATDNA_STATIC:BOOL=ON \
|
||||||
-DCMAKE_C_COMPILER_LAUNCHER:STRING=buildcache \
|
-DCMAKE_CXX_FLAGS:STRING="-I/usr/lib/llvm15/include -Dstat64=stat"
|
||||||
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=buildcache
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cmake --build build --target package --verbose
|
run: cmake --build build --target package --verbose
|
||||||
|
|
||||||
- name: Print buildcache stats
|
|
||||||
run: buildcache -s
|
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
working-directory: build
|
working-directory: build
|
||||||
run: ./atdna-test
|
run: ./atdna-test
|
||||||
@@ -66,7 +55,11 @@ jobs:
|
|||||||
|
|
||||||
build-linux-aarch64:
|
build-linux-aarch64:
|
||||||
name: Build Linux (GCC aarch64)
|
name: Build Linux (GCC aarch64)
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-latest
|
||||||
|
if: 'false'
|
||||||
|
|
||||||
|
env:
|
||||||
|
LLVM_MAJOR: 15
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
@@ -78,18 +71,19 @@ jobs:
|
|||||||
name: Build & test
|
name: Build & test
|
||||||
with:
|
with:
|
||||||
arch: aarch64
|
arch: aarch64
|
||||||
distro: ubuntu20.04
|
base_image: --platform=linux/arm64/v8 alpine:3.17
|
||||||
githubToken: ${{github.token}}
|
githubToken: ${{github.token}}
|
||||||
dockerRunArgs: |
|
dockerRunArgs: |
|
||||||
--volume "${PWD}:/workspace"
|
--volume "${PWD}:/workspace"
|
||||||
install: |
|
install: |
|
||||||
apt-get -y update
|
apk add --no-cache git cmake ninja clang-dev clang-static llvm-dev llvm-static musl-dev \
|
||||||
apt-get -y install build-essential cmake ninja-build llvm-11-dev libclang-11-dev clang-11 zlib1g-dev
|
gcc g++ libxml2-dev libxml2-static zlib-dev zlib-static
|
||||||
run: |
|
run: |
|
||||||
cmake -B build . -GNinja \
|
cmake -B build . -GNinja \
|
||||||
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
|
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
|
||||||
-DATDNA_DYNAMIC_LLVM:BOOL=OFF \
|
-DATDNA_DYNAMIC_LLVM:BOOL=OFF \
|
||||||
-DClang_DIR:PATH=/usr/lib/cmake/clang-11
|
-DATDNA_STATIC:BOOL=ON \
|
||||||
|
-DCMAKE_CXX_FLAGS:STRING="-I/usr/lib/llvm15/include -Dstat64=stat"
|
||||||
cmake --build build --target package --verbose
|
cmake --build build --target package --verbose
|
||||||
build/atdna-test
|
build/atdna-test
|
||||||
|
|
||||||
@@ -102,9 +96,11 @@ jobs:
|
|||||||
|
|
||||||
build-macos-universal:
|
build-macos-universal:
|
||||||
name: Build macOS (AppleClang universal)
|
name: Build macOS (AppleClang universal)
|
||||||
runs-on: macos-10.15
|
runs-on: macos-13
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
LLVM_MAJOR: 15
|
||||||
|
LLVM_VERSION: 15.0.7_2
|
||||||
BUILDCACHE_DIR: ${{github.workspace}}/.buildcache
|
BUILDCACHE_DIR: ${{github.workspace}}/.buildcache
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -119,8 +115,8 @@ jobs:
|
|||||||
brew install ninja
|
brew install ninja
|
||||||
|
|
||||||
# universal clang+llvm from macports
|
# 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
|
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-11-11.1.0_1.mpkg -target /
|
sudo installer -pkg /tmp/clang-$LLVM_MAJOR-$LLVM_VERSION.mpkg -target /
|
||||||
|
|
||||||
# setup buildcache
|
# setup buildcache
|
||||||
curl -LSfs https://github.com/mbitsnbites/buildcache/releases/download/$BUILDCACHE_VERSION/buildcache-macos.zip -o /tmp/buildcache-macos.zip
|
curl -LSfs https://github.com/mbitsnbites/buildcache/releases/download/$BUILDCACHE_VERSION/buildcache-macos.zip -o /tmp/buildcache-macos.zip
|
||||||
@@ -131,14 +127,15 @@ jobs:
|
|||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{env.BUILDCACHE_DIR}}
|
path: ${{env.BUILDCACHE_DIR}}
|
||||||
key: buildcache-macos-10.15
|
key: buildcache-macos-12
|
||||||
|
|
||||||
- name: Configure CMake
|
- name: Configure CMake
|
||||||
run: |
|
run: |
|
||||||
cmake -B build . -GNinja \
|
cmake -B build . -GNinja \
|
||||||
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
|
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
|
||||||
-DCMAKE_OSX_ARCHITECTURES:STRING="x86_64;arm64" \
|
-DCMAKE_OSX_ARCHITECTURES:STRING="x86_64;arm64" \
|
||||||
-DLLVM_ROOT_DIR:PATH=/opt/local/libexec/llvm-11 \
|
-DCMAKE_PREFIX_PATH:PATH=/opt/local \
|
||||||
|
-DLLVM_ROOT_DIR:PATH=/opt/local/libexec/llvm-$LLVM_MAJOR \
|
||||||
-DCMAKE_C_COMPILER_LAUNCHER:STRING=buildcache \
|
-DCMAKE_C_COMPILER_LAUNCHER:STRING=buildcache \
|
||||||
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=buildcache
|
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=buildcache
|
||||||
|
|
||||||
@@ -161,10 +158,10 @@ jobs:
|
|||||||
|
|
||||||
build-win32-amd64:
|
build-win32-amd64:
|
||||||
name: Build Windows (MSVC AMD64)
|
name: Build Windows (MSVC AMD64)
|
||||||
runs-on: windows-2019
|
runs-on: windows-2022
|
||||||
|
|
||||||
env:
|
env:
|
||||||
LLVM_VERSION: 11.1.0
|
LLVM_VERSION: 15.0.7
|
||||||
BUILDCACHE_DIR: C:\buildcache
|
BUILDCACHE_DIR: C:\buildcache
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ 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)
|
||||||
|
|
||||||
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# Athena Version #
|
# Athena Version #
|
||||||
##################
|
##################
|
||||||
@@ -67,6 +69,11 @@ endif()
|
|||||||
|
|
||||||
project(athena VERSION ${ATHENA_VERSION} LANGUAGES C CXX)
|
project(athena VERSION ${ATHENA_VERSION} LANGUAGES C CXX)
|
||||||
|
|
||||||
|
if (ATDNA_STATIC)
|
||||||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||||
|
add_link_options(-static)
|
||||||
|
endif ()
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
# Shaddup MSVC
|
# Shaddup MSVC
|
||||||
add_compile_definitions(UNICODE=1 _UNICODE=1 __SSE__=1
|
add_compile_definitions(UNICODE=1 _UNICODE=1 __SSE__=1
|
||||||
|
|||||||
@@ -55,12 +55,31 @@ else()
|
|||||||
# Add LLVM static libs
|
# Add LLVM static libs
|
||||||
list(APPEND CLANG_LIBS clangTooling)
|
list(APPEND CLANG_LIBS clangTooling)
|
||||||
list(APPEND LLVM_LIBS LLVMFrontendOpenMP LLVMOption)
|
list(APPEND LLVM_LIBS LLVMFrontendOpenMP LLVMOption)
|
||||||
|
if (LLVM_VERSION_MAJOR GREATER_EQUAL 15)
|
||||||
|
list(APPEND LLVM_LIBS LLVMWindowsDriver)
|
||||||
|
endif ()
|
||||||
# Remove LLVM dynamic library from Clang dependencies
|
# Remove LLVM dynamic library from Clang dependencies
|
||||||
foreach (lib ${CLANG_LIBS})
|
foreach (lib ${CLANG_LIBS})
|
||||||
recursive_remove_library(${lib} LLVM)
|
recursive_remove_library(${lib} LLVM)
|
||||||
endforeach ()
|
endforeach ()
|
||||||
# Hack around link order issues
|
# Hack around link order issues
|
||||||
target_link_libraries(clangAST INTERFACE LLVMFrontendOpenMP)
|
target_link_libraries(clangAST INTERFACE LLVMFrontendOpenMP)
|
||||||
|
|
||||||
|
# Fix linking diaguids on Windows
|
||||||
|
if (WIN32 AND TARGET LLVMDebugInfoPDB)
|
||||||
|
find_package(DiaSDK REQUIRED)
|
||||||
|
|
||||||
|
get_target_property(target_dependencies LLVMDebugInfoPDB INTERFACE_LINK_LIBRARIES)
|
||||||
|
list(TRANSFORM target_dependencies REPLACE ".*diaguids.*" "${DIASDK_GUIDS_LIBRARY}")
|
||||||
|
set_property(TARGET LLVMDebugInfoPDB PROPERTY INTERFACE_LINK_LIBRARIES "${target_dependencies}")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Allow static linking against zstd
|
||||||
|
if (ATDNA_STATIC)
|
||||||
|
get_target_property(target_dependencies LLVMSupport INTERFACE_LINK_LIBRARIES)
|
||||||
|
list(TRANSFORM target_dependencies REPLACE "zstd::libzstd_shared" "zstd::libzstd_static")
|
||||||
|
set_property(TARGET LLVMSupport PROPERTY INTERFACE_LINK_LIBRARIES "${target_dependencies}")
|
||||||
|
endif ()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Offer the user the choice of overriding the installation directories
|
# Offer the user the choice of overriding the installation directories
|
||||||
|
|||||||
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)
|
||||||
Reference in New Issue
Block a user