diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..e800ee2 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,121 @@ +name: Test +on: + push: +jobs: + test-linux: + 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: Build + run: | + mkdir build + cd build + cmake -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 \ + .. + cmake --build . + + - name: Test + working-directory: build + run: ./atdna-test + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: atdna-linux-x86_64 + path: | + build/atdna/atdna + + test-linux-arm64: + 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 + id: build + 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: | + mkdir /workspace/build + cd /workspace/build + cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DClang_DIR=/usr/lib/cmake/clang-11 -DATDNA_DYNAMIC_LLVM=OFF .. + cmake --build . + ./atdna-test + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: atdna-linux-aarch64 + path: | + build/atdna/atdna + + test-macos: + 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 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: Build + run: | + cmake -B build -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" \ + -DClang_DIR=/opt/local/libexec/llvm-11/lib/cmake/clang \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache . + cmake --build build + dsymutil build/atdna/atdna + + - name: Test + working-directory: build + run: ./atdna-test + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: atdna-macos-x86_64 + path: | + build/atdna/atdna + build/atdna/atdna.dSYM \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index b80f8c6..ec2e6d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -272,13 +272,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() ######### diff --git a/atdna/CMakeLists.txt b/atdna/CMakeLists.txt index 0a4c5b6..f231803 100644 --- a/atdna/CMakeLists.txt +++ b/atdna/CMakeLists.txt @@ -4,17 +4,22 @@ if(NOT CMAKE_CROSSCOMPILING) -string(REPLACE -stdlib=libc++ "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - 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") +if(APPLE AND CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64) + set(LLVM_HOMEBREW_PATH /usr/local/opt/llvm) +elseif(APPLE AND CMAKE_SYSTEM_PROCESSOR STREQUAL arm64) + set(LLVM_HOMEBREW_PATH /opt/homebrew/opt/llvm) else() + set(LLVM_HOMEBREW_PATH "") +endif() +find_package(Clang REQUIRED PATHS ${LLVM_HOMEBREW_PATH}) +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,90 +27,34 @@ 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 "") - 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) - endif() + 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() + 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 @@ -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,7 +98,7 @@ 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 diff --git a/atdna/FindLLVM.cmake b/atdna/FindLLVM.cmake deleted file mode 100644 index 11ce8d5..0000000 --- a/atdna/FindLLVM.cmake +++ /dev/null @@ -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) diff --git a/atdna/atdnaConfig.cmake.in b/atdna/atdnaConfig.cmake.in index 3d87e20..4e89864 100644 --- a/atdna/atdnaConfig.cmake.in +++ b/atdna/atdnaConfig.cmake.in @@ -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 diff --git a/atdna/atdnaHelpers.cmake b/atdna/atdnaHelpers.cmake index e689d8a..798d882 100644 --- a/atdna/atdnaHelpers.cmake +++ b/atdna/atdnaHelpers.cmake @@ -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 diff --git a/atdna/main.cpp b/atdna/main.cpp index c0c04a9..4dbf722 100644 --- a/atdna/main.cpp +++ b/atdna/main.cpp @@ -1250,6 +1250,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", diff --git a/include/athena/simd/simd.hpp b/include/athena/simd/simd.hpp index abf2448..2a28bb5 100644 --- a/include/athena/simd/simd.hpp +++ b/include/athena/simd/simd.hpp @@ -18,7 +18,7 @@ using namespace std; #elif __ARM_NEON #include "simd_neon.hpp" #else -namespace simd_abi { +namespace athena::_simd::simd_abi { template struct athena_native {}; template <>