fix windows build

This commit is contained in:
Alexander Klingenbeck (SHS DI SY R&D DEV4) 2023-05-01 23:02:43 +02:00
parent 92276f1ca6
commit a314edaef0
4 changed files with 17 additions and 6 deletions

1
.gitignore vendored
View File

@ -2,5 +2,6 @@ build/
runtime/ runtime/
shaderc shaderc
hello-bgfx hello-bgfx
hello-bgfx.exe
include/generated/ include/generated/
.DS_Store .DS_Store

View File

@ -17,6 +17,9 @@ set(BX_CONFIG_DEBUG OFF CACHE INTERNAL "" FORCE)
# else() # else()
# set(BGFX_BUILD_TOOLS OFF CACHE INTERNAL "" FORCE) # set(BGFX_BUILD_TOOLS OFF CACHE INTERNAL "" FORCE)
# endif() # endif()
# needed by windows
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/bgfx.cmake) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/bgfx.cmake)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/SDL) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/SDL)

View File

@ -1,17 +1,22 @@
#ifndef COMMON_H #ifndef COMMON_H
#define COMMON_H #define COMMON_H
#ifdef __cplusplus
extern "C"
{
#endif
#include <assert.h> #include <assert.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#define SDL_MAIN_HANDLED
#include <SDL.h> #include <SDL.h>
typedef struct { typedef struct {
uint width; uint32_t width;
uint height; uint32_t height;
} App_Config; } App_Config;
typedef struct { typedef struct {
@ -37,4 +42,7 @@ int app_dispose_bgfx();
// utiles // utiles
char* app_read_file(const char* filename, size_t* out_size); char* app_read_file(const char* filename, size_t* out_size);
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -1,7 +1,7 @@
#include <bgfx/c99/bgfx.h> #include <bgfx/c99/bgfx.h>
#include "common.h" #include "common.h"
#include "shaders.h" //#include "shaders.h"
App_Config app_config = { 640, 480 }; App_Config app_config = { 640, 480 };
App_State app_state = { NULL, 0 }; App_State app_state = { NULL, 0 };
@ -23,5 +23,4 @@ int main(int argc, char *argv[]) {
app_dispose_sdl(); app_dispose_sdl();
app_dispose_quickjs(); app_dispose_quickjs();
return 0; return 0;
} }