Skip to content

Commit

Permalink
build: Xcode build improvements
Browse files Browse the repository at this point in the history
* Use RelWithDebInfo as the launch configuration in the default scheme

* Assume IPO is supported under Xcode, since checking takes over 10 seconds for some reason
  • Loading branch information
jcm93 committed Dec 22, 2024
1 parent 56f98d6 commit f512b77
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmake/common/compiler_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ include(CheckIPOSupported)
option(ENABLE_IPO "Enable interprocedural optimization (LTO)" YES)
message(STATUS "Checking if interprocedural optimization is supported")
if(ENABLE_IPO)
check_ipo_supported(RESULT ipo_supported OUTPUT output)
# Checking IPO support takes an inordinately long time under the Xcode generator; under Xcode, just assume that
# IPO is supported.
if(NOT XCODE)
check_ipo_supported(RESULT ipo_supported OUTPUT output)
else()
set(ipo_supported YES)
endif()
if(ipo_supported)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO TRUE)
Expand Down
3 changes: 3 additions & 0 deletions cmake/macos/xcode.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ set(CMAKE_XCODE_ATTRIBUTE_CLANG_MODULES_AUTOLINK NO)
# Enable strict msg_send rules for ObjC
set(CMAKE_XCODE_ATTRIBUTE_ENABLE_STRICT_OBJC_MSGSEND YES)

# Use RelWithDebInfo as the launch configuration in the default scheme
set(CMAKE_XCODE_SCHEME_LAUNCH_CONFIGURATION RelWithDebInfo)

# Set default warnings for all languages
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING YES)
set(CMAKE_XCODE_ATTRIBUTE_CLANG_WARN_BOOL_CONVERSION YES)
Expand Down

0 comments on commit f512b77

Please sign in to comment.