Skip to content

Commit

Permalink
fix(tests): Fix regression with building SourceHook tests
Browse files Browse the repository at this point in the history
  • Loading branch information
psychonic committed Aug 3, 2024
1 parent 7e9d7cd commit 497c251
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
6 changes: 6 additions & 0 deletions core/sourcehook/sourcehook_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ New SH_CALL
#include "sourcehook_impl_chookidman.h"
#include <stdarg.h>

#ifndef SOURCEHOOK_STANDALONE
void mm_LogMessage(const char* msg, ...);
#endif

namespace SourceHook
{
Expand All @@ -206,7 +208,11 @@ namespace SourceHook
if (log_level < sh_log_level) {
return;
}
#ifdef SOURCEHOOK_STANDALONE
printf(message, args...);
#else
mm_LogMessage(message, args...);
#endif
}

struct CHookContext : IHookContext
Expand Down
11 changes: 9 additions & 2 deletions core/sourcehook/test/AMBuilder
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ for cxx in MMS.all_targets:
binary.compiler.cxxflags += ['-fno-devirtualize']
if binary.compiler.version >= 'clang-2.9' or binary.compiler.version >= 'apple-clang-3.0':
binary.compiler.cxxflags += ['-Wno-null-dereference']

binary.compiler.defines += [
'SOURCEHOOK_STANDALONE',
]

binary.sources += [
'main.cpp',
Expand All @@ -19,6 +23,7 @@ for cxx in MMS.all_targets:
'../sourcehook_impl_chookidman.cpp',
'../sourcehook_impl_cproto.cpp',
'../sourcehook_impl_cvfnptr.cpp',
'../sourcehook_hookmangen.cpp',
'test1.cpp',
'test2.cpp',
'test3.cpp',
Expand All @@ -36,7 +41,9 @@ for cxx in MMS.all_targets:
'testrefret.cpp',
'testvphooks.cpp',
]
if binary.compiler.target.arch == 'x86':
binary.sources += ['../sourcehook_hookmangen.cpp']
if cxx.target.arch == 'x86':
binary.sources += ['sourcehook/sourcehook_hookmangen_x86.cpp']
elif binary.compiler.target.arch == 'x86_64' and binary.compiler.target.platform != 'linux':
binary.sources += ['sourcehook/sourcehook_hookmangen_x86_64.cpp']

builder.Add(binary)

0 comments on commit 497c251

Please sign in to comment.