Skip to content

Commit

Permalink
[cmake] Use OSX_ARCHITECTURES target property to set architecture for…
Browse files Browse the repository at this point in the history
… bitcode file on macOS.
  • Loading branch information
neboat committed Nov 4, 2024
1 parent 729509f commit 8b950f2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmake/Modules/AddCheetah.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,8 @@ function(add_cheetah_bitcode name)
set(output_name_${libname} ${libname}${CHEETAH_OS_SUFFIX})
set(sources_${libname} ${LIB_SOURCES})
list(APPEND libnames ${libname})
set(extra_cflags_${libname} ${DARWIN_${os}_CFLAGS} "-arch" ${arch} ${LIB_CFLAGS})
set(extra_cflags_${libname} ${DARWIN_${os}_CFLAGS} ${LIB_CFLAGS})
set(${libname}_arch ${arch})
get_cheetah_output_dir(${CHEETAH_DEFAULT_TARGET_ARCH} output_dir_${libname})
get_cheetah_install_dir(${CHEETAH_DEFAULT_TARGET_ARCH} install_dir_${libname})
endforeach()
Expand Down Expand Up @@ -509,6 +510,10 @@ function(add_cheetah_bitcode name)
target_compile_options(${libname}_compile PUBLIC "$<$<CONFIG:RELEASE>:${CHEETAH_RELEASE_OPTIONS}>")
set_property(TARGET ${libname}_compile APPEND PROPERTY
COMPILE_DEFINITIONS ${LIB_DEFS})
if (APPLE)
set_target_properties(${libname}_compile PROPERTIES
OSX_ARCHITECTURES "${${libname}_arch}")
endif()
set(output_file_${libname} lib${output_name_${libname}}.bc)
add_custom_command(
OUTPUT ${output_dir_${libname}}/${output_file_${libname}}
Expand Down

0 comments on commit 8b950f2

Please sign in to comment.