Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: enable macos
Browse files Browse the repository at this point in the history
alandefreitas committed Oct 10, 2024

Verified

This commit was signed with the committer’s verified signature.
sdispater Sébastien Eustace
1 parent 9348766 commit 3260837
Showing 4 changed files with 58 additions and 21 deletions.
43 changes: 26 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -37,22 +37,26 @@ jobs:
gcc 14
clang 18
msvc >=14.40
apple-clang *
standards: '20'
latest-factors: ''
factors: |
msvc Optimized-Debug
runs-on: |
apple-clang: macos-15
build-types: |
gcc: Release
clang: Release
apple-clang: Release
msvc: RelWithDebInfo
msvc Optimized-Debug: Debug
ccflags: |
msvc Optimized-Debug: /Ob1 /O2 /Zi
cxxflags: |
msvc Optimized-Debug: /Ob1 /O2 /Zi
install: |
gcc: git build-essential pkg-config python3 curl openjdk-11-jdk ninja-build pkg-config libncurses-dev libxml2-utils libxml2-dev
clang: git build-essential pkg-config python3 curl openjdk-11-jdk ninja-build pkg-config libncurses-dev libxml2-utils libxml2-dev
gcc: git build-essential pkg-config python3 curl openjdk-11-jdk pkg-config libncurses-dev libxml2-utils libxml2-dev
clang: git build-essential pkg-config python3 curl openjdk-11-jdk pkg-config libncurses-dev libxml2-utils libxml2-dev
msvc: ''
extra-values: |
llvm-hash: e1065370aaacb1b1cb48e77d37d376bf024f4a39
@@ -68,6 +72,8 @@ jobs:
llvm-archive-filename: {{ llvm-archive-basename }}.{{ llvm-archive-extension }}
libcxx-runtimes: libcxx;libcxxabi{{#if (ine os 'windows') }};libunwind{{/if}}
libcxx-targets: cxx {{#if (ine os 'windows') }}cxxabi unwind{{/if}} install-cxx {{#if (ine os 'windows') }}install-cxxabi install-unwind{{/if}}
libcxx-cxxflags: {{#if (ieq os 'windows') }}-D__ORDER_LITTLE_ENDIAN__=1234 -D__ORDER_BIG_ENDIAN__=4321 -D__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__{{/if}}
libcxx-cmake-args: -D LLVM_ENABLE_RUNTIMES="{{ libcxx-runtimes }}" {{#if (ieq os 'windows') }}-D LIBCXXABI_USE_LLVM_UNWINDER=OFF -D LIBCXXABI_ENABLE_SHARED=OFF -D LIBCXXABI_ENABLE_STATIC=ON -D LIBCXX_ENABLE_SHARED=OFF -D LIBCXX_NO_VCRUNTIME=ON{{/if}} {{#if (ieq os 'macos') }}-D CMAKE_OSX_ARCHITECTURES=""{{/if}}
mrdocs-ccflags: {{ ccflags }} {{#if (eq compiler 'gcc') }}-static{{/if}} {{#if asan }}-static-libasan{{/if}} {{#if tsan }}-static-libtsan{{/if}}
mrdocs-cxxflags: {{ cxxflags }} {{#if (eq compiler 'gcc') }}-static{{/if}} {{#if asan }}-static-libasan{{/if}} {{#if tsan }}-static-libtsan{{/if}}
mrdocs-package-generators: {{#if (ieq os 'windows') }}7Z ZIP WIX{{else}}TGZ TXZ{{/if}}
@@ -131,8 +137,7 @@ jobs:
trace-commands: 'true'

- name: Setup Ninja
uses: seanmiddleditch/gha-setup-ninja@v4
if: ${{ runner.os == 'Windows' }}
uses: seanmiddleditch/gha-setup-ninja@v5

- name: Setup C++
uses: alandefreitas/cpp-actions/setup-cpp@v1.8.7
@@ -141,6 +146,15 @@ jobs:
compiler: ${{ matrix.compiler }}
version: ${{ matrix.version }}

# If apple-clang on macos, we run `clang -print-targets` to
# get the list of targets supported by the compiler.
- name: Print Clang Targets
if: matrix.compiler == 'apple-clang'
run: |
set -x
${{ steps.setup-cpp.outputs.cxx }} --print-targets
${{ steps.setup-cpp.outputs.cxx }} --print-target-triple
- name: Install System Packages
uses: alandefreitas/cpp-actions/package-install@v1.8.7
if: matrix.compiler != 'msvc'
@@ -323,24 +337,19 @@ jobs:
source-dir: ../third-party/llvm-project/runtimes
build-dir: ${sourceDir}/build-libcxx
build-target: ${{ matrix.libcxx-targets }}
cc: ../third-party/llvm-project/install/bin/clang
cxx: ../third-party/llvm-project/install/bin/clang++
cxxflags: ${{ runner.os == 'Windows' && '-D__ORDER_LITTLE_ENDIAN__=1234 -D__ORDER_BIG_ENDIAN__=4321 -D__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__' || '' }}
# MrDocs will only use the LibC++ headers: any compiler that works in this workflow will do
cc: ${{ runner.os == 'macOS' && steps.setup-cpp.outputs.cc || '../third-party/llvm-project/install/bin/clang' }}
cxx: ${{ runner.os == 'macOS' && steps.setup-cpp.outputs.cxx || '../third-party/llvm-project/install/bin/clang++' }}
cxxflags: ${{ matrix.libcxx-cxxflags }}
generator: Ninja
extra-args: |
-D LLVM_ENABLE_RUNTIMES="${{ matrix.libcxx-runtimes }}"
${{ runner.os == 'Windows' && '-D LIBCXXABI_USE_LLVM_UNWINDER=OFF' || '' }}
${{ runner.os == 'Windows' && '-D LIBCXXABI_ENABLE_SHARED=OFF' || '' }}
${{ runner.os == 'Windows' && '-D LIBCXXABI_ENABLE_STATIC=ON' || '' }}
${{ runner.os == 'Windows' && '-D LIBCXX_ENABLE_SHARED=OFF' || '' }}
${{ runner.os == 'Windows' && '-D LIBCXX_NO_VCRUNTIME=ON' || '' }}
extra-args: ${{ matrix.libcxx-cmake-args }}
install: true
install-prefix: ${sourceDir}/../install
run-tests: false
trace-commands: true

- name: Install Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '20'

@@ -427,12 +436,12 @@ jobs:
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Setup Ninja
uses: seanmiddleditch/gha-setup-ninja@v4
uses: seanmiddleditch/gha-setup-ninja@v5
if: ${{ runner.os == 'Windows' }}

- name: Download MrDocs package
4 changes: 2 additions & 2 deletions include/mrdocs/Platform.hpp
Original file line number Diff line number Diff line change
@@ -72,8 +72,8 @@ namespace mrdocs {
# endif
#endif

#if ! defined(__x86_64__) && ! defined(_WIN64)
# error mrdox requires a 64-bit archtecture
#if ! defined(__x86_64__) && ! defined(_WIN64) && ! defined(__aarch64__)
# error mrdocs requires a 64-bit architecture
#endif

} // mrdocs
3 changes: 3 additions & 0 deletions src/lib/Lib/CMakeExecution.cpp
Original file line number Diff line number Diff line change
@@ -383,6 +383,9 @@ parseBashArgs(std::string_view str)
return args;
}

/* Pushes the CMake arguments to the `args` vector, replacing the
* default generator with Ninja if Visual Studio is the default generator.
*/
Expected<void>
pushCMakeArgs(
std::string const& cmakePath,
29 changes: 27 additions & 2 deletions src/lib/Lib/MrDocsCompilationDatabase.cpp
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@
#include <llvm/Option/ArgList.h>
#include <llvm/Option/OptTable.h>
#include <llvm/Support/FileSystem.h>
#include <llvm/TargetParser/Host.h>
#include <ranges>

namespace clang {
@@ -243,8 +244,8 @@ static
std::vector<std::string>
adjustCommandLine(
llvm::StringRef workingDir,
const std::vector<std::string>& cmdline,
const std::vector<std::string>& additional_defines,
std::vector<std::string> const& cmdline,
std::vector<std::string> const& additional_defines,
std::unordered_map<std::string, std::vector<std::string>> const& implicitIncludeDirectories,
std::vector<std::string> const& stdlibIncludes,
std::vector<std::string> const& systemIncludes,
@@ -292,6 +293,30 @@ adjustCommandLine(
new_cmdline.emplace_back(is_clang_cl ? "/w" : "-w");
new_cmdline.emplace_back("-fsyntax-only");

// ------------------------------------------------------
// Target architecture
// ------------------------------------------------------
constexpr auto is_target_option = [](std::string_view opt) {
return opt == "-target" || opt == "--target";
};
if (std::ranges::find_if(cmdline, is_target_option) == cmdline.end())
{
new_cmdline.emplace_back("-target");
std::string target = llvm::sys::getDefaultTargetTriple();
new_cmdline.emplace_back(target);
}

// ------------------------------------------------------
// Language standard
// ------------------------------------------------------
constexpr auto is_std_option = [](std::string_view opt) {
return opt.starts_with("-std=") || opt.starts_with("--std=") || opt.starts_with("/std:");
};
if (std::ranges::find_if(cmdline, is_std_option) == cmdline.end())
{
new_cmdline.emplace_back("-std=c++23");
}

// ------------------------------------------------------
// Add additional defines
// ------------------------------------------------------

0 comments on commit 3260837

Please sign in to comment.