Skip to content

Commit d2256e9

Browse files
Cross compile to arm for macos (#6)
* Add arm cross compile toolchain file * Fix * Test new cross compile * Add verify command * version * Try another thing cmake * Try fix? * Fix protocol issues * Fix * Build arm64 * Disable fail fast on test workflow * Remove old downloads * Update changelog
1 parent ab057ee commit d2256e9

File tree

5 files changed

+23
-10
lines changed

5 files changed

+23
-10
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
jobs:
1313
build:
1414
strategy:
15+
fail-fast: false
1516
matrix:
1617
os: [windows, ubuntu, macos]
1718
name: Build Server (${{matrix.os}})

.github/workflows/release.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ jobs:
1616
code-target: linux-x64
1717
- os: macos-latest
1818
code-target: darwin-x64
19+
- os: macos-latest
20+
code-target: darwin-arm64 # TODO: we should try and merge this with above, because it runs the exact same steps
1921

20-
name: ${{ matrix.os }}
22+
name: ${{ matrix.os }} - ${{ matrix.code-target }}
2123
runs-on: ${{ matrix.os }}
2224
steps:
2325
- uses: actions/checkout@v2
@@ -36,6 +38,10 @@ jobs:
3638
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
3739
cmake --build . --config Release --target luau-lsp
3840
41+
- name: (MacOS) Verify universal build
42+
if: matrix.os == 'macos-latest'
43+
run: lipo -archs build/luau-lsp
44+
3945
- name: Move Build + Copy into Extension
4046
if: matrix.os == 'windows-latest'
4147
shell: bash
@@ -102,6 +108,10 @@ jobs:
102108
with:
103109
name: dist-win32-x64
104110
path: dist
111+
- uses: actions/download-artifact@v1
112+
with:
113+
name: dist-darwin-arm64
114+
path: dist
105115
- run: ls -al ./dist
106116

107117
- name: Publish Release

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1212
- Added support for pull-based diagnostics
1313
- Added the base support for user configuration through extension settings
1414
- Added support for marking specific globs as ignored (through extension settings). If a file is ignored, diagnostics will ONLY be displayed when the file is explicitly opened. If the file is closed, diagnostics will be discarded.
15+
- Cross compiled macOS binary to arm64
1516

1617
### Changed
1718

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
cmake_minimum_required(VERSION 3.0.0)
1+
cmake_minimum_required(VERSION 3.19)
2+
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "")
23
project(luau-lsp LANGUAGES CXX)
34

45
include(CTest)

src/Protocol.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -320,14 +320,14 @@ struct Position
320320
size_t line;
321321
size_t character;
322322
};
323-
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Position, line, character);
323+
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Position, line, character);
324324

325325
struct Range
326326
{
327327
Position start;
328328
Position end;
329329
};
330-
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Range, start, end);
330+
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Range, start, end);
331331

332332
struct TextDocumentItem
333333
{
@@ -336,26 +336,26 @@ struct TextDocumentItem
336336
int version;
337337
std::string text;
338338
};
339-
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(TextDocumentItem, uri, languageId, version, text);
339+
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(TextDocumentItem, uri, languageId, version, text);
340340

341341
struct TextDocumentIdentifier
342342
{
343343
DocumentUri uri;
344344
};
345-
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(TextDocumentIdentifier, uri);
345+
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(TextDocumentIdentifier, uri);
346346

347347
struct VersionedTextDocumentIdentifier : TextDocumentIdentifier
348348
{
349349
int version;
350350
};
351-
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(VersionedTextDocumentIdentifier, uri, version);
351+
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(VersionedTextDocumentIdentifier, uri, version);
352352

353353
struct TextDocumentPositionParams
354354
{
355355
TextDocumentIdentifier textDocument;
356356
Position position;
357357
};
358-
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(TextDocumentPositionParams, textDocument, position);
358+
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(TextDocumentPositionParams, textDocument, position);
359359

360360
struct TextEdit
361361
{
@@ -388,7 +388,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(DidOpenTextDocumentParams, textD
388388
struct TextDocumentContentChangeEvent
389389
{
390390
// If only text is provided, then its considered to be the whole document
391-
std::optional<Range> range;
391+
std::optional<Range> range = std::nullopt;
392392
std::string text;
393393
};
394394
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(TextDocumentContentChangeEvent, range, text);
@@ -398,7 +398,7 @@ struct DidChangeTextDocumentParams
398398
VersionedTextDocumentIdentifier textDocument;
399399
std::vector<TextDocumentContentChangeEvent> contentChanges;
400400
};
401-
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(DidChangeTextDocumentParams, textDocument, contentChanges);
401+
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(DidChangeTextDocumentParams, textDocument, contentChanges);
402402

403403
struct DidCloseTextDocumentParams
404404
{

0 commit comments

Comments
 (0)