diff --git a/.gitignore b/.gitignore
index b132b16..668d5eb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@ obj/
riderModule.iml
/_ReSharper.Caches/
.idea
+.vs
.vscode
nuget_repo
**/out
diff --git a/Dockerfile b/Dockerfile
index b5790f8..40df427 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -5,6 +5,9 @@
FROM debian:stable-slim
WORKDIR /root
+# Set host name.
+RUN echo quik_docker_env > /etc/hostname
+
# Download and Install dependencies.
# Install WGET
RUN apt-get update
@@ -28,6 +31,8 @@ WORKDIR /root
gcc-aarch64-linux-gnu \
gcc-i686-linux-gnu \
git \
+ libharfbuzz-dev \
+ libpng-dev \
libssl-dev \
libxml2-dev \
lzma-dev \
diff --git a/Quik.FreeType/FT.cs b/Quik.FreeType/FT.cs
index 4af977e..9fd7cec 100644
--- a/Quik.FreeType/FT.cs
+++ b/Quik.FreeType/FT.cs
@@ -1,4 +1,5 @@
using System;
+using System.Reflection;
using System.Runtime.InteropServices;
namespace Quik.FreeType
@@ -7,6 +8,42 @@ namespace Quik.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")]
public static extern FTError InitFreeType(out FTLibrary library);
diff --git a/Quik.FreeType/Quik.FreeType.csproj b/Quik.FreeType/Quik.FreeType.csproj
index a11ae84..4ecbbeb 100644
--- a/Quik.FreeType/Quik.FreeType.csproj
+++ b/Quik.FreeType/Quik.FreeType.csproj
@@ -4,10 +4,25 @@
net6.0
7.3
true
+ linux-arm;linux-arm64;linux-x64;win-x86;win-x64
+
+
+
+
+ True
+ Quik.FreeType
+ 1.0.0
+ FreeType Authors, H. Utku Maden
+
+ A C# wrapper for the FreeType font loading library.
+
-
+
+ runtimes
+ true
+ PreserveNewest
+
-
diff --git a/Quik.FreeType/build_native.sh b/Quik.FreeType/build_native.sh
new file mode 100644
index 0000000..ca44911
--- /dev/null
+++ b/Quik.FreeType/build_native.sh
@@ -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
diff --git a/compose.yaml b/compose.yaml
index 6683ac5..faf18c9 100644
--- a/compose.yaml
+++ b/compose.yaml
@@ -4,10 +4,4 @@ services:
user: quik
working_dir: /home/quik
volumes:
- - src:/home/quik/src
-volumes:
- src:
- driver_opts:
- type: none
- device: ${PWD}
- o: bind
\ No newline at end of file
+ - .:/home/quik/src
\ No newline at end of file
diff --git a/sh/init.sh b/sh/init.sh
index 79deabc..6139bdd 100755
--- a/sh/init.sh
+++ b/sh/init.sh
@@ -11,5 +11,3 @@ export QNUGET_LOCAL_PATH=$QUIK_SRC/nuget_repo
# Create nuget repository.
mkdir -p $QUIK_SRC/nuget_repo
nuget sources Add -Name $QNUGET_LOCAL -Source $QNUGET_LOCAL_PATH -NonInteractive
-
-source sh/quik_build_native.sh
\ No newline at end of file
diff --git a/sh/quik_build_native.sh b/sh/quik_build_native.sh
index e0a3997..cc5b191 100755
--- a/sh/quik_build_native.sh
+++ b/sh/quik_build_native.sh
@@ -2,9 +2,9 @@
# $1 Source path of the project.
# $2 Target architecture list.
+# DST is the destination directory.
SRC=$1
-NAME=$(dirname $SRC)
ARCHS=$2
if [ -z "$SRC" ]
@@ -18,24 +18,30 @@ then
ARCHS="linux-arm linux-arm64 linux-x64 win-x64 win-x86"
fi
-cd $SRC
+if [ -z "$DST" ]
+then
+ DST=$PWD
+fi
for ARCH in $ARCHS; do
# Output directory.
- PREFIX=runtimes/$ARCH/native
+ PREFIX=$DST/runtimes/$ARCH/native
# Build directory.
- BUILD=out/$ARCH
+ BUILD=$DST/out/$ARCH
# Cmake toolchain file.
- TOOLCHAIN=../cmake/$ARCH.cmake
+ TOOLCHAIN=$DST/../cmake/$ARCH.cmake
# Create directories.
mkdir -p $PREFIX $BUILD
# Configure CMAKE.
- cmake -B $BUILD -S . \
+ cmake -B $BUILD -S $SRC \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_C_FLAGS=-static-libgcc \
+ -DCMAKE_CXX_FLAGS=-static-libgcc \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
- -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN
+ -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN \
+ $QUIK_ADDITIONAL_CMAKE
# Build and install.
ninja -C $BUILD all