Skip to content

Commit

Permalink
Fix Windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
ashtonmeuser committed Apr 5, 2023
1 parent f8a84cf commit d0ff431
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ elif env['platform'] == 'linux':
elif env['platform'] == 'windows':
env['LIBPREFIX'] = ''
env['LIBSUFFIX'] = '.lib'
env['LIBWASMERSUFFIX'] = '.dll.lib' # Requires special suffix
env.Append(ENV=os.environ) # Keep session env variables to support VS 2017 prompt
env.Append(CPPDEFINES=['WIN32', '_WIN32', '_WINDOWS', '_CRT_SECURE_NO_WARNINGS'])
env.Append(CCFLAGS=['-W3', '-GR'])
Expand All @@ -90,7 +91,7 @@ elif env['platform'] == 'windows':

# Explicit static libraries
cpp_library = File('godot-cpp/bin/libgodot-cpp.{}.{}.64{}'.format(env['platform'], env['target'], env['LIBSUFFIX']))
wasmer_library = File('wasmer/lib/{}wasmer{}'.format(env['LIBPREFIX'], env['LIBSUFFIX']))
wasmer_library = File('wasmer/lib/{}wasmer{}'.format(env['LIBPREFIX'], env.get('LIBWASMERSUFFIX', env['LIBSUFFIX'])))

# CPP includes and libraries
env.Append(CPPPATH=['.', 'godot-cpp/godot-headers', 'godot-cpp/include', 'wasmer/include', 'godot-cpp/include/core', 'godot-cpp/include/gen'])
Expand Down
7 changes: 6 additions & 1 deletion godot-wasm.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
#include "godot-wasm.h"

namespace {
#ifdef __GNUC__
#define UNLIKELY(cond) __builtin_expect(!!(cond), 0)
#else
#define UNLIKELY(cond) cond
#endif
#define PRINT_ERROR(message) godot::Godot::print_error("Godot Wasm: " + godot::String(message), __func__, __FILE__, __LINE__);
#define FAIL(message, ret) do { PRINT_ERROR(message); return ret; } while (0)
#define FAIL_IF(cond, message, ret) do { if (__builtin_expect(!!(cond), 0)) FAIL(message, ret); } while (0)
#define FAIL_IF(cond, message, ret) do { if (UNLIKELY(cond)) FAIL(message, ret); } while (0)
#define NULL_VARIANT godot::Variant()

godot::Variant extract_variant(wasm_val_t value) {
Expand Down

0 comments on commit d0ff431

Please sign in to comment.