From b94c84d3046c631bca405f857a7aafc6c3275610 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20L=C3=BCbe=C3=9F?= Date: Sat, 9 Apr 2022 12:33:05 +0200 Subject: [PATCH] GlitchyEngineHelper project --- GlitchyEngine/BeefProj.toml | 2 +- GlitchyEngineHelper/BeefProj.toml | 10 ++++ GlitchyEngineHelper/CMakeLists.txt | 13 +++++ GlitchyEngineHelper/CMakePresets.json | 61 +++++++++++++++++++++ GlitchyEngineHelper/GlitchyEngineHelper.cpp | 16 ++++++ GlitchyEngineHelper/GlitchyEngineHelper.h | 11 ++++ GlitchyEngineHelper/src/xxHash.bf | 22 ++++++++ GlitchyEngineHelper/vendor/xxHash | 1 + 8 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 GlitchyEngineHelper/BeefProj.toml create mode 100644 GlitchyEngineHelper/CMakeLists.txt create mode 100644 GlitchyEngineHelper/CMakePresets.json create mode 100644 GlitchyEngineHelper/GlitchyEngineHelper.cpp create mode 100644 GlitchyEngineHelper/GlitchyEngineHelper.h create mode 100644 GlitchyEngineHelper/src/xxHash.bf create mode 160000 GlitchyEngineHelper/vendor/xxHash diff --git a/GlitchyEngine/BeefProj.toml b/GlitchyEngine/BeefProj.toml index a9695a3..bce6d77 100644 --- a/GlitchyEngine/BeefProj.toml +++ b/GlitchyEngine/BeefProj.toml @@ -1,5 +1,5 @@ FileVersion = 1 -Dependencies = {GlitchLog = "*", corlib = "*", DirectX = "*", DirectXTK = "*", FreeType = "*", cgltf-beef = "*", msdfgen-beef = "*", ImGui = "*", ImGuiImplDX11 = "*", ImGuiImplWin32 = "*", ImGuizmo = "*", Beefy2D = "*", LodePng = "*"} +Dependencies = {GlitchLog = "*", corlib = "*", DirectX = "*", DirectXTK = "*", FreeType = "*", cgltf-beef = "*", msdfgen-beef = "*", ImGui = "*", ImGuiImplDX11 = "*", ImGuiImplWin32 = "*", ImGuizmo = "*", Beefy2D = "*", LodePng = "*", GlitchyEngineHelper = "*"} [Project] Name = "GlitchyEngine" diff --git a/GlitchyEngineHelper/BeefProj.toml b/GlitchyEngineHelper/BeefProj.toml new file mode 100644 index 0000000..8bc7f31 --- /dev/null +++ b/GlitchyEngineHelper/BeefProj.toml @@ -0,0 +1,10 @@ +FileVersion = 1 +Dependencies = {corlib = "*", corlib = "*"} + +[Project] +Name = "GlitchyEngineHelper" +TargetType = "BeefLib" +StartupObject = "GlitchyEngineHelper.Program" + +[Configs.Debug.Win64] +LibPaths = ["$(ProjectDir)/out/build/x64-debug/GlitchyEngineHelper.lib"] diff --git a/GlitchyEngineHelper/CMakeLists.txt b/GlitchyEngineHelper/CMakeLists.txt new file mode 100644 index 0000000..8139a91 --- /dev/null +++ b/GlitchyEngineHelper/CMakeLists.txt @@ -0,0 +1,13 @@ +# CMakeList.txt : CMake project for GlitchyEngineHelper, include source and define +# project specific logic here. +# +cmake_minimum_required (VERSION 3.15) + +project ("GlitchyEngineHelper") + +# Add source to this project's executable. +add_library (GlitchyEngineHelper "GlitchyEngineHelper.cpp" "GlitchyEngineHelper.h" "vendor/xxHash/xxhash.c" "vendor/xxHash/xxhash.h") + +# Use statically linked multithreaded MSVC runtime +set_property(TARGET GlitchyEngineHelper PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreadedDebug") +#$<$:Debug> \ No newline at end of file diff --git a/GlitchyEngineHelper/CMakePresets.json b/GlitchyEngineHelper/CMakePresets.json new file mode 100644 index 0000000..abf4065 --- /dev/null +++ b/GlitchyEngineHelper/CMakePresets.json @@ -0,0 +1,61 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "windows-base", + "hidden": true, + "generator": "Ninja", + "binaryDir": "${sourceDir}/out/build/${presetName}", + "installDir": "${sourceDir}/out/install/${presetName}", + "cacheVariables": { + "CMAKE_C_COMPILER": "cl.exe", + "CMAKE_CXX_COMPILER": "cl.exe" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "x64-debug", + "displayName": "x64 Debug", + "inherits": "windows-base", + "architecture": { + "value": "x64", + "strategy": "external" + }, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "x64-release", + "displayName": "x64 Release", + "inherits": "x64-debug", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "x86-debug", + "displayName": "x86 Debug", + "inherits": "windows-base", + "architecture": { + "value": "x86", + "strategy": "external" + }, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "x86-release", + "displayName": "x86 Release", + "inherits": "x86-debug", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + } + ] +} diff --git a/GlitchyEngineHelper/GlitchyEngineHelper.cpp b/GlitchyEngineHelper/GlitchyEngineHelper.cpp new file mode 100644 index 0000000..fb18a7c --- /dev/null +++ b/GlitchyEngineHelper/GlitchyEngineHelper.cpp @@ -0,0 +1,16 @@ +// GlitchyEngineHelper.cpp : Defines the entry point for the application. +// + +#include "GlitchyEngineHelper.h" + +using namespace std; + +GE_EXPORT int GE_CALLTYPE test(int x, int y) +{ + return x + y; +} + +GE_EXPORT XXH64_hash_t bla(void* buffer, size_t size, XXH64_hash_t seed) +{ + return XXH64(buffer, size, seed); +} diff --git a/GlitchyEngineHelper/GlitchyEngineHelper.h b/GlitchyEngineHelper/GlitchyEngineHelper.h new file mode 100644 index 0000000..67af83b --- /dev/null +++ b/GlitchyEngineHelper/GlitchyEngineHelper.h @@ -0,0 +1,11 @@ +// GlitchyEngineHelper.h : Include file for standard system include files, +// or project specific include files. + +#pragma once + +#define GE_EXPORT extern "C" __declspec(dllexport) +#define GE_CALLTYPE __stdcall + +#include "vendor/xxHash/xxhash.h" + +// TODO: Reference additional headers your program requires here. diff --git a/GlitchyEngineHelper/src/xxHash.bf b/GlitchyEngineHelper/src/xxHash.bf new file mode 100644 index 0000000..f04a7d4 --- /dev/null +++ b/GlitchyEngineHelper/src/xxHash.bf @@ -0,0 +1,22 @@ +using System; +using System.Interop; + +namespace xxHash +{ + struct XXH64_hash : uint64{} + + static + { + [LinkName(.C)] + public static extern XXH64_hash XXH64(void* buffer, c_size size, XXH64_hash seed = 0); + } + + static class xxHash + { + [Inline] + public static XXH64_hash ComputeHash(StringView string, XXH64_hash seed = 0) + { + return XXH64(string.Ptr, (.)string.Length, seed); + } + } +} \ No newline at end of file diff --git a/GlitchyEngineHelper/vendor/xxHash b/GlitchyEngineHelper/vendor/xxHash new file mode 160000 index 0000000..b51ffce --- /dev/null +++ b/GlitchyEngineHelper/vendor/xxHash @@ -0,0 +1 @@ +Subproject commit b51ffce60232af69f971732dcecd2bcb3ad4179d