Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix undefined memory allocation functions on Mac OSX #362

Merged
merged 1 commit into from
Jun 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()