Skip to content

Commit

Permalink
Fix OpenBSD compilation issues (Chia-Network#115)
Browse files Browse the repository at this point in the history
* Include stdlib.h for alloca()

* Prepend relic contrib include paths, rather than append

     * Avoids conflict with "relic.h" implemented by
       "Relic - the NDBM-compatible API of QDBM", which is used by
       mutt
  • Loading branch information
n1000 authored Jun 10, 2020
1 parent 523738e commit 5a7c703
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion contrib/relic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT
set(VERSION ${PROJECT_VERSION})

set(INCLUDE ${CMAKE_CURRENT_BINARY_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/include/low ${CMAKE_CURRENT_SOURCE_DIR}/src/tmpl)
include_directories(${INCLUDE})
include_directories(BEFORE ${INCLUDE})

set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
Expand Down
4 changes: 4 additions & 0 deletions contrib/relic/include/relic_alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@

#else /* _MSC_VER */

#if defined(__OpenBSD__)
#include <stdlib.h>
#else
#include <alloca.h>
#endif

/*
* Dynamiclly allocates an array of "Type" with the specified size on the stack.
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ file(GLOB HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp)
source_group("SrcHeaders" FILES ${HEADERS})

include_directories(
${INCLUDE_DIRECTORIES}
BEFORE
${CMAKE_CURRENT_SOURCE_DIR}/../contrib/relic/include
${CMAKE_BINARY_DIR}/contrib/relic/include
${CMAKE_CURRENT_SOURCE_DIR}/../contrib/catch
Expand Down

0 comments on commit 5a7c703

Please sign in to comment.