Skip to content

Commit 35eda7a

Browse files
authored
fix build issues when building for Android on Windows (#153)
* Set `-Wno-macro-redefined` when building JSObjects because the code generated by flex/bison generates this warning * Gate backtrace implementation with `PLATFORM_ANDROID` because `ANDROID` is not defined when building for Windows
1 parent 78743d5 commit 35eda7a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Sources/Utils/Backtrace.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "DebugServer2/Utils/Backtrace.h"
1212
#include "DebugServer2/Utils/Log.h"
1313

14-
#if defined(ANDROID) || defined(OS_DARWIN) || defined(__GLIBC__)
14+
#if defined(PLATFORM_ANDROID) || defined(OS_DARWIN) || defined(__GLIBC__)
1515
#include <cxxabi.h>
1616
#include <dlfcn.h>
1717
#include <execinfo.h>
@@ -22,15 +22,15 @@
2222
#include <sstream>
2323
#endif
2424

25-
#if defined(ANDROID)
25+
#if defined(PLATFORM_ANDROID)
2626
// Android provides libunwind in the NDK instead of glibc backtrace
2727
#include <unwind.h>
2828
#endif
2929

3030
namespace ds2 {
3131
namespace Utils {
3232

33-
#if defined(ANDROID)
33+
#if defined(PLATFORM_ANDROID)
3434
struct unwind_state {
3535
void **buffer_cursor;
3636
void **buffer_end;
@@ -66,7 +66,7 @@ static int UnwindBacktrace(void *stack_buffer[], int stack_size) {
6666
}
6767
#endif
6868

69-
#if defined(ANDROID) || defined(OS_DARWIN) || (defined(__GLIBC__) && !defined(PLATFORM_TIZEN))
69+
#if defined(PLATFORM_ANDROID) || defined(OS_DARWIN) || (defined(__GLIBC__) && !defined(PLATFORM_TIZEN))
7070
static void PrintBacktraceEntrySimple(void *address) {
7171
DS2LOG(Error, "%" PRI_PTR, PRI_PTR_CAST(address));
7272
}

Tools/JSObjects/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ if((CMAKE_C_COMPILER_ID MATCHES "GNU" AND
6868
_POSIX_C_SOURCE=200809L)
6969
target_compile_options(jsobjects PRIVATE -Wall -Wextra -Werror)
7070
target_compile_options(jsobjects PRIVATE
71+
-Wno-macro-redefined
7172
-Wno-unused-parameter
7273
-Wno-unused-function
7374
-Wno-sign-compare)

0 commit comments

Comments
 (0)