Got clang to build parity with msvc

This commit is contained in:
Edward R. Gonzalez 2023-10-24 00:42:55 -04:00
parent 4ab64e2c17
commit 2a660da1d8
8 changed files with 32 additions and 13 deletions

View File

@ -14,7 +14,7 @@
"label": "Static Data"
},
{
"line": 1001,
"line": 1011,
"column": 0,
"label": "Main Loop : End"
}

View File

@ -34,7 +34,9 @@
"UNICODE",
"_UNICODE",
"GEN_TIME",
"INTELLISENSE_DIRECTIVES"
"INTELLISENSE_DIRECTIVES",
"Build_Debug",
"Build_Development"
],
"windowsSdkVersion": "10.0.22621.0",
"compilerPath": "clang.exe",

View File

@ -1058,7 +1058,7 @@ void update_and_render( f32 delta_time, InputState* input, OffscreenBuffer* back
s32 tile_id = TileMap_get_tile_value( tile_map, col, row, game_state->camera_pos.tile_z );
f32 color[3] = { 0.15f, 0.15f, 0.15f };
if ( tile_id > 1 || row == player->position.tile_y && col == player->position.tile_x )
if ( tile_id > 1 || (row == player->position.tile_y && col == player->position.tile_x) )
// if ( tile_id > 1 )
{
if ( tile_id == 2 )

View File

@ -27,4 +27,5 @@
#pragma clang diagnostic ignored "-Wvarargs"
#pragma clang diagnostic ignored "-Wunused-function"
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
#pragma clang diagnostic ignored "-Wmissing-braces"
#endif

View File

@ -503,6 +503,9 @@ engine::ModuleAPI load_engine_module_api()
{
OutputDebugStringA( "Loaded engine module API\n" );
}
else {
fatal( "Failed to load engine module API!\n" );
}
return engine_api;
}
@ -865,6 +868,13 @@ WinMain( HINSTANCE instance, HINSTANCE prev_instance, LPSTR commandline, int sho
}
}
// Populate an initial polling state for the inputs
poll_input( window_handle, & input, jsl_num_devices, jsl_device_handles
, old_keyboard, new_keyboard
, old_mouse, new_mouse
, old_xpads, new_xpads
, old_ds_pads, new_ds_pads );
engine_api.startup( rcast(engine::OffscreenBuffer*, & Surface_Back_Buffer.memory), & engine_memory, & platform_api );
u64 last_frame_clock = timing_get_wall_clock();

View File

@ -2,6 +2,10 @@
#include "platform.hpp"
#include "jsl.hpp"
#include "win32.hpp"
NS_PLATFORM_BEGIN
using namespace win32;
NS_PLATFORM_END
#endif
NS_PLATFORM_BEGIN
@ -127,8 +131,10 @@ b32 file_read_content( File* file )
return {};
}
// This has to be done or for some reason file_handle will be consumed to null by `GetFileSizeEx` (Clang bug?)
HANDLE file_handle_clang_bug = file_handle;
u32 size;
GetFileSizeEx( file_handle, rcast(LARGE_INTEGER*, &size) );
GetFileSizeEx( file_handle_clang_bug, rcast(LARGE_INTEGER*, &size) );
if ( size == 0 )
{
// TODO(Ed) : Logging

View File

@ -250,10 +250,10 @@ function build-engine
$local:compiler_args = $script:compiler_args
$compiler_args += ($flag_define + 'Build_DLL=1' )
if ( $vendor -eq 'msvc' ) {
if ( $IsWindows ) {
$compiler_args += ($flag_define + 'Engine_API=__declspec(dllexport)')
}
if ( $vendor -eq 'clang' ) {
else {
$compiler_args += ($flag_define + 'Engine_API=__attribute__((visibility("default")))')
}