From a43416372df4c5d71c5900e876aef4db9b67d29f Mon Sep 17 00:00:00 2001 From: MarianaGarcez Date: Thu, 25 Jan 2024 16:30:13 +0100 Subject: [PATCH] added the MacOS paths (#430) * feat: added the MacOS paths in the cmake files of MobilityDB and MEOS. * fix: Added const in function spanset_compact in meos_internal.h to match --------- Co-authored-by: Mariana Duarte --- meos/CMakeLists.txt | 47 ++++++++++++++++++++++++------------ meos/include/meos_internal.h | 2 +- mobilitydb/CMakeLists.txt | 9 ++++++- 3 files changed, 41 insertions(+), 17 deletions(-) diff --git a/meos/CMakeLists.txt b/meos/CMakeLists.txt index 9bd6085c81..1729b39a0f 100644 --- a/meos/CMakeLists.txt +++ b/meos/CMakeLists.txt @@ -158,21 +158,38 @@ target_link_libraries(${MEOS_LIB_NAME} ${GSL_CBLAS_LIBRARY}) # Belongs to MEOS #-------------------------------- -install( - FILES "${CMAKE_BINARY_DIR}/meos_export.h" - DESTINATION "/usr/local/include" - RENAME "meos.h") -install( - FILES "${CMAKE_BINARY_DIR}/meos_internal_export.h" - DESTINATION "/usr/local/include" - RENAME "meos_internal.h") -install( - FILES "${CMAKE_SOURCE_DIR}/meos/include/general/meos_catalog.h" - DESTINATION "/usr/local/include") -install(TARGETS ${MEOS_LIB_NAME} DESTINATION "/usr/local/lib") -message(STATUS "Building MEOS:") -message(STATUS " Library file: '/usr/local/lib'") -message(STATUS " Include file: '/usr/local/include'") +if(APPLE AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm") + install(FILES "${CMAKE_BINARY_DIR}/meos_export.h" + DESTINATION "/opt/homebrew/include" + RENAME "meos.h") + install( + FILES "${CMAKE_BINARY_DIR}/meos_internal_export.h" + DESTINATION "/opt/homebrew/include" + RENAME "meos_internal.h") + install( + FILES "${CMAKE_SOURCE_DIR}/meos/include/general/meos_catalog.h" + DESTINATION "/opt/homebrew/include") + install(TARGETS ${MEOS_LIB_NAME} DESTINATION "/opt/homebrew/lib") + message(STATUS "Building MEOS:") + message(STATUS " Library file: '/opt/homebrew/lib'") + message(STATUS " Include file: '/opt/homebrew/include'") +else() + install( + FILES "${CMAKE_BINARY_DIR}/meos_export.h" + DESTINATION "/usr/local/include" + RENAME "meos.h") + install( + FILES "${CMAKE_BINARY_DIR}/meos_internal_export.h" + DESTINATION "/usr/local/include" + RENAME "meos_internal.h") + install( + FILES "${CMAKE_SOURCE_DIR}/meos/include/general/meos_catalog.h" + DESTINATION "/usr/local/include") + install(TARGETS ${MEOS_LIB_NAME} DESTINATION "/usr/local/lib") + message(STATUS "Building MEOS:") + message(STATUS " Library file: '/usr/local/lib'") + message(STATUS " Include file: '/usr/local/include'") +endif() #----------------------------------------------------------------------------- # Documentation diff --git a/meos/include/meos_internal.h b/meos/include/meos_internal.h index dcfefbca5a..ddb124f0f4 100644 --- a/meos/include/meos_internal.h +++ b/meos/include/meos_internal.h @@ -346,7 +346,7 @@ extern Span *numspan_shift_scale(const Span *s, Datum shift, Datum width, bool h extern SpanSet *numspanset_shift_scale(const SpanSet *ss, Datum shift, Datum width, bool hasshift, bool haswidth); extern Set *set_compact(const Set *s); extern void span_expand(const Span *s1, Span *s2); -extern SpanSet *spanset_compact(SpanSet *ss); +extern SpanSet *spanset_compact(const SpanSet *ss); extern Set *textcat_textset_text_int(const Set *s, const text *txt, bool invert); extern void tstzspan_set_datespan(const Span *s1, Span *s2); diff --git a/mobilitydb/CMakeLists.txt b/mobilitydb/CMakeLists.txt index 8ad368f2e3..f26d3e6577 100644 --- a/mobilitydb/CMakeLists.txt +++ b/mobilitydb/CMakeLists.txt @@ -124,8 +124,15 @@ endif() # Build the library add_library(${MOBILITYDB_LIB_NAME} MODULE ${PROJECT_OBJECTS}) if(APPLE) - set_target_properties(${MOBILITYDB_LIB_NAME} PROPERTIES + If(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm") + message(STATUS "Building for arm architecture") + set_target_properties(${MOBILITYDB_LIB_NAME} PROPERTIES + LINK_FLAGS "-Wl,-undefined,dynamic_lookup -bundle_loader /opt/homebrew/bin/postgres") + else() + message(STATUS "Building for x86 architecture") + set_target_properties(${MOBILITYDB_LIB_NAME} PROPERTIES LINK_FLAGS "-Wl,-undefined,dynamic_lookup -bundle_loader /usr/local/bin/postgres") + endif() endif() #--------------------------------