Skip to content

Commit

Permalink
Fix C++ API visibility Windows build errors.
Browse files Browse the repository at this point in the history
PR #412

Also several improvements to the AppVeyor config.

(cherry picked from commit c74f443)
  • Loading branch information
tdenniston authored and stavrospapadopoulos committed Mar 12, 2018
1 parent 070b7a2 commit d19b38e
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 17 deletions.
65 changes: 63 additions & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,81 @@ build_script:
..\scripts\install-deps.ps1
if ($LastExitCode -ne 0) {
Write-Host "Deps install failed."
$host.SetShouldExit($LastExitCode)
}
if ($env:USE_S3 -eq "true") {
..\scripts\install-s3.ps1
..\scripts\install-minio.ps1
..\bootstrap.ps1 -S3 -EnableVerbose
} else {
..\bootstrap.ps1 -EnableVerbose
}
if ($LastExitCode -ne 0) {
Write-Host "Bootstrap failed."
$host.SetShouldExit($LastExitCode)
}
cmake --build . --config Release
if ($LastExitCode -ne 0) {
Write-Host "Build failed."
$host.SetShouldExit($LastExitCode)
}
test_script:
- ps: >-
cmake --build . --target check --config Release
cmake --build . --target examples
if ($LastExitCode -ne 0) {
Write-Host "Tests failed."
$host.SetShouldExit($LastExitCode)
}
cmake --build . --target examples --config Release
if ($LastExitCode -ne 0) {
Write-Host "Examples failed to build."
$host.SetShouldExit($LastExitCode)
}
cmake --build . --target install --config Release
if ($LastExitCode -ne 0) {
Write-Host "Installation failed."
$host.SetShouldExit($LastExitCode)
}
$env:Path += ";$env:APPVEYOR_BUILD_FOLDER\dist\bin"
try {
.\examples\c_api\Release\tiledb_dense_create_c.exe
} catch {
Write-Host "C API example failed."
$host.SetShouldExit(1)
}
if ($LastExitCode -ne 0) {
Write-Host "C API example failed."
$host.SetShouldExit($LastExitCode)
}
rm -Recurse -Force my_dense_array
cmake --build . --target install
try {
.\examples\cpp_api\Release\tiledb_dense_create_cpp.exe
} catch {
Write-Host "C++ API example failed."
$host.SetShouldExit(1)
}
if ($LastExitCode -ne 0) {
Write-Host "C++ API example failed."
$host.SetShouldExit($LastExitCode)
}
mkdir dist
Expand Down
21 changes: 11 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,28 +75,28 @@ endif()
if(USE_HDFS)
find_package(LIBJVM REQUIRED)
set(TILEDB_LIB_DEPENDENCIES ${TILEDB_LIB_DEPENDENCIES} ${LIBJVM_LIBRARIES})

find_package(LIBHDFS REQUIRED)
include_directories(${LIBHDFS_INCLUDE_DIR})
# This variable is defined in FindJNI module included in the FindHDFS.cmake file
set(TILEDB_LIB_DEPENDENCIES ${TILEDB_LIB_DEPENDENCIES} ${LIBHDFS_LIBRARY})
endif()

if(USE_S3)
if(USE_S3)
cmake_minimum_required(VERSION 3.2)
find_package(AWSSDK)

message(STATUS "AWSSDK_LIB_DIR: ${AWSSDK_LIB_DIR}")
message(STATUS "AWSSDK_INC_DIR: ${AWSSDK_INCLUDE_DIR}")
message(STATUS "AWSSDK_BIN_DIR: ${AWSSDK_BIN_DIR}")

set(AWS_SERVICE s3)
AWSSDK_LIB_DEPS(AWS_SERVICE AWS_DEPS)

message(STATUS "AWS service ${AWS_SERVICE} depends on libs: ${AWS_DEPS}")
AWSSDK_DETERMINE_LIBS_TO_LINK(AWS_SERVICE AWS_LINKED_LIBS)
message(STATUS "AWS linked libs: ${AWS_LINKED_LIBS}")

set(AWS_LIBRARIES)
foreach(LIB ${AWS_LINKED_LIBS})
find_library("AWS_FOUND_${LIB}" NAMES ${LIB} PATHS ${AWSSDK_LIB_DIR} NO_DEFAULT_PATH)
Expand Down Expand Up @@ -129,11 +129,12 @@ if (WIN32)
# We disable some warnings that are not present in gcc/clang -Wall:
# C4101: unreferenced local variable
# C4244: conversion warning of floating point to integer type.
# C4251: C++ export warning
# C4456: local variable hiding previous local variable
# C4457: local variable hiding function parameter
# C4702: unreachable code
# C4996: deprecation warning about e.g. sscanf.
set(MSVC_DISABLE_WARNINGS "/wd4101 /wd4244 /wd4456 /wd4457 /wd4702 /wd4996")
set(MSVC_DISABLE_WARNINGS "/wd4101 /wd4244 /wd4251 /wd4456 /wd4457 /wd4702 /wd4996")
# Note: MSVC has the behavior of -fvisibility=hidden by default (you must
# explicitly export all symbols you want exported).
set(CMAKE_CXX_FLAGS_DEBUG "/DDEBUG /Od /Zi /W4 /WX ${MSVC_DISABLE_WARNINGS}")
Expand Down Expand Up @@ -234,13 +235,13 @@ if(DOXYGEN_FOUND)
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/doxyfile.in
COMMAND mkdir -p doxygen
COMMAND echo INPUT = ${CMAKE_SOURCE_DIR}/doc/mainpage.dox
COMMAND echo INPUT = ${CMAKE_SOURCE_DIR}/doc/mainpage.dox
${TILEDB_CORE_HEADERS} > ${CMAKE_BINARY_DIR}/doxyfile.in
COMMAND echo FILE_PATTERNS = *.h >> ${CMAKE_BINARY_DIR}/doxyfile.in
COMMENT "Preparing for Doxygen documentation" VERBATIM
)
add_custom_target(
doc ${DOXYGEN_EXECUTABLE} ${CMAKE_SOURCE_DIR}/doc/Doxyfile.mk >
doc ${DOXYGEN_EXECUTABLE} ${CMAKE_SOURCE_DIR}/doc/Doxyfile.mk >
${CMAKE_BINARY_DIR}/Doxyfile.log 2>&1
COMMENT "Generating API documentation with Doxygen" VERBATIM
DEPENDS ${CMAKE_BINARY_DIR}/doxyfile.in
Expand All @@ -250,9 +251,9 @@ endif(DOXYGEN_FOUND)
###########################################################
# Uninstall
###########################################################
set(CMD "xargs printf '-- Uninstalling: %s\\\\n' <install_manifest.txt")
set(CMD "xargs printf '-- Uninstalling: %s\\\\n' <install_manifest.txt")
add_custom_target(
uninstall
uninstall
COMMAND echo "Uninstalling TileDB..."
COMMAND eval "${CMD}"
COMMAND xargs rm -f < install_manifest.txt
Expand Down
25 changes: 25 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# In Progress

## API additions

### C API
### C++ API
* Support for trivially copyable objects, such as a custom data struct, was added. They will be backed by an `sizeof(T)` sized `char` attribute.
* `Attribute::create<T>` can now be used with compound `T`, such as `std::string` and `std::vector<T>`, and other
objects such as a simple data struct.

## Improvements
* Fix issue when linking to the C++ API via the shared library. (#408).

## Breaking changes

### C API
### C++ API
* `max_buffer_elements` was renamed to `max_buffer_sizes` and now reports sizes in bytes instead of number of elements. This was done to support
arbitrary POD types.
* Buffer size reporting for variable-sized attributes was normalized: offsets will always come first. This impacts `Array::max_buffer_sizes` and `Query::result_buffer_elements`.
If `pair.first` is 0, it is a fixed size attribute.
* `std::array<T, N>` is backed by a `char` tiledb attribute since the size is not guaranteed.
* `Attribute::set_cell_val_num()` is deprecated. This is now deduced from the Attribute type.
* Headers have the `tiledb_cpp_api_` prefix removed. For example, the include is now `#include <tiledb/attribute.h>`

# TileDB v1.2.0 Release Notes
The 1.2.0 release of TileDB includes many new features, improvements in stability and performance, and two new language interfaces (Python and C++). There are also several breaking changes in the C API and on-disk format, documented below.

Expand Down
4 changes: 2 additions & 2 deletions examples/cpp_api/tiledb_map_write.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ int main() {
// Create an item, assign values, and add to the map in a single op
int t1 = 3;
std::string t2{"ccc"};
std::vector<float> t3{3.1f, 3.2f};
map[std::vector<double>{300, 300.1}][{"a1", "a2", "a3"}] =
std::array<float, 2> t3{{3.1f, 3.2f}};
map[std::vector<double>({{300, 300.1}})][{"a1", "a2", "a3"}] =
std::make_tuple(t1, t2, t3);

// Update an existing key. Old values for a2, a3 will be carried over.
Expand Down
2 changes: 1 addition & 1 deletion tiledb/sm/c_api/tiledb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3037,7 +3037,7 @@ int tiledb_uri_to_path(
/* C++ API */
/* ****************************** */

TILEDB_EXPORT int tiledb::impl::tiledb_query_submit_async(
int tiledb::impl::tiledb_query_submit_async(
tiledb_ctx_t* ctx,
tiledb_query_t* query,
std::function<void(void*)> callback,
Expand Down
2 changes: 1 addition & 1 deletion tiledb/sm/cpp_api/tiledb_cpp_api_core_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace impl {
* @param callback_data Data to pass callback
* @return TILEDB_OK for success and TILEDB_ERR for error.
*/
int tiledb_query_submit_async(
TILEDB_EXPORT int tiledb_query_submit_async(
tiledb_ctx_t* ctx,
tiledb_query_t* query,
std::function<void(void*)> callback,
Expand Down
2 changes: 1 addition & 1 deletion tiledb/sm/cpp_api/tiledb_cpp_api_schema_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Compressor;
* Base class for TileDB schemas. This is intended
* for all array-backed stores.
*/
class Schema {
class TILEDB_EXPORT Schema {
public:
const Context& context() const {
return ctx_.get();
Expand Down

0 comments on commit d19b38e

Please sign in to comment.