-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
π©βπ» Add Mac build to workflow
Package up libs and header files for better distribution.
- Loading branch information
Jeff Ward
authored and
Jeff Ward
committed
Sep 25, 2023
1 parent
4e454e3
commit 4770d1f
Showing
8 changed files
with
84 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,12 +8,14 @@ jobs: | |
build: | ||
strategy: | ||
matrix: | ||
os: [windows-latest, ubuntu-latest] | ||
os: [windows-latest, ubuntu-latest, macos-latest] | ||
include: | ||
- os: windows-latest | ||
postfix: win | ||
- os: ubuntu-latest | ||
postfix: linux | ||
- os: macos-latest | ||
postfix: macos-x64 | ||
env: | ||
DEPOT_TOOLS_WIN_TOOLCHAIN: 0 | ||
continue-on-error: true | ||
|
@@ -29,11 +31,11 @@ jobs: | |
- uses: threeal/[email protected] | ||
- name: Build Shared Library | ||
run: cmake --build build --config release | ||
- name: Assemble artifacts | ||
run: dart ./scripts/build_helpers/bin/assemble_artifacts.dart | ||
- name: 'Upload Artifact' | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: libs-${{ matrix.postfix }} | ||
path: | | ||
./build/src/Release/ | ||
./build/src/*.so | ||
name: lib-${{ matrix.postfix }} | ||
path: ./artifacts | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
dart-sdk/* | ||
.build/* | ||
.build/* | ||
artifacts/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Script to assemble artifacts into a single place | ||
import 'dart:io'; | ||
|
||
import 'package:build_helpers/build_helpers.dart'; | ||
import 'package:glob/glob.dart'; | ||
import 'package:glob/list_local_fs.dart'; | ||
import 'package:logger/logger.dart'; | ||
import 'package:path/path.dart' as path; | ||
|
||
void main() { | ||
if (!checkRightDirectory()) { | ||
// Not run from root. Exit. | ||
exit(-1); | ||
} | ||
// Always verbose | ||
BuildToolsLogger.initLogger(logLevel: Level.debug); | ||
|
||
final dest = Directory('artifacts'); | ||
dest.createSync(); | ||
_copyIncludeFiles(dest); | ||
_copyLibs(dest); | ||
} | ||
|
||
void _copyIncludeFiles(Directory dest) { | ||
final logger = BuildToolsLogger.shared; | ||
|
||
final includePath = Directory('dart-sdk/sdk/runtime/include'); | ||
if (!includePath.existsSync()) { | ||
logger.f("Couldn't find Dart SDK include dir."); | ||
exit(-1); | ||
} | ||
|
||
const dartIncludeFiles = ['dart_api.h', 'dart_tools_api.h']; | ||
Directory(path.join(dest.path, 'include')).createSync(recursive: true); | ||
for (var dartIncludeFile in dartIncludeFiles) { | ||
final file = File(path.join(includePath.path, dartIncludeFile)); | ||
file.copySync(path.join(dest.path, 'include', dartIncludeFile)); | ||
} | ||
|
||
final dartDllHeader = File('src/dart_dll.h'); | ||
dartDllHeader.copySync(path.join(dest.path, 'include', 'dart_dll.h')); | ||
} | ||
|
||
void _copyLibs(Directory dest) { | ||
final logger = BuildToolsLogger.shared; | ||
|
||
final builtLibPath = Directory('build/src'); | ||
if (!builtLibPath.existsSync()) { | ||
logger.f('Could not find built artifact path'); | ||
} | ||
|
||
final binDestPath = Directory(path.join(dest.path, 'bin')); | ||
binDestPath.createSync(recursive: true); | ||
|
||
var copyGlob = Glob('*.so'); | ||
if (Platform.isWindows) { | ||
copyGlob = Glob(path.join('Release', '*.*')); | ||
} else if (Platform.isMacOS) { | ||
copyGlob = Glob('*.dylib'); | ||
} | ||
final files = copyGlob.listSync(root: builtLibPath.path); | ||
for (var file in files) { | ||
(file as File).copySync(path.join(binDestPath.path, file.basename)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ dependencies: | |
args: ^2.4.2 | ||
path: ^1.8.0 | ||
logger: ^2.0.2 | ||
glob: ^2.1.2 | ||
|
||
dev_dependencies: | ||
lints: ^2.0.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters