Skip to content

Commit

Permalink
Fix builds for Mac OS X and CMake.
Browse files Browse the repository at this point in the history
Fix builds for Mac OS X hosts using a method that JayKickliter and I derived
while researching this current problem with CMake. In the future, CMake will
probably come up with some reasonable defaults that update CFLAGS properly
on Mac OS X so that it gets the proper `-isysroot <PATH>` that is sorely
needed when invoking `clang` as directly as CMake is doing.
  • Loading branch information
ke6jjj committed Feb 23, 2021
1 parent 6a24194 commit 4924b08
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
11 changes: 10 additions & 1 deletion c_src/cmake/FindGFComplete.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ if(CMAKE_BUILD_TYPE)
string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE_UC)
endif()

if (APPLE)

This comment has been minimized.

Copy link
@JayKickliter

JayKickliter Feb 23, 2021

Contributor

would mind moving the contents of this IF and the one in FindJErasure.cmake to here? Then set a single variable named something like APPLE_SDKROOT_ENV?

execute_process(COMMAND
xcrun --show-sdk-path
OUTPUT_VARIABLE APPLE_SDK_ROOT
)
set(GF_APPLE_ENV "SDKROOT=${APPLE_SDK_ROOT}")
endif()

ExternalProject_Add(gf-complete
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/gf-complete
GIT_REPOSITORY https://github.com/ceph/gf-complete.git
Expand All @@ -19,7 +27,8 @@ ExternalProject_Add(gf-complete
$ENV{CONFIGURE_ARGS}
CC=${CMAKE_C_COMPILER}
CFLAGS=${CMAKE_C_FLAGS_${BUILD_TYPE_UC}}
BUILD_COMMAND ${CMAKE_BUILD_TOOL} -j
${GF_APPLE_ENV}
BUILD_COMMAND ${CMAKE_BUILD_TOOL} -j ${GF_APPLE_ENV}
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/lib/libgf_complete.a
INSTALL_COMMAND ${CMAKE_BUILD_TOOL} install
)
Expand Down
11 changes: 10 additions & 1 deletion c_src/cmake/FindJerasure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ if(CMAKE_BUILD_TYPE)
string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE_UC)
endif()

if (APPLE)
execute_process(COMMAND
xcrun --show-sdk-path
OUTPUT_VARIABLE APPLE_SDK_ROOT
)
set(GF_APPLE_ENV "SDKROOT=${APPLE_SDK_ROOT}")
endif()

ExternalProject_Add(jerasure
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/jerasure
GIT_REPOSITORY http://github.com/ceph/jerasure.git
Expand All @@ -23,7 +31,8 @@ ExternalProject_Add(jerasure
CC=${CMAKE_C_COMPILER}
"CFLAGS=-I${CMAKE_CURRENT_BINARY_DIR}/include ${CMAKE_C_FLAGS_${BUILD_TYPE_UC}}"
LDFLAGS=-L${CMAKE_CURRENT_BINARY_DIR}/lib
BUILD_COMMAND ${CMAKE_BUILD_TOOL} -j
${GF_APPLE_ENV}
BUILD_COMMAND ${CMAKE_BUILD_TOOL} -j ${GF_APPLE_ENV}
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/lib/libJerasure.a
INSTALL_COMMAND ${CMAKE_BUILD_TOOL} install
)
Expand Down

0 comments on commit 4924b08

Please sign in to comment.