From b59bb18ce26b8c3d9f7a1dec72f9e019daee4199 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Thu, 16 Feb 2023 22:05:48 +0000 Subject: [PATCH] Engine now builds under MSVC --- .gitignore | 14 ++--- Airport.sln | 58 +++++++++++++++++ Airport.vcxproj | 140 +++++++++++++++++++++++++++++++++++++++++ Box.vcxproj | 158 +++++++++++++++++++++++++++++++++++++++++++++++ Toy | 2 +- box/box_common.h | 11 +++- box/lib_engine.c | 2 + box/lib_runner.h | 7 ++- 8 files changed, 378 insertions(+), 14 deletions(-) create mode 100644 Airport.sln create mode 100644 Airport.vcxproj create mode 100644 Box.vcxproj diff --git a/.gitignore b/.gitignore index e2a2717..dccf75b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,32 +1,32 @@ #Editor generated files -*.sln -*.vcproj *.suo *.ncb *.user +compile_commands.json #Directories Release/ Debug/ Out/ -Lib/ release/ debug/ out/ -lib/ +bin/ +.cache/ +.vs/ #Project generated files *.db *.o *.a *.exe -*.dll *.meta *.log -out +*.out *.stackdump *.tb +*.filters #Shell files *.bat -*.sh \ No newline at end of file +*.sh diff --git a/Airport.sln b/Airport.sln new file mode 100644 index 0000000..c1eb04c --- /dev/null +++ b/Airport.sln @@ -0,0 +1,58 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33213.308 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Box", "Box.vcxproj", "{348A36D9-181E-46AD-BEEB-8A3FFAA50E79}" + ProjectSection(ProjectDependencies) = postProject + {26360002-CC2A-469A-9B28-BA0C1AF41657} = {26360002-CC2A-469A-9B28-BA0C1AF41657} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Toy", "Toy\Toy.vcxproj", "{26360002-CC2A-469A-9B28-BA0C1AF41657}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Airport", "Airport.vcxproj", "{97F823E5-3AB8-47EF-B142-C15DD7CADF76}" + ProjectSection(ProjectDependencies) = postProject + {26360002-CC2A-469A-9B28-BA0C1AF41657} = {26360002-CC2A-469A-9B28-BA0C1AF41657} + {348A36D9-181E-46AD-BEEB-8A3FFAA50E79} = {348A36D9-181E-46AD-BEEB-8A3FFAA50E79} + EndProjectSection +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 + {348A36D9-181E-46AD-BEEB-8A3FFAA50E79}.Debug|x64.ActiveCfg = Debug|x64 + {348A36D9-181E-46AD-BEEB-8A3FFAA50E79}.Debug|x64.Build.0 = Debug|x64 + {348A36D9-181E-46AD-BEEB-8A3FFAA50E79}.Debug|x86.ActiveCfg = Debug|Win32 + {348A36D9-181E-46AD-BEEB-8A3FFAA50E79}.Debug|x86.Build.0 = Debug|Win32 + {348A36D9-181E-46AD-BEEB-8A3FFAA50E79}.Release|x64.ActiveCfg = Release|x64 + {348A36D9-181E-46AD-BEEB-8A3FFAA50E79}.Release|x64.Build.0 = Release|x64 + {348A36D9-181E-46AD-BEEB-8A3FFAA50E79}.Release|x86.ActiveCfg = Release|Win32 + {348A36D9-181E-46AD-BEEB-8A3FFAA50E79}.Release|x86.Build.0 = Release|Win32 + {26360002-CC2A-469A-9B28-BA0C1AF41657}.Debug|x64.ActiveCfg = Debug|x64 + {26360002-CC2A-469A-9B28-BA0C1AF41657}.Debug|x64.Build.0 = Debug|x64 + {26360002-CC2A-469A-9B28-BA0C1AF41657}.Debug|x86.ActiveCfg = Debug|Win32 + {26360002-CC2A-469A-9B28-BA0C1AF41657}.Debug|x86.Build.0 = Debug|Win32 + {26360002-CC2A-469A-9B28-BA0C1AF41657}.Release|x64.ActiveCfg = Release|x64 + {26360002-CC2A-469A-9B28-BA0C1AF41657}.Release|x64.Build.0 = Release|x64 + {26360002-CC2A-469A-9B28-BA0C1AF41657}.Release|x86.ActiveCfg = Release|Win32 + {26360002-CC2A-469A-9B28-BA0C1AF41657}.Release|x86.Build.0 = Release|Win32 + {97F823E5-3AB8-47EF-B142-C15DD7CADF76}.Debug|x64.ActiveCfg = Debug|x64 + {97F823E5-3AB8-47EF-B142-C15DD7CADF76}.Debug|x64.Build.0 = Debug|x64 + {97F823E5-3AB8-47EF-B142-C15DD7CADF76}.Debug|x86.ActiveCfg = Debug|Win32 + {97F823E5-3AB8-47EF-B142-C15DD7CADF76}.Debug|x86.Build.0 = Debug|Win32 + {97F823E5-3AB8-47EF-B142-C15DD7CADF76}.Release|x64.ActiveCfg = Release|x64 + {97F823E5-3AB8-47EF-B142-C15DD7CADF76}.Release|x64.Build.0 = Release|x64 + {97F823E5-3AB8-47EF-B142-C15DD7CADF76}.Release|x86.ActiveCfg = Release|Win32 + {97F823E5-3AB8-47EF-B142-C15DD7CADF76}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {11A7E1C9-DA78-4754-9B70-3B328B0B5471} + EndGlobalSection +EndGlobal diff --git a/Airport.vcxproj b/Airport.vcxproj new file mode 100644 index 0000000..f0e97e6 --- /dev/null +++ b/Airport.vcxproj @@ -0,0 +1,140 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + + + 17.0 + {97F823E5-3AB8-47EF-B142-C15DD7CADF76} + Win32Proj + 10.0 + + + + Application + true + v143 + + + Application + false + v143 + + + Application + true + v143 + + + Application + false + v143 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + $(SolutionDir)out\$(Configuration)\ + $(Platform)\$(ProjectName)\$(Configuration)\ + + + $(SolutionDir)out\$(Configuration)\ + $(Platform)\$(ProjectName)\$(Configuration)\ + + + + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Console + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Console + true + true + + + + + SDL2main.lib;SDL2.lib;SDL2_image.lib;Toy.lib;Box.lib;%(AdditionalDependencies) + C:\Users\kayne\Documents\SDL2_image-2.6.2\lib\x64;C:\Users\kayne\Documents\SDL2-2.26.2\lib\x64;$(SolutionDir)out\$(Configuration);%(AdditionalLibraryDirectories) + + + C:\Users\kayne\Documents\SDL2-2.26.2\include;C:\Users\kayne\Documents\SDL2_image-2.6.2\include;%(SolutionDir)Toy\source;%(SolutionDir)box;%(AdditionalIncludeDirectories) + stdc17 + + + + + + + stdc17 + + + C:\Users\kayne\Documents\SDL2-2.26.2\include;C:\Users\kayne\Documents\SDL2_image-2.6.2\include;%(SolutionDir)Toy\source;%(SolutionDir)box;%(AdditionalIncludeDirectories) + + + C:\Users\kayne\Documents\SDL2_image-2.6.2\lib\x64;C:\Users\kayne\Documents\SDL2-2.26.2\lib\x64;$(SolutionDir)out\$(Configuration);%(AdditionalLibraryDirectories) + SDL2main.lib;SDL2.lib;SDL2_image.lib;Toy.lib;Box.lib;%(AdditionalDependencies) + + + + + + \ No newline at end of file diff --git a/Box.vcxproj b/Box.vcxproj new file mode 100644 index 0000000..3a73267 --- /dev/null +++ b/Box.vcxproj @@ -0,0 +1,158 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + {348A36D9-181E-46AD-BEEB-8A3FFAA50E79} + Win32Proj + 10.0 + + + + DynamicLibrary + true + v143 + + + DynamicLibrary + false + v143 + + + DynamicLibrary + true + v143 + + + DynamicLibrary + false + v143 + + + + + + + + + + + + + + + + + + + + + true + + + true + + + $(SolutionDir)out\$(Configuration)\ + $(Platform)\$(ProjectName)\$(Configuration)\ + + + $(SolutionDir)out\$(Configuration)\ + $(Platform)\$(ProjectName)\$(Configuration)\ + + + + WIN32;_DEBUG;_WINDOWS;_USRDLL;BOX_EXPORTS;BOX_EXPORT;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + + + MachineX86 + true + Windows + + + + + WIN32;NDEBUG;_WINDOWS;_USRDLL;BOX_EXPORTS;BOX_EXPORT;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + ProgramDatabase + + + MachineX86 + true + Windows + true + true + + + + + stdc17 + BOX_EXPORT;%(PreprocessorDefinitions) + C:\Users\kayne\Documents\SDL2-2.26.2\include;C:\Users\kayne\Documents\SDL2_image-2.6.2\include;%(SolutionDir)Toy\source;%(AdditionalIncludeDirectories) + + + C:\Users\kayne\Documents\SDL2_image-2.6.2\lib\x64;C:\Users\kayne\Documents\SDL2-2.26.2\lib\x64;$(SolutionDir)out\$(Configuration)\;%(AdditionalLibraryDirectories) + SDL2.lib;SDL2_image.lib;Toy.lib;%(AdditionalDependencies) + + + + + stdc17 + BOX_EXPORT;%(PreprocessorDefinitions) + C:\Users\kayne\Documents\SDL2-2.26.2\include;C:\Users\kayne\Documents\SDL2_image-2.6.2\include;%(SolutionDir)Toy\source;%(AdditionalIncludeDirectories) + + + C:\Users\kayne\Documents\SDL2_image-2.6.2\lib\x64;C:\Users\kayne\Documents\SDL2-2.26.2\lib\x64;$(SolutionDir)out\$(Configuration)\;%(AdditionalLibraryDirectories) + SDL2.lib;SDL2_image.lib;Toy.lib;%(AdditionalDependencies) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Toy b/Toy index 1668dca..2adb9d9 160000 --- a/Toy +++ b/Toy @@ -1 +1 @@ -Subproject commit 1668dca2550aa3a9c6553a250c8604fcc260eb9e +Subproject commit 2adb9d915858409f3ca7206666dc135527c49d1b diff --git a/box/box_common.h b/box/box_common.h index 2361a94..5926dae 100644 --- a/box/box_common.h +++ b/box/box_common.h @@ -1,8 +1,5 @@ #pragma once -#include -#include - #include #include #include @@ -15,11 +12,17 @@ //platform/compiler-specific instructions #if defined(__linux__) || defined(__MINGW32__) || defined(__GNUC__) +#include +#include + #include #define BOX_API extern #elif defined(_MSC_VER) +#include +#include + #include #ifndef BOX_EXPORT #define BOX_API __declspec(dllimport) @@ -27,6 +30,8 @@ #define BOX_API __declspec(dllexport) #endif +#define sleep Sleep + #else #define BOX_API extern diff --git a/box/lib_engine.c b/box/lib_engine.c index cf9bcf3..c98d116 100644 --- a/box/lib_engine.c +++ b/box/lib_engine.c @@ -10,6 +10,8 @@ #include "lib_runner.h" +#include + //errors here should be fatal static void fatalError(char* message) { fprintf(stderr, TOY_CC_ERROR "%s" TOY_CC_RESET, message); diff --git a/box/lib_runner.h b/box/lib_runner.h index 661ec39..bd26ac9 100644 --- a/box/lib_runner.h +++ b/box/lib_runner.h @@ -1,13 +1,14 @@ #pragma once +#include "toy_common.h" #include "toy_interpreter.h" int Toy_hookRunner(Toy_Interpreter* interpreter, Toy_Literal identifier, Toy_Literal alias); //file system API - these need to be set by the host -void Toy_initDriveDictionary(); -void Toy_freeDriveDictionary(); -Toy_LiteralDictionary* Toy_getDriveDictionary(); +TOY_API void Toy_initDriveDictionary(); +TOY_API void Toy_freeDriveDictionary(); +TOY_API Toy_LiteralDictionary* Toy_getDriveDictionary(); #define TOY_OPAQUE_TAG_RUNNER 100