Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code generator #25

Merged
merged 14 commits into from
Apr 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,6 @@ Network Trash Folder
Temporary Items
.apdisk

# Project
.vscode

# Cake
.cake

3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "freetype"]
path = freetype
url = git@github.com:ryancheung/freetype.git
47 changes: 47 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"name": "Launch Code Generator (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "buildGenerator",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/FreeTypeSharp.Generator/bin/Debug/net8.0/FreeTypeSharp.Generator.dll",
"args": [
"-o${workspaceFolder}/FreeTypeSharp/Generated",
"-f${workspaceFolder}/FreeTypeSharp.Generator/main.h",
"-i${workspaceFolder}/freetype/include",
"-nFreeTypeSharp"
],
"cwd": "${workspaceFolder}/FreeTypeSharp.Generator/bin/Debug/net8.0",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"stopAtEntry": false
},
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"name": "Launch SkiaDemo (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/FreeTypeSharp.SkiaDemo/bin/Debug/net8.0/FreeTypeSharp.SkiaDemo.dll",
"args": [],
"cwd": "${workspaceFolder}/FreeTypeSharp.SkiaDemo/bin/Debug/net8.0",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}
29 changes: 29 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/FreeTypeSharp.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "buildGenerator",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/FreeTypeSharp.Generator/FreeTypeSharp.Generator.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFramework>net8.0-android</TargetFramework>
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<OutputType>Exe</OutputType>
</PropertyGroup>

Expand Down
10 changes: 5 additions & 5 deletions FreeTypeSharp.Android.Test/MainActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
using Android.Runtime;
using Android.Widget;
using System;
using FreeTypeSharp;
using static FreeTypeSharp.Native.FT;
using static FreeTypeSharp.FT;

namespace FreeTypeSharp.Android.Test
{
[Activity(Label = "@string/app_name", MainLauncher = true)]
public class MainActivity : Activity
{
protected override void OnCreate(Bundle savedInstanceState)
protected unsafe override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);

// Set our view from the "main" layout resource
SetContentView(Resource.Layout.activity_main);

var textView1 = FindViewById<TextView>(Resource.Id.textView1);
var textView1 = FindViewById<TextView>(Resource.Id.textView1);

var library = new FreeTypeLibrary();
FT_Library_Version(library.Native, out var major, out var minor, out var patch);
int major, minor, patch;
FT_Library_Version(library.Native, &major, &minor, &patch);
textView1.Text = $"FreeType version: {major}.{minor}.{patch}";
}
}
Expand Down
1 change: 1 addition & 0 deletions FreeTypeSharp.Core.Test/FreeTypeSharp.Core.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
Expand Down
7 changes: 4 additions & 3 deletions FreeTypeSharp.Core.Test/Program.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
using System;
using static FreeTypeSharp.Native.FT;
using static FreeTypeSharp.FT;

namespace FreeTypeSharp.Core.Test
{
class Program
{
static void Main(string[] args)
unsafe static void Main(string[] args)
{
var library = new FreeTypeLibrary();
FT_Library_Version(library.Native, out var major, out var minor, out var patch);
int major, minor, patch;
FT_Library_Version(library.Native, &major, &minor, &patch);
Console.WriteLine($"FreeType version: {major}.{minor}.{patch}");
}
}
Expand Down
17 changes: 17 additions & 0 deletions FreeTypeSharp.Generator/FreeTypeSharp.Generator.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageReference Include="CppSharp" Version="1.1.5.3168" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" />
</ItemGroup>

</Project>
Loading