From 6f9a2fb7bd25fbefefb040ff1c003885dd1cf89a Mon Sep 17 00:00:00 2001 From: GuilhermeWerner <26710260+GuilhermeWerner@users.noreply.github.com> Date: Fri, 7 May 2021 09:28:28 -0300 Subject: [PATCH] Revert "Remove C Library" This reverts commit 362bb7f973532017abe1c10e2075102613cf5d1d. --- Native/Source/Library.c | 11 ++++++++ Native/Source/Library.h | 19 +++++++++++++ Native/premake5.lua | 62 +++++++++++++++++++++++++++++++++++++++++ premake5.lua | 10 +++++++ 4 files changed, 102 insertions(+) create mode 100644 Native/Source/Library.c create mode 100644 Native/Source/Library.h create mode 100644 Native/premake5.lua create mode 100644 premake5.lua diff --git a/Native/Source/Library.c b/Native/Source/Library.c new file mode 100644 index 0000000..11a4fd6 --- /dev/null +++ b/Native/Source/Library.c @@ -0,0 +1,11 @@ +// Copyright (c) TribuFu. All Rights Reserved + +#include "Library.h" +#include "TribuFu.h" + +char *Java_Hello(char *input) +{ + char *result = Hello("C"); + + return result; +} diff --git a/Native/Source/Library.h b/Native/Source/Library.h new file mode 100644 index 0000000..12443ae --- /dev/null +++ b/Native/Source/Library.h @@ -0,0 +1,19 @@ +// Copyright (c) TribuFu. All Rights Reserved + +#pragma once + +#include "TribuFu.h" + +#if defined(_MSC_VER) + #define EXPORT __declspec(dllexport) + #define IMPORT __declspec(dllimport) +#elif defined(__GNUC__) + #define EXPORT __attribute__((visibility("default"))) + #define IMPORT +#else + #define EXPORT + #define IMPORT + #pragma warning Unknown dynamic link import/export semantics. +#endif + +EXPORT char *Java_Hello(char *input); diff --git a/Native/premake5.lua b/Native/premake5.lua new file mode 100644 index 0000000..583e200 --- /dev/null +++ b/Native/premake5.lua @@ -0,0 +1,62 @@ +project "TribuFu.Jvm" + location "." + kind "SharedLib" + language "C" + + targetdir ("./Binaries/%{cfg.buildcfg}") + objdir ("./Intermediate/") + + files + { + "./Source/**.h", + "./Source/**.c", + } + + includedirs + { + "../Vendor/TribuFu" + } + + filter "system:windows" + staticruntime "Off" + systemversion "latest" + + links + { + "TribuFu.lib" + } + + libdirs + { + "../Vendor/TribuFu/Windows" + } + + filter { "system:windows", "configurations:debug" } + runtime "Debug" + symbols "on" + + filter { "system:windows", "configurations:release" } + runtime "Release" + optimize "on" + + filter "system:linux" + links + { + "TribuFu" + } + + libdirs + { + "../Vendor/TribuFu/Linux" + } + + filter "system:darwin" + links + { + "TribuFu" + } + + libdirs + { + "../Vendor/TribuFu/Mac" + } diff --git a/premake5.lua b/premake5.lua new file mode 100644 index 0000000..b1fe65c --- /dev/null +++ b/premake5.lua @@ -0,0 +1,10 @@ +workspace "DevKit.Jvm" + architecture "x64" + + configurations + { + "debug", + "release" + } + + include "Native"