Skip to content

Commit

Permalink
Merge pull request uber#362 from uber/mac-fix-undefined-memory-alloca…
Browse files Browse the repository at this point in the history
…tors

Fix undefined memory allocation functions on Mac OSX
  • Loading branch information
isaacbrodsky authored Jun 29, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents d136b60 + c04b1e3 commit 397d303
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -6,6 +6,8 @@ The public API of this library consists of the functions declared in file
[h3api.h.in](./src/h3lib/include/h3api.h.in).

## [Unreleased]
### Fixed
- Fixed building the library with custom memory allocation functions on Mac OSX. (#356)

## [3.6.4] - 2020-06-19
### Added
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -218,11 +218,20 @@ function(add_h3_library name h3_alloc_prefix_override)
endif()

target_compile_definitions(${name} PUBLIC H3_PREFIX=${H3_PREFIX})
set(has_alloc_prefix NO)
if(h3_alloc_prefix_override)
set(has_alloc_prefix YES)
target_compile_definitions(${name} PUBLIC H3_ALLOC_PREFIX=${h3_alloc_prefix_override})
elseif(H3_ALLOC_PREFIX)
set(has_alloc_prefix YES)
target_compile_definitions(${name} PUBLIC H3_ALLOC_PREFIX=${H3_ALLOC_PREFIX})
endif()
# Mac OSX defaults to not looking up undefined symbols dynamically,
# so enable that explicitly.
if(has_alloc_prefix AND APPLE)
target_link_libraries(${name} PRIVATE "-undefined dynamic_lookup")
endif()

if(have_alloca)
target_compile_definitions(${name} PUBLIC H3_HAVE_ALLOCA)
endif()

0 comments on commit 397d303

Please sign in to comment.