Skip to content

Commit 9b14a92

Browse files
committed
[SPEC] Work around build failure due to target OS macros changes.
llvm/llvm-project#74676 changes some predefined target OS macros on Apple platforms, which breaks building both Blender and Povray. Work around build failures by adding -fno-define-target-os-macros if available.
1 parent 44df7fa commit 9b14a92

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

External/SPEC/CFP2017rate/511.povray_r/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ speccpu2017_benchmark(RATE)
88

99
speccpu2017_add_include_dirs(frontend base . spec_qsort)
1010

11+
if(APPLE)
12+
# Building Povray breaks with -fdefine-target-os-macros, add flag to disable
13+
# it as workaround.
14+
include(CheckCCompilerFlag)
15+
check_c_compiler_flag(-fno-define-target-os-macros
16+
COMPILER_HAS_NO_DEFINE_TARGET_OS_MACROS)
17+
if (COMPILER_HAS_NO_DEFINE_TARGET_OS_MACROS)
18+
add_compile_options(-fno-define-target-os-macros)
19+
endif()
20+
endif()
21+
1122
## test ########################################################################
1223

1324
speccpu2017_run_test(

External/SPEC/CFP2017rate/526.blender_r/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ add_definitions(
1414
-DWITH_HEADLESS
1515
-DHAVE_UNSIGNED_CHAR
1616
)
17+
18+
if(APPLE)
19+
# Building Blender breaks with -fdefine-target-os-macros, add flag to disable
20+
# it as workaround.
21+
include(CheckCXXCompilerFlag)
22+
check_cxx_compiler_flag(-fno-define-target-os-macros
23+
COMPILER_HAS_NO_DEFINE_TARGET_OS_MACROS)
24+
if (COMPILER_HAS_NO_DEFINE_TARGET_OS_MACROS)
25+
add_compile_options(-fno-define-target-os-macros)
26+
endif()
27+
endif()
28+
1729
add_compile_options(-funsigned-char)
1830
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-D__BOOL_DEFINED>)
1931
speccpu2017_add_include_dirs(

0 commit comments

Comments
 (0)