Initial commit
Basic SDL3 window Build script for windows Added SDL3 submodule Added stb submodule
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
build/
|
||||||
6
.gitmodules
vendored
Normal file
6
.gitmodules
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[submodule "thirdparty/SDL3"]
|
||||||
|
path = thirdparty/SDL3
|
||||||
|
url = https://github.com/libsdl-org/SDL
|
||||||
|
[submodule "thirdparty/stb"]
|
||||||
|
path = thirdparty/stb
|
||||||
|
url = https://github.com/nothings/stb
|
||||||
29
code/first.c
Normal file
29
code/first.c
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
if (!SDL_Init(SDL_INIT_VIDEO)) {
|
||||||
|
printf("[Error] :: Failed to initialise SDL3 (%s)\n", SDL_GetError());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Window *window = SDL_CreateWindow("Ludum", 1280, 720, SDL_WINDOW_HIGH_PIXEL_DENSITY);
|
||||||
|
if (!window) {
|
||||||
|
printf("[Error] :: Failed to create window (%s)\n", SDL_GetError());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
SDL_Event e;
|
||||||
|
while (SDL_PollEvent(&e)) {
|
||||||
|
if (e.type == SDL_EVENT_QUIT) { running = false; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_DestroyWindow(window);
|
||||||
|
SDL_Quit();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
1
thirdparty/SDL3
vendored
Submodule
1
thirdparty/SDL3
vendored
Submodule
Submodule thirdparty/SDL3 added at a8589a8422
1
thirdparty/stb
vendored
Submodule
1
thirdparty/stb
vendored
Submodule
Submodule thirdparty/stb added at fede005aba
62
windows.bat
Normal file
62
windows.bat
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
@ECHO OFF
|
||||||
|
SETLOCAL
|
||||||
|
|
||||||
|
PUSHD "%~dp0" > NUL
|
||||||
|
|
||||||
|
IF NOT EXIST "build" ( MKDIR "build" )
|
||||||
|
|
||||||
|
PUSHD "build"
|
||||||
|
|
||||||
|
SET deps=0
|
||||||
|
SET release=0
|
||||||
|
|
||||||
|
FOR %%A in (%*) DO (
|
||||||
|
SET %%A=1
|
||||||
|
)
|
||||||
|
|
||||||
|
IF NOT EXIST "deps\SDL3" (
|
||||||
|
SET deps=1
|
||||||
|
)
|
||||||
|
|
||||||
|
IF %deps% equ 1 (
|
||||||
|
ECHO [Building dependencies]
|
||||||
|
|
||||||
|
RMDIR /Q /S "deps"
|
||||||
|
|
||||||
|
RMDIR /Q /S "..\thirdparty\SDL3\build" 2> NUL
|
||||||
|
MKDIR "..\thirdparty\SDL3\build"
|
||||||
|
|
||||||
|
PUSHD "..\thirdparty\SDL3\build"
|
||||||
|
|
||||||
|
cmake -DCMAKE_INSTALL_PREFIX="..\..\..\build\deps\SDL3" ..
|
||||||
|
|
||||||
|
IF %release% equ 1 (
|
||||||
|
msbuild -p:Configuration=Release -p:Platform=x64 SDL3.sln
|
||||||
|
msbuild -p:Configuration=Release -p:Platform=x64 INSTALL.vcxproj
|
||||||
|
) ELSE (
|
||||||
|
msbuild -p:Configuration=Debug -p:Platform=x64 SDL3.sln
|
||||||
|
msbuild -p:Configuration=Debug -p:Platform=x64 INSTALL.vcxproj
|
||||||
|
)
|
||||||
|
|
||||||
|
POPD
|
||||||
|
|
||||||
|
COPY "deps\SDL3\bin\SDL3.dll" "."
|
||||||
|
|
||||||
|
MKDIR "deps\stb"
|
||||||
|
COPY "..\thirdparty\stb\*.h" "deps\stb" > NUL
|
||||||
|
)
|
||||||
|
|
||||||
|
ECHO [Building source]
|
||||||
|
|
||||||
|
SET COMPILER_OPTS=-nologo -W4 -I"deps\SDL3\include" -I"deps\stb"
|
||||||
|
SET LINKER_OPTS=-LIBPATH:"deps\SDL3\lib" SDL3.lib
|
||||||
|
|
||||||
|
IF %release% equ 1 (
|
||||||
|
ECHO [Release build]
|
||||||
|
cl -O2 -WX %COMPILER_OPTS% "..\code\first.c" -link %LINKER_OPTS%
|
||||||
|
) ELSE (
|
||||||
|
ECHO [Debug build]
|
||||||
|
cl -Od -Zi %COMPILER_OPTS% "..\code\first.c" -link %LINKER_OPTS%
|
||||||
|
)
|
||||||
|
|
||||||
|
POPD
|
||||||
Reference in New Issue
Block a user