From 6b45acced01944aa472df416b7815c6a83369c5d Mon Sep 17 00:00:00 2001 From: Lewis Jordan Date: Wed, 7 Feb 2024 12:44:48 +0000 Subject: [PATCH] Squashed commit of the following: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit 8bd3f456a1a194d0074307af1e00c4f73d7ed5b6 Author: João Matos Date: Tue Feb 6 18:30:12 2024 +0000 Update llvm.yml to install AArch64 cross compilers commit a81abd56143bcd9139f3aadc1b732e359a3143c1 Author: Conrad Kreyling Date: Tue Feb 6 11:29:07 2024 -0500 LLVM crosscompile x64 for ARM64 (#1826) * LLVM crosscompile x64 for ARM64 * Fix MacOS host platform test * Ensure options is persistent in cross compile paths commit 1d1b21f25e15ac2dc3ff05cdea35daddf4117d18 Author: Conrad Kreyling Date: Fri Feb 2 15:12:42 2024 -0500 Instruct generator to build ARM64 bindings commit 491248b7d5976026b133fd8fdda4070d3e1f20d7 Author: Conrad Kreyling Date: Fri Feb 2 15:09:44 2024 -0500 Fix missing AArch64 entry in CLI CppAbi commit bbb0693ef53a36db667ee4f4e53e35b4fca87217 Author: Conrad Kreyling Date: Fri Feb 2 13:35:11 2024 -0500 Enable ARM64 support on LLVM builds commit b5ab95e11d253815b8b115bb749411ec4d74eeea Author: Joao Matos Date: Thu Feb 1 11:39:24 2024 +0000 Update iOS64 ABI name to the more accurate AppleARM64. commit d1307a532f4f88f46b343755cc864dc70dc50dea Author: Joao Matos Date: Thu Feb 1 11:21:52 2024 +0000 Add support for AArch64 C++ ABI. commit 9071cd2a591d5dcb5c584d2774f60905db12ce56 Author: deadlocklogic <57906342+deadlocklogic@users.noreply.github.com> Date: Sun Dec 17 17:03:24 2023 +0200 Implement ClassTemplatePartialSpecialization::Parameters (#1809) * Implement ClassTemplatePartialSpecialization::Parameters * Template.cs: Implement ClassTemplatePartialSpecialization.Parameters * GeneratorKind: fix bug introduced while migrating from enum to class * Implement native ClassTemplatePartialSpecialization.Parameters + ASTConverter * regenerated bindings (#1813) * regenerated bindings * regenerated bindings after rebase * Directory.Build.props: support C# 10.0 * Implement native ClassTemplatePartialSpecialization.Parameters + ASTConverter * Regenerated bindings * TestAST.cs: add TestASTClassTemplatePartialSpecialization commit 2ecd9528ff90f0494078868e98385c898c072560 Author: deadlocklogic <57906342+deadlocklogic@users.noreply.github.com> Date: Sun Dec 17 13:08:34 2023 +0200 regenerated bindings (#1813) * regenerated bindings * regenerated bindings after rebase * Directory.Build.props: support C# 10.0 commit 24d1a8491dc9b6eb5785186ad7e7fd90b6faad5f Author: deadlocklogic <57906342+deadlocklogic@users.noreply.github.com> Date: Sun Dec 17 11:44:00 2023 +0200 Stdlib.CSharp.cs: remove buggy typemap (#1812) commit 1327971e25ea298951f64864ad3bcdecf745ca0f Author: deadlocklogic <57906342+deadlocklogic@users.noreply.github.com> Date: Sat Dec 16 21:36:04 2023 +0200 GeneratorKind: patch bug caused by missing ToString (#1811) commit 519e97f2da35bca21dc1de8cdd4598711da406c1 Author: Joao Matos Date: Tue Dec 12 15:30:14 2023 +0000 Remove 32-bit builds and non-debug symbols release builds from LLVM Windows CI. commit 12112720f3dd7c0eab2f2827a2ac056c9ac250bb Author: deadlocklogic <57906342+deadlocklogic@users.noreply.github.com> Date: Tue Dec 12 17:25:12 2023 +0200 Build llvm `Debug`/`Release` for `Windows`. (#1800) * Update llvm-win.yml * Update llvm-win.yml * Update llvm-win.yml commit 12c267d9c44b90521e419c52a3ee29297da70648 Author: zylalx1 Date: Fri Dec 8 03:58:10 2023 +0800 Fixed a bug causing the header file to be included twice when Options.GenerateName is not null (#1803) commit e068f2a14ab3bcb89525c3dce66e9d8c4376f3a2 Author: deadlocklogic <57906342+deadlocklogic@users.noreply.github.com> Date: Thu Dec 7 16:35:02 2023 +0200 Typemap cleanup (#1802) * TypeMap: prepare refactoring into a modular design * TypeMap: refactor C++ backend into common methods * TypeMap: refactor CLI backend into common methods * CLI.Gen.cs: fix omitted typemap from previous commit * Common.Gen.cs: fixed silly modification while testing * GeneratorKind: add FindGeneratorKindByID method * TypeMapDatabase: heavy refactor: group typemaps by GeneratorKind * TypeMap: refactor CSharp backend into common methods + migration * TypeMap: cleanup patches from previous commits * TypeMapDatabase: fix passing GeneratorKind to FindTypeMap calls * Stdlib.CSharp.cs: move std::map typemap from Stdlib.CLI.cs * TypeMapDatabase: improve parameter name commit 8c2da6d542d30b7bae588f3c112d0cf9e2079d6d Author: deadlocklogic <57906342+deadlocklogic@users.noreply.github.com> Date: Mon Nov 13 22:00:41 2023 +0200 Major refactor: TypePrinter: improve modular design + cleanup (#1796) commit 0edd48c6a1d02141bd019feeab5a10f7a2f2e822 Author: deadlocklogic <57906342+deadlocklogic@users.noreply.github.com> Date: Mon Nov 13 20:15:24 2023 +0200 Major refactoring: refactor GeneratorKind enum into a class (#1794) * Major refactoring: refactor GeneratorKind enum into a class * Minor fix: add readonly * Add Type property for GenerationKind + cleanup * GeneratorKind: add Name property + refactor hardcoded names * GeneratorKind: add CLIOptions property + refactor hardcoded options * CppSharp.CLI: minor fix: use generator.ToLower() * GeneratorKind: fix warning commit 40f3a09296ee4f7339483eaaa16e6d2d4b18c2a4 Author: deadlocklogic <57906342+deadlocklogic@users.noreply.github.com> Date: Sat Nov 11 16:51:18 2023 +0200 Minor improvements (#1793) * CppSharp.Generators.Options: added pre/post TranslationUnitPass callback * CppSharp.Generators.Passes.Pass: added TranslationUnitPassGeneratorDependent commit b14038ab07bf85e25c9ed46de541eee7f3a419f4 Author: Stefan <29021710+Saalvage@users.noreply.github.com> Date: Mon Oct 23 14:23:51 2023 +0200 Value types may generate `Dispose` (#1787) commit 3b2a15d9f58c2662d8ec0634c2bcca3aa9404a4e Author: João Matos Date: Sat Oct 21 19:33:13 2023 +0100 Update README.md commit a5afda86036a13f95d2837f8628e6d17a60bfea3 Author: Stefan <29021710+Saalvage@users.noreply.github.com> Date: Fri Oct 20 21:00:04 2023 +0200 Fix parameterless constructors not being generated for structs (#1783) * Fix parameterless constructors not being generated for structs * Fix implicit non-trivial default ctor * Adjust `Ignore` linked issue commit b16e809b9e831324f015ab2dd1fd3c6e64012352 Author: Stefan <29021710+Saalvage@users.noreply.github.com> Date: Fri Oct 20 18:54:58 2023 +0200 Introduce `GenerateFreeStandingFunctionsClassName` option (#1782) * Introduce `GenerateFreeStandingFunctionsClassName` option * Support CLI and fixes commit 03874e743fc663879a124f3d37dd7b81d4ceedc7 Author: Stefan <29021710+Saalvage@users.noreply.github.com> Date: Thu Oct 19 17:24:55 2023 +0200 Fix Value Type String Member Invalid Codegen (#1778) * Fix code generation * Generate exception on broken struct set op * Remove redundant usings commit adffc99bc8bd37dd67d1597c12c9d917910ae295 Author: Salvage <29021710+Saalvage@users.noreply.github.com> Date: Thu Oct 19 14:51:06 2023 +0200 Fix erroneous newline commit b4f261ea381fffc1708704c59044165668ec11fc Author: Salvage <29021710+Saalvage@users.noreply.github.com> Date: Thu Oct 19 14:26:00 2023 +0200 Simplify `IsTemplateParameterType` commit 28000a14b489a8711210cc75f0ba23b34ab7a013 Author: Salvage <29021710+Saalvage@users.noreply.github.com> Date: Thu Oct 19 01:19:07 2023 +0200 Fix #1251 three parameter equality operator - Operators in generic classes do not attempt to generate as extension methods anymore - Empty `...Extensions` classes are no longer generated - `string` as a template argument is correctly cast - `MarshalCharAsManagedChar` option also generates correct casts - Suppress warning regarding returning struct field by ref - Eliminate some tabs that snuck into the test C++ header commit d7faf5f0637232227ddd3c8b672d2add805910f0 Author: Joao Matos Date: Wed Oct 18 17:39:49 2023 +0100 Fix SDL_PollEvent generation in the SDL example. Fixes https://github.com/mono/CppSharp/issues/978. Thanks to @Saalvage. commit 7f567b604b973584e5d56a436ec8d2a8b93feb26 Author: Salvage <29021710+Saalvage@users.noreply.github.com> Date: Wed Oct 18 18:26:03 2023 +0200 Fix non-void returning functions with value-type out parameters Also fixes indentation commit 0c60384ea361967162579ac417c2b83397c06d85 Author: Salvage <29021710+Saalvage@users.noreply.github.com> Date: Wed Oct 18 16:49:41 2023 +0200 Additional bump commit 0534e33178c8b9dbf8694df708beb1fbd0c6fc0e Author: Salvage <29021710+Saalvage@users.noreply.github.com> Date: Wed Oct 18 16:35:10 2023 +0200 Bump GH actions versions to solve warnings commit a6ef9d90952c6d934d6cde7448edd2a9a23a4dd7 Author: Salvage <29021710+Saalvage@users.noreply.github.com> Date: Wed Oct 18 16:19:42 2023 +0200 Fix source dir commit 7e6c49225f32009d5b763a714b427e2681c0f956 Author: Salvage <29021710+Saalvage@users.noreply.github.com> Date: Wed Oct 18 16:08:51 2023 +0200 Test fix broken packages commit 2a351b7f2212fd209f1d41623c35d5a17407f253 Author: Joao Matos Date: Wed Oct 18 16:03:36 2023 +0100 Update our version to 1.1. commit 20950c5a34ee88f1e2aed93a13fbedb2096adeee Author: Salvage <29021710+Saalvage@users.noreply.github.com> Date: Wed Oct 18 04:58:38 2023 +0200 More stringent test; Fix indentation (of the code itself, not in the generator) commit ebe6b8a4154d0c8f18ce4f66ca1c9a3a28c35680 Author: Salvage <29021710+Saalvage@users.noreply.github.com> Date: Wed Oct 18 04:47:13 2023 +0200 Fix value type out parameters --- .github/workflows/llvm.yml | 6 +++++- build/llvm/LLVM.lua | 34 ++++++++++++++++++++++++++++++++++ build/scripts/Utils.lua | 7 ++++++- 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/.github/workflows/llvm.yml b/.github/workflows/llvm.yml index 87b31a6803..966cc16922 100644 --- a/.github/workflows/llvm.yml +++ b/.github/workflows/llvm.yml @@ -27,6 +27,10 @@ jobs: - uses: actions/checkout@v4 - uses: lukka/get-cmake@latest + - name: Install cross compilers + if: startsWith(matrix.config.os, 'ubuntu') && startsWith(matrix.config.platform, 'arm64') + run: sudo apt install -y g++-aarch64-linux-gnu gcc-aarch64-linux-gnu + - name: Clone LLVM shell: bash run: build/build.sh clone_llvm @@ -43,4 +47,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: llvm - path: build/llvm/llvm-*-*.* \ No newline at end of file + path: build/llvm/llvm-*-*.* diff --git a/build/llvm/LLVM.lua b/build/llvm/LLVM.lua index 015743965b..0a08c06191 100644 --- a/build/llvm/LLVM.lua +++ b/build/llvm/LLVM.lua @@ -438,10 +438,44 @@ function build_llvm(llvm_build) local options = os.ishost("macosx") and "-DLLVM_ENABLE_LIBCXX=true" or "" local is32bits = target_architecture() == "x86" + local targetIsArm64 = target_architecture() == "arm64" + if is32bits then options = options .. (is32bits and " -DLLVM_BUILD_32_BITS=true" or "") end + if targetIsArm64 then + if os.host() == "linux" then + local host_arch = unix_host_architecture() + if host_arch ~= "aarch64" then + options = options .. "" + .. ' -DCMAKE_SYSTEM_NAME=Linux' + .. ' -DCMAKE_SYSTEM_PROCESSOR=aarch64' + .. ' -DCMAKE_C_COMPILER=/usr/bin/aarch64-linux-gnu-gcc' + .. ' -DCMAKE_CXX_COMPILER=/usr/bin/aarch64-linux-gnu-g++' + .. ' -DCMAKE_ASM_COMPILER=/usr/bin/aarch64-linux-gnu-as' + .. ' -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER' + .. ' -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY' + .. ' -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY' + .. ' -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY' + .. ' ' .. options + end + end + if os.host() == "macosx" then + local host_arch = unix_host_architecture() + if host_arch ~= "arm64" then + options = options .. "" + .. ' -DCMAKE_SYSTEM_NAME=Darwin' + .. ' -DCMAKE_SYSTEM_PROCESSOR=arm64' + .. ' -DCMAKE_C_COMPILER_TARGET=arm64-apple-darwin21.6.0' + .. ' -DCMAKE_CXX_COMPILER_TARGET=arm64-apple-darwin21.6.0' + .. ' -DCMAKE_ASM_COMPILER_TARGET=arm64-apple-darwin21.6.0' + .. ' ' .. options + end + end + end + + cmake("Ninja", conf, llvm_build, options) ninja('"' .. llvm_build .. '"') ninja('"' .. llvm_build .. '"', "clang-headers") diff --git a/build/scripts/Utils.lua b/build/scripts/Utils.lua index afccb4e731..0ec325cafd 100644 --- a/build/scripts/Utils.lua +++ b/build/scripts/Utils.lua @@ -112,6 +112,11 @@ function download(url, file, try) return res, code end +function unix_host_architecture() + result, errorCode = os.outputof("uname -m") + return result +end + -- -- Allows copying directories. -- It uses the premake patterns (**=recursive match, *=file match) @@ -202,4 +207,4 @@ function os.rmfiles(src_dir, filter) print( "Error: " .. counter .. "/" .. #matches .. " files removed.") return nil end -end \ No newline at end of file +end