Skip to content

Commit

Permalink
Persist STRICT_APPLE_COMPATIBILITY in config.h
Browse files Browse the repository at this point in the history
On Windows, the value of `STRICT_APPLE_COMPATIBILITY` determines whether `BOOL` is a char or an int.  This value must be consistent across all libraries that use libobjc2.  Rather than requiring all libraries to explicitly define `STRICT_APPLE_COMPATIBILITY`, persist the value of `STRICT_APPLE_COMPATIBILITY` in `objc-config.h` and include that in `runtime.h`.
  • Loading branch information
qmfrederik committed Nov 18, 2024
1 parent 47d02a8 commit 2c674d8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ set(libobjc_HDRS
objc/objc.h
objc/runtime-deprecated.h
objc/runtime.h
objc/slot.h)
objc/slot.h
${PROJECT_BINARY_DIR}/objc/objc-config.h)

set(libobjc_CXX_SRCS
selector_table.cc
Expand Down Expand Up @@ -150,6 +151,9 @@ add_compile_definitions($<$<BOOL:${ENABLE_TRACING}>:WITH_TRACING=1>)
add_compile_definitions($<$<BOOL:${DEBUG_ARC_COMPAT}>:DEBUG_ARC_COMPAT>)
add_compile_definitions($<$<BOOL:${STRICT_APPLE_COMPATIBILITY}>:STRICT_APPLE_COMPATIBILITY>)

configure_file(objc/objc-config.h.in objc/objc-config.h @ONLY)
include_directories("${PROJECT_BINARY_DIR}/objc/")

if (OLDABI_COMPAT)
list(APPEND libobjc_C_SRCS legacy.c abi_version.c statics_loader.c)
add_definitions(-DOLDABI_COMPAT=1)
Expand Down
1 change: 1 addition & 0 deletions objc/objc-config.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#cmakedefine STRICT_APPLE_COMPATIBILITY @STRICT_APPLE_COMPATIBILITY@
1 change: 1 addition & 0 deletions objc/runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#pragma clang system_header
#endif
#include "objc-visibility.h"
#include "objc-config.h"

#ifndef __LIBOBJC_RUNTIME_H_INCLUDED__
#define __LIBOBJC_RUNTIME_H_INCLUDED__
Expand Down

0 comments on commit 2c674d8

Please sign in to comment.