Skip to content

Commit

Permalink
FIX initial compile
Browse files Browse the repository at this point in the history
FIX not MINGW, but WINDOWS
FIX dll works with x64 compiled windows lua
FIX compile with luajit for standard LÖVE distribution
FIX store x64 binaries (no need to recompile them everytime)
FIX store x64 binaries (no need to recompile them everytime)
FIX compile in linux
FIX discard redundant wrappers
FIX disable atexit, which seems to trigger SEGV
FIX generated without "atexit"
FIX love variant of demos for checking love integration
FIX include atexit
- failing part is enums_free_all
FIX cleaer naming
FIX cleanup
FIX no binaries
  • Loading branch information
kikonen committed Nov 22, 2023
1 parent 6f199e0 commit 90bdcac
Show file tree
Hide file tree
Showing 28 changed files with 690 additions and 55 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,10 @@ core.*
local/
src/TODO
src/DIFF

/x64
vcpkg_installed
.vs
.emacs*

!/generated_lib/**/*
2 changes: 2 additions & 0 deletions cpp.hint
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define MOONODE_API __declspec(dllexport)
#define MOONODE_API __declspec(dllimport)
19 changes: 19 additions & 0 deletions dllmain.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// dllmain.cpp : Defines the entry point for the DLL application.
#include "pch.h"

BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}

14 changes: 14 additions & 0 deletions examples/conf.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
local WINDOW_WIDTH = 1280
local WINDOW_HEIGHT = 720

function love.conf(t)
t.console = true

t.window.title = 'Love Moon demos'
t.window.width = WINDOW_WIDTH
t.window.height = WINDOW_HEIGHT

t.window.fullscreen = false
t.window.resizable = true
t.window.vsync = 1
end
Empty file added examples/love_demo.lua
Empty file.
8 changes: 8 additions & 0 deletions examples/main.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

table.pack = pack
table.unpack = unpack

function love.load()
require 'love_demo'
os.exit()
end
5 changes: 5 additions & 0 deletions framework.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#pragma once

#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files
#include <windows.h>
Empty file added lib/.gitkeep
Empty file.
31 changes: 31 additions & 0 deletions moonode.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.7.34221.43
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "moonode", "moonode.vcxproj", "{F8648969-55F6-4CC1-88F7-D13932994A62}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F8648969-55F6-4CC1-88F7-D13932994A62}.Debug|x64.ActiveCfg = Debug|x64
{F8648969-55F6-4CC1-88F7-D13932994A62}.Debug|x64.Build.0 = Debug|x64
{F8648969-55F6-4CC1-88F7-D13932994A62}.Debug|x86.ActiveCfg = Debug|Win32
{F8648969-55F6-4CC1-88F7-D13932994A62}.Debug|x86.Build.0 = Debug|Win32
{F8648969-55F6-4CC1-88F7-D13932994A62}.Release|x64.ActiveCfg = Release|x64
{F8648969-55F6-4CC1-88F7-D13932994A62}.Release|x64.Build.0 = Release|x64
{F8648969-55F6-4CC1-88F7-D13932994A62}.Release|x86.ActiveCfg = Release|Win32
{F8648969-55F6-4CC1-88F7-D13932994A62}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A2BF1EA1-973E-44E6-BB31-BF70EA440E35}
EndGlobalSection
EndGlobal
243 changes: 243 additions & 0 deletions moonode.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{f8648969-55f6-4cc1-88f7-d13932994a62}</ProjectGuid>
<RootNamespace>moonode</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TargetName>moonode</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<TargetName>moonode</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<TargetName>moonode</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TargetName>moonode</TargetName>
</PropertyGroup>
<PropertyGroup Label="Vcpkg">
<VcpkgEnableManifest>true</VcpkgEnableManifest>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;MOONODE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;MOONODE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>LUAVER=5.1;COMPAT53_PREFIX=moonode_compat_;_DEBUG;MOONODE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<AdditionalIncludeDirectories>$(ProjectDir)\vcpkg_installed\x64-windows\x64-windows\include\luajit;$(ProjectDir)\vendor;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<AdditionalLibraryDirectories>$(ProjectDir)\vendor\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>LUAVER=5.1;COMPAT53_PREFIX=moonode_compat_;NDEBUG;MOONODE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<AdditionalIncludeDirectories>$(ProjectDir)\vcpkg_installed\x64-windows\x64-windows\include\luajit;$(ProjectDir)\vendor;$(ProjectDir)\vendor;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<AdditionalLibraryDirectories>$(ProjectDir)\vendor\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<None Include="cpp.hint" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h" />
<ClInclude Include="moonode_dll.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="src\compat-5.3.h" />
<ClInclude Include="src\enums.h" />
<ClInclude Include="src\internal.h" />
<ClInclude Include="src\joint.h" />
<ClInclude Include="src\moonode.h" />
<ClInclude Include="src\objects.h" />
<ClInclude Include="src\tree.h" />
<ClInclude Include="src\udata.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="moonode_dll.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="src\body.c" />
<ClCompile Include="src\collide.c" />
<ClCompile Include="src\compat-5.3.c" />
<ClCompile Include="src\datahandling.c" />
<ClCompile Include="src\datastructs.c" />
<ClCompile Include="src\enums.c" />
<ClCompile Include="src\flags.c" />
<ClCompile Include="src\geom.c" />
<ClCompile Include="src\geom_box.c" />
<ClCompile Include="src\geom_capsule.c" />
<ClCompile Include="src\geom_convex.c" />
<ClCompile Include="src\geom_cylinder.c" />
<ClCompile Include="src\geom_heightfield.c" />
<ClCompile Include="src\geom_plane.c" />
<ClCompile Include="src\geom_ray.c" />
<ClCompile Include="src\geom_sphere.c" />
<ClCompile Include="src\geom_trimesh.c" />
<ClCompile Include="src\hfdata.c" />
<ClCompile Include="src\joint.c" />
<ClCompile Include="src\joint_amotor.c" />
<ClCompile Include="src\joint_ball.c" />
<ClCompile Include="src\joint_contact.c" />
<ClCompile Include="src\joint_dball.c" />
<ClCompile Include="src\joint_dhinge.c" />
<ClCompile Include="src\joint_fixed.c" />
<ClCompile Include="src\joint_hinge.c" />
<ClCompile Include="src\joint_hinge2.c" />
<ClCompile Include="src\joint_lmotor.c" />
<ClCompile Include="src\joint_null.c" />
<ClCompile Include="src\joint_piston.c" />
<ClCompile Include="src\joint_plane2d.c" />
<ClCompile Include="src\joint_pr.c" />
<ClCompile Include="src\joint_pu.c" />
<ClCompile Include="src\joint_slider.c" />
<ClCompile Include="src\joint_transmission.c" />
<ClCompile Include="src\joint_universal.c" />
<ClCompile Include="src\main.c" />
<ClCompile Include="src\mass.c" />
<ClCompile Include="src\misc.c" />
<ClCompile Include="src\objects.c" />
<ClCompile Include="src\space.c" />
<ClCompile Include="src\space_hash.c" />
<ClCompile Include="src\space_quadtree.c" />
<ClCompile Include="src\space_sap.c" />
<ClCompile Include="src\space_simple.c" />
<ClCompile Include="src\tmdata.c" />
<ClCompile Include="src\tracing.c" />
<ClCompile Include="src\udata.c" />
<ClCompile Include="src\utils.c" />
<ClCompile Include="src\world.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
Loading

0 comments on commit 90bdcac

Please sign in to comment.