Skip to content

Commit 7c88b6e

Browse files
authored
Merge pull request #12 from DerKleinePunk/Update326andBuild
Update to Dart 3.3.0 and little changes for Building on Windows
2 parents fa78740 + 37f1e07 commit 7c88b6e

File tree

21 files changed

+103
-411
lines changed

21 files changed

+103
-411
lines changed

.dart_version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# This file contains the current Dart version we build against
2-
3.1.3
2+
3.3.0

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- run: dart pub get
2828
working-directory: ./scripts/build_helpers
2929
- name: Build Dart
30-
run: dart ./scripts/build_helpers/bin/build_dart.dart
30+
run: dart ./scripts/build_helpers/bin/build_dart.dart -v
3131
- uses: threeal/[email protected]
3232
- name: Build Shared Library
3333
run: cmake --build build --config release

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
dart-sdk/*
22
.build/*
3+
build/*
34
artifacts/*

.vscode/launch.json

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,17 @@
55
"version": "0.2.0",
66
"configurations": [
77
{
8-
"name": "Dart: Attach to Simple",
9-
"type": "dart",
10-
"request": "attach",
11-
"vmServiceUri": "http://127.0.0.1:5858/"
8+
9+
"name": "(WIN)RealTime Sample",
10+
"type": "cppvsdbg",
11+
"request": "launch",
12+
//"preLaunchTask": "buildSimpelTest",
13+
"program": "${workspaceFolder}/build/Debug/realtime_example.exe",
14+
"args": [],
15+
"stopAtEntry": false,
16+
"cwd": "${fileDirname}",
17+
"environment": [],
18+
"console": "externalTerminal"
1219
}
1320
]
1421
}

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ Github Actions currently builds a Windows x64 `.dll`, A Linux x64 `.so`, and a m
2727
You need:
2828
* git
2929
* Dart 3+
30-
* C++ build tools for your platform (Visual Studio, XCode, gcc, etc)
30+
* C++ build tools for your platform (Visual Studio, XCode, gcc, etc)
31+
* For Windows
32+
* 2019 16.61 with 10.0.20348.0 SDK don't forget install Debugger Tools
33+
* 2022 17 with ? SDK don't forget install Debugger Tools
34+
* 2017 15 with ? SDK don't forget install Debugger Tools
35+
* see dart-sdk\sdk\build\vs_toolchain.py
3136
* CMake
3237

3338
Optionally, I recommend installing [`depot_tools`](https://www.chromium.org/developers/how-tos/depottools/) and making sure it is on your path before running setup scripts. Without depot_tools, the scripts will download them anyway, but having them already set up will save you some time with subsequent builds.
@@ -38,8 +43,14 @@ Optionally, I recommend installing [`depot_tools`](https://www.chromium.org/deve
3843
> This will set up some environment variables that will be needed to build Dart properly.
3944
4045
The first step is to build a statically linkable verison of Dart. This requires that we download Dart, patch some of the Dart build files, and then run the actual build. Thankfully there is a Dart script to do this.
46+
build_dart commandline
47+
* -v -> Verbose Log
48+
* -t -> Build Type all, release, debug
4149

4250
```bash
51+
cd ./scripts/build_helpers
52+
dart pub get
53+
cd ../..
4354
dart ./scripts/build_helpers/bin/build_dart.dart
4455
```
4556

examples/realtime_example/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ set(CMAKE_CXX_STANDARD 17)
66
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
77

88
set(CUTE_FRAMEWORK_STATIC ON)
9+
set(CF_FRAMEWORK_BUILD_TESTS OFF)
10+
# Samples Build on Windows Falied
11+
set(CF_FRAMEWORK_BUILD_SAMPLES OFF)
912

1013
include(FetchContent)
1114
FetchContent_Declare(

examples/realtime_example/dart/drawable.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'dart:ffi';
22

3-
class CF_Color extends Struct {
3+
final class CF_Color extends Struct {
44
@Float()
55
external double r;
66

@@ -14,7 +14,7 @@ class CF_Color extends Struct {
1414
external double a;
1515
}
1616

17-
class Drawable extends Struct {
17+
final class Drawable extends Struct {
1818
@Int32()
1919
external int x;
2020

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
name: worm_example
1+
name: realtime_example
22
environment:
3-
sdk: ">=2.17.0 <3.0.0"
3+
sdk: ">=3.0.0 <=3.3.0"
44

55
dependencies:
6-
ffi: ^2.0.1
6+
ffi: ^2.1.0

examples/realtime_example/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ bool init_dart() {
2020
DartDllConfig config;
2121
DartDll_Initialize(config);
2222

23+
//if package_config.json not exits run pub get
2324
_dart_isolate = DartDll_LoadScript("dart/main.dart",
2425
"dart/.dart_tool/package_config.json");
2526
if (_dart_isolate == nullptr) {

examples/simple_example/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,10 @@ add_custom_command(TARGET simple_example POST_BUILD
1515
COMMAND_EXPAND_LISTS
1616
)
1717

18-
target_link_libraries(simple_example PUBLIC dart_dll)
18+
add_dependencies(simple_example ALWAYS_DO_POST_BUILD)
19+
20+
target_link_libraries(simple_example PUBLIC dart_dll)
21+
22+
if (MSVC)
23+
set_property(TARGET simple_example PROPERTY VS_DEBUGGER_WORKING_DIRECTORY $<TARGET_FILE_DIR:simple_example>)
24+
endif()

0 commit comments

Comments
 (0)