Skip to content

Commit

Permalink
Switch CMakeLists.txt to handle static tiledb generically
Browse files Browse the repository at this point in the history
  • Loading branch information
Shelnutt2 committed Oct 2, 2021
1 parent f13f5f1 commit be8d06d
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ set(EP_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/externals/install")

find_package(TileDB QUIET)

SET(USE_TILEDB_STATIC OFF)
if(MSVC OR WITH_EMBEDDED_SERVER)
SET(USE_TILEDB_STATIC ON)
endif()

if(NOT TileDB_FOUND AND SUPERBUILD)
MESSAGE(STATUS "TileDB not found for MyTile. Building as dependency from source")
include(ExternalProject)
Expand All @@ -58,17 +63,18 @@ if(NOT TileDB_FOUND AND SUPERBUILD)
ExternalProject_Add(tiledb
PREFIX "externals"
URL "https://github.com/TileDB-Inc/TileDB/archive/${TILEDB_VERSION}.zip"
URL_HASH SHA1=03c71c4fc7c4e63bd59a0f8f38cf7a670ad4464c
URL_HASH SHA1=03c71c4fc7c4e63bd59a0f8f38cf7a670ad4464c
DOWNLOAD_NAME "tiledb.zip"
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${EP_INSTALL_PREFIX}
-DCMAKE_PREFIX_PATH=${EP_INSTALL_PREFIX}
-DTILEDB_VERBOSE=ON
-DTILEDB_S3=ON
-DTILEDB_AZURE=ON
-DTILEDB_STATIC=ON
-DTILEDB_STATIC=${USE_TILEDB_STATIC}
-DTILEDB_SERIALIZATION=ON
-DTILEDB_FORCE_ALL_DEPS=ON
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
UPDATE_COMMAND ""
INSTALL_COMMAND
${CMAKE_COMMAND} --build . --target install-tiledb
Expand All @@ -81,10 +87,14 @@ if(NOT TileDB_FOUND AND SUPERBUILD)

# Manually link library
# Must use full library name else cmake things its the external target of `tiledb`
SET(TILEDB_LIBRARIES "${EP_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}tiledb${CMAKE_SHARED_LIBRARY_SUFFIX}.${TILEDB_VERSION_MAJOR}.${TILEDB_VERSION_MINOR}")
if(MSVC)
SET(TILEDB_LIBRARIES "${EP_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}tiledb${CMAKE_STATIC_LIBRARY_SUFFIX}")
else()
SET(TILEDB_LIBRARIES "${EP_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}tiledb${CMAKE_SHARED_LIBRARY_SUFFIX}.${TILEDB_VERSION_MAJOR}.${TILEDB_VERSION_MINOR}")
endif()
FILE(GLOB TILEDB_INSTALL_LIBRARIES "${TILEDB_LIBRARIES}")
else()
if(MSVC)
if(USE_TILEDB_STATIC)
GET_TARGET_PROPERTY(TILEDB_LIBRARIES TileDB::tiledb_static IMPORTED_LOCATION_DEBUG)
# If no release lib try debug lib
if(${TILEDB_LIBRARIES} MATCHES "NOTFOUND")
Expand Down Expand Up @@ -123,7 +133,7 @@ endif()

# Add the storage engine plugin
# If we are compiling embedded server make it statically linked
if(WITH_EMBEDDED_SERVER)
if(WITH_EMBEDDED_SERVER OR USE_TILEDB_STATIC)
MYSQL_ADD_PLUGIN(mytile ${SOURCE_FILES} STORAGE_ENGINE DEFAULT RECOMPILE_FOR_EMBEDDED LINK_LIBRARIES ${TILEDB_LIBRARIES})
# Else build as a dynamic library
else()
Expand Down

0 comments on commit be8d06d

Please sign in to comment.