Finish backporting Freetype from in development quik.
This commit is contained in:
parent
6240f5921b
commit
cea243a3b8
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,6 +4,7 @@ obj/
|
|||||||
riderModule.iml
|
riderModule.iml
|
||||||
/_ReSharper.Caches/
|
/_ReSharper.Caches/
|
||||||
.idea
|
.idea
|
||||||
|
.vs
|
||||||
.vscode
|
.vscode
|
||||||
nuget_repo
|
nuget_repo
|
||||||
**/out
|
**/out
|
||||||
|
@ -5,6 +5,9 @@
|
|||||||
FROM debian:stable-slim
|
FROM debian:stable-slim
|
||||||
WORKDIR /root
|
WORKDIR /root
|
||||||
|
|
||||||
|
# Set host name.
|
||||||
|
RUN echo quik_docker_env > /etc/hostname
|
||||||
|
|
||||||
# Download and Install dependencies.
|
# Download and Install dependencies.
|
||||||
# Install WGET
|
# Install WGET
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
@ -28,6 +31,8 @@ WORKDIR /root
|
|||||||
gcc-aarch64-linux-gnu \
|
gcc-aarch64-linux-gnu \
|
||||||
gcc-i686-linux-gnu \
|
gcc-i686-linux-gnu \
|
||||||
git \
|
git \
|
||||||
|
libharfbuzz-dev \
|
||||||
|
libpng-dev \
|
||||||
libssl-dev \
|
libssl-dev \
|
||||||
libxml2-dev \
|
libxml2-dev \
|
||||||
lzma-dev \
|
lzma-dev \
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Quik.FreeType
|
namespace Quik.FreeType
|
||||||
@ -7,6 +8,42 @@ namespace Quik.FreeType
|
|||||||
{
|
{
|
||||||
private const string freetype2 = "freetype";
|
private const string freetype2 = "freetype";
|
||||||
|
|
||||||
|
private static readonly string[] LibraryNames = new string[]
|
||||||
|
{
|
||||||
|
//FIXME: This is wrong on so many levels, but, i need to do this
|
||||||
|
// in order to get a change of this running.
|
||||||
|
"runtimes/win-x64/native/libfreetype.dll",
|
||||||
|
"runtimes/win-x86/native/libfreetype.dll",
|
||||||
|
"runtimes/linux-arm/native/libfreetype.so",
|
||||||
|
"runtimes/linux-arm64/native/libfreetype.so",
|
||||||
|
"runtimes/linux-x64/native/libfreetype.so",
|
||||||
|
"runtimes/native/libfreetype.dylib",
|
||||||
|
"libfreetype.dll",
|
||||||
|
"libfreetype.so",
|
||||||
|
"libfreetype.dylib",
|
||||||
|
};
|
||||||
|
|
||||||
|
static FT()
|
||||||
|
{
|
||||||
|
NativeLibrary.SetDllImportResolver(Assembly.GetExecutingAssembly(), Resolver);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IntPtr Resolver(string libraryName, Assembly assembly, DllImportSearchPath? searchPath)
|
||||||
|
{
|
||||||
|
if (libraryName != freetype2)
|
||||||
|
return IntPtr.Zero;
|
||||||
|
|
||||||
|
foreach (string name in LibraryNames)
|
||||||
|
{
|
||||||
|
if (NativeLibrary.TryLoad(name, assembly, searchPath, out IntPtr handle))
|
||||||
|
{
|
||||||
|
return handle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NativeLibrary.Load(libraryName);
|
||||||
|
}
|
||||||
|
|
||||||
[DllImport(freetype2, EntryPoint = "FT_Init_FreeType")]
|
[DllImport(freetype2, EntryPoint = "FT_Init_FreeType")]
|
||||||
public static extern FTError InitFreeType(out FTLibrary library);
|
public static extern FTError InitFreeType(out FTLibrary library);
|
||||||
|
|
||||||
|
@ -4,10 +4,25 @@
|
|||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<LangVersion>7.3</LangVersion>
|
<LangVersion>7.3</LangVersion>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<RuntimeIdentifiers>linux-arm;linux-arm64;linux-x64;win-x86;win-x64</RuntimeIdentifiers>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<!-- Nuget Properties. -->
|
||||||
|
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||||
|
<PackageId>Quik.FreeType</PackageId>
|
||||||
|
<Version>1.0.0</Version>
|
||||||
|
<Authors>FreeType Authors, H. Utku Maden</Authors>
|
||||||
|
<Description>
|
||||||
|
A C# wrapper for the FreeType font loading library.
|
||||||
|
</Description>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Quik\Quik.csproj" />
|
<Content Include="runtimes/**">
|
||||||
|
<PackagePath>runtimes</PackagePath>
|
||||||
|
<Pack>true</Pack>
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
8
Quik.FreeType/build_native.sh
Normal file
8
Quik.FreeType/build_native.sh
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
cd $(dirname "$0")
|
||||||
|
|
||||||
|
# Apply the patch file that makes it easier to build freetype.
|
||||||
|
# Note that this doesn't work all that well on windows.
|
||||||
|
cat ../lib/freetype_patch.diff | git -C ../lib/freetype apply
|
||||||
|
|
||||||
|
QUIK_ADDITIONAL_CMAKE=-DBUILD_SHARED_LIBS\=true DST=$PWD ../sh/quik_build_native.sh ../lib/freetype
|
@ -4,10 +4,4 @@ services:
|
|||||||
user: quik
|
user: quik
|
||||||
working_dir: /home/quik
|
working_dir: /home/quik
|
||||||
volumes:
|
volumes:
|
||||||
- src:/home/quik/src
|
- .:/home/quik/src
|
||||||
volumes:
|
|
||||||
src:
|
|
||||||
driver_opts:
|
|
||||||
type: none
|
|
||||||
device: ${PWD}
|
|
||||||
o: bind
|
|
@ -11,5 +11,3 @@ export QNUGET_LOCAL_PATH=$QUIK_SRC/nuget_repo
|
|||||||
# Create nuget repository.
|
# Create nuget repository.
|
||||||
mkdir -p $QUIK_SRC/nuget_repo
|
mkdir -p $QUIK_SRC/nuget_repo
|
||||||
nuget sources Add -Name $QNUGET_LOCAL -Source $QNUGET_LOCAL_PATH -NonInteractive
|
nuget sources Add -Name $QNUGET_LOCAL -Source $QNUGET_LOCAL_PATH -NonInteractive
|
||||||
|
|
||||||
source sh/quik_build_native.sh
|
|
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
# $1 Source path of the project.
|
# $1 Source path of the project.
|
||||||
# $2 Target architecture list.
|
# $2 Target architecture list.
|
||||||
|
# DST is the destination directory.
|
||||||
|
|
||||||
SRC=$1
|
SRC=$1
|
||||||
NAME=$(dirname $SRC)
|
|
||||||
ARCHS=$2
|
ARCHS=$2
|
||||||
|
|
||||||
if [ -z "$SRC" ]
|
if [ -z "$SRC" ]
|
||||||
@ -18,24 +18,30 @@ then
|
|||||||
ARCHS="linux-arm linux-arm64 linux-x64 win-x64 win-x86"
|
ARCHS="linux-arm linux-arm64 linux-x64 win-x64 win-x86"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $SRC
|
if [ -z "$DST" ]
|
||||||
|
then
|
||||||
|
DST=$PWD
|
||||||
|
fi
|
||||||
|
|
||||||
for ARCH in $ARCHS; do
|
for ARCH in $ARCHS; do
|
||||||
# Output directory.
|
# Output directory.
|
||||||
PREFIX=runtimes/$ARCH/native
|
PREFIX=$DST/runtimes/$ARCH/native
|
||||||
# Build directory.
|
# Build directory.
|
||||||
BUILD=out/$ARCH
|
BUILD=$DST/out/$ARCH
|
||||||
# Cmake toolchain file.
|
# Cmake toolchain file.
|
||||||
TOOLCHAIN=../cmake/$ARCH.cmake
|
TOOLCHAIN=$DST/../cmake/$ARCH.cmake
|
||||||
|
|
||||||
# Create directories.
|
# Create directories.
|
||||||
mkdir -p $PREFIX $BUILD
|
mkdir -p $PREFIX $BUILD
|
||||||
# Configure CMAKE.
|
# Configure CMAKE.
|
||||||
cmake -B $BUILD -S . \
|
cmake -B $BUILD -S $SRC \
|
||||||
-G Ninja \
|
-G Ninja \
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DCMAKE_C_FLAGS=-static-libgcc \
|
||||||
|
-DCMAKE_CXX_FLAGS=-static-libgcc \
|
||||||
-DCMAKE_INSTALL_PREFIX=$PREFIX \
|
-DCMAKE_INSTALL_PREFIX=$PREFIX \
|
||||||
-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN
|
-DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN \
|
||||||
|
$QUIK_ADDITIONAL_CMAKE
|
||||||
|
|
||||||
# Build and install.
|
# Build and install.
|
||||||
ninja -C $BUILD all
|
ninja -C $BUILD all
|
||||||
|
Loading…
Reference in New Issue
Block a user