-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-12730: [MATLAB] Update featherreadmex and featherwritemex to build against latest Arrow C++ APIs #10305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6a19696
724e6ac
0197f93
40bd571
7a4b2a7
77a71f4
d039955
36201e7
c86c5da
bbd0ebe
d1f730b
24af511
45b1842
338a09a
141a37d
e3e40f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,8 @@ | |
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| cmake_minimum_required(VERSION 3.2) | ||
| cmake_minimum_required(VERSION 3.20) | ||
|
|
||
| set(CMAKE_CXX_STANDARD 11) | ||
|
|
||
| set(MLARROW_VERSION "5.0.0-SNAPSHOT") | ||
|
|
@@ -29,22 +30,45 @@ if(EXISTS "${CPP_CMAKE_MODULES}") | |
| set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CPP_CMAKE_MODULES}) | ||
| endif() | ||
|
|
||
| ## Arrow is Required | ||
| set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake_modules) | ||
|
|
||
| # Arrow is Required | ||
| find_package(Arrow REQUIRED) | ||
|
|
||
| ## MATLAB is required to be installed to build MEX interfaces | ||
| set(MATLAB_ADDITIONAL_VERSIONS "R2018a=9.4") | ||
| find_package(Matlab REQUIRED MX_LIBRARY) | ||
|
|
||
| # Build featherread mex file based on the arrow shared library | ||
| matlab_add_mex(NAME featherreadmex | ||
| SRC src/featherreadmex.cc src/feather_reader.cc src/util/handle_status.cc | ||
| src/util/unicode_conversion.cc | ||
| LINK_TO ${ARROW_SHARED_LIB}) | ||
| target_include_directories(featherreadmex PRIVATE ${ARROW_INCLUDE_DIR}) | ||
|
|
||
| # Build featherwrite mex file based on the arrow shared library | ||
| matlab_add_mex(NAME featherwritemex | ||
| SRC src/featherwritemex.cc src/feather_writer.cc src/util/handle_status.cc | ||
| LINK_TO ${ARROW_SHARED_LIB}) | ||
| target_include_directories(featherwritemex PRIVATE ${ARROW_INCLUDE_DIR}) | ||
| # MATLAB is Required | ||
| find_package(Matlab REQUIRED) | ||
|
|
||
| # Construct the absolute path to featherread's source files | ||
| set(featherread_sources featherreadmex.cc feather_reader.cc util/handle_status.cc | ||
| util/unicode_conversion.cc) | ||
| list(TRANSFORM featherread_sources PREPEND ${CMAKE_SOURCE_DIR}/src/) | ||
|
|
||
| # Build featherreadmex MEX binary | ||
| matlab_add_mex(R2018a | ||
| NAME featherreadmex | ||
| SRC ${featherread_sources} | ||
| LINK_TO arrow_shared) | ||
|
|
||
| # Construct the absolute path to featherwrite's source files | ||
| set(featherwrite_sources featherwritemex.cc feather_writer.cc util/handle_status.cc | ||
| util/unicode_conversion.cc) | ||
| list(TRANSFORM featherwrite_sources PREPEND ${CMAKE_SOURCE_DIR}/src/) | ||
|
|
||
| # Build featherwritemex MEX binary | ||
| matlab_add_mex(R2018a | ||
| NAME featherwritemex | ||
| SRC ${featherwrite_sources} | ||
| LINK_TO arrow_shared) | ||
|
|
||
| # Ensure the MEX binaries are placed in the src directory on all platforms | ||
|
||
| if(WIN32) | ||
| set_target_properties(featherreadmex PROPERTIES RUNTIME_OUTPUT_DIRECTORY | ||
| $<1:${CMAKE_SOURCE_DIR}/src>) | ||
| set_target_properties(featherwritemex PROPERTIES RUNTIME_OUTPUT_DIRECTORY | ||
| $<1:${CMAKE_SOURCE_DIR}/src>) | ||
| else() | ||
| set_target_properties(featherreadmex PROPERTIES LIBRARY_OUTPUT_DIRECTORY | ||
| $<1:${CMAKE_SOURCE_DIR}/src>) | ||
| set_target_properties(featherwritemex PROPERTIES LIBRARY_OUTPUT_DIRECTORY | ||
| $<1:${CMAKE_SOURCE_DIR}/src>) | ||
| endif() | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems a bit high, is it necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We wanted to use 3.20 because earlier versions of the FindMatlab.cmake module had a few bugs we ran into when trying to build our mex functions. I'm open to other approaches, but the hope was to build on the existing work of the cmake community to avoid reinventing the wheel. We also want to share improvements upstream where appropriate.