Skip to content

Commit

Permalink
Fix Windows build error for the libmexclass integration.
Browse files Browse the repository at this point in the history
Also, update the register proxy macro used to reflect the libmexclass changes for mathworks/libmexclass#20.
Co-authored-by: Fiona la <fionala7@gmail.com>
  • Loading branch information
sreeharihegden committed Mar 8, 2023
1 parent 8cf062f commit 00568c0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions matlab/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -318,15 +318,23 @@ matlab_add_mex(R2018a
target_include_directories(mexcall PRIVATE ${CPP_SOURCE_DIR})

############# libmexclass #################################
get_target_property(ARROW_SHARED_LIB arrow_shared IMPORTED_LOCATION)
# On Windows, we use the arrow.lib for linking arrow_matlab against the Arrow C++ library.
# The location of arrow.lib is previously saved in IMPORTED_IMPLIB.
if(WIN32)
get_target_property(ARROW_LINK_LIB arrow_shared IMPORTED_IMPLIB)
else()
# On Linux and macOS, it is the arrow.dll in the newly built arrow_shared library used for linking.
# This is available in IMPORTED_LOCATION.
get_target_property(ARROW_LINK_LIB arrow_shared IMPORTED_LOCATION)
endif()
get_target_property(ARROW_INCLUDE_DIR arrow_shared INTERFACE_INCLUDE_DIRECTORIES)

set(CUSTOM_PROXY_FACTORY_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/src/cpp/arrow/matlab/proxy;${CMAKE_SOURCE_DIR}/src/cpp")
set(CUSTOM_PROXY_FACTORY_SOURCES "${CMAKE_SOURCE_DIR}/src/cpp/arrow/matlab/proxy/CustomProxyFactory.cc")
set(CUSTOM_PROXY_SOURCES_DIR "${CMAKE_SOURCE_DIR}/src/cpp/arrow/matlab/proxy")
set(CUSTOM_PROXY_SOURCES "${CUSTOM_PROXY_SOURCES_DIR}/array/double_array_proxy.cc")
set(CUSTOM_PROXY_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/src/cpp;${ARROW_INCLUDE_DIR}")
set(CUSTOM_PROXY_LINK_LIBRARIES ${ARROW_SHARED_LIB})
set(CUSTOM_PROXY_LINK_LIBRARIES ${ARROW_LINK_LIB})

# Build libmexclass as an external project.
include(ExternalProject)
Expand Down
2 changes: 1 addition & 1 deletion matlab/src/cpp/arrow/matlab/proxy/CustomProxyFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
#include "CustomProxyFactory.h"

std::shared_ptr<Proxy> CustomProxyFactory::make_proxy(const ClassName& class_name, const FunctionArguments& constructor_arguments) {
registerProxy(DoubleArrayProxy);
REGISTER_PROXY_SAME_NAME(DoubleArrayProxy);
return nullptr;
};

0 comments on commit 00568c0

Please sign in to comment.