Skip to content

Commit

Permalink
"Fixes" for building PDAL with MATLAB.
Browse files Browse the repository at this point in the history
  • Loading branch information
abellgithub committed Aug 1, 2017
1 parent c4d3ee8 commit 665a1d2
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 11 deletions.
3 changes: 3 additions & 0 deletions cmake/json.cmake
Expand Up @@ -17,6 +17,9 @@ if (JSONCPP_FOUND)
set(JSON_CPP_LINK_TYPE PUBLIC)
set(PDAL_HAVE_JSONCPP 1)
else()
unset(JSONCPP_INCLUDE_DIR CACHE)
unset(JSONCPP_LIBRARY CACHE)
unset(JSONCPP_ROOT_DIR CACHE)
set(PDAL_JSONCPP_LIB_NAME pdal_jsoncpp)
set(PDAL_JSONCPP_INCLUDE_DIR ${PDAL_VENDOR_DIR}/jsoncpp/dist)
set(PDAL_JSONCPP_SRC ${PDAL_JSONCPP_INCLUDE_DIR}/jsoncpp.cpp)
Expand Down
13 changes: 8 additions & 5 deletions cmake/modules/FindMatlab.cmake
Expand Up @@ -13,11 +13,11 @@
set(MATLAB_FOUND 0)


set(MATLAB_EXTERN_DIR ${MATLAB_ROOT}/extern/include)
set(MATLAB_EXTERN_DIR $ENV{MATLAB_ROOT}/extern/include)
if (APPLE)
set(MATLAB_LIB_DIR ${MATLAB_ROOT}/bin/maci64)
set(MATLAB_LIB_DIR $ENV{MATLAB_ROOT}/bin/maci64)
elseif (UNIX)
set(MATLAB_LIB_DIR ${MATLAB_ROOT}/bin/glnxa64)
set(MATLAB_LIB_DIR $ENV{MATLAB_ROOT}/bin/glnxa64)
endif()

message(STATUS ${MATLAB_LIB_DIR})
Expand All @@ -30,7 +30,11 @@ find_library(MATLAB_MX_LIBRARY
mx
${MATLAB_LIB_DIR}
)
find_path(MATHALB_INCLUDE_DIR
find_library(MATLAB_ENG_LIBRARY
eng
${MATLAB_LIB_DIR}
)
find_path(MATLAB_INCLUDE_DIR
"mat.h"
${MATLAB_EXTERN_DIR}
)
Expand All @@ -41,7 +45,6 @@ set(MATLAB_LIBRARIES
)
mark_as_advanced(MATLAB_LIBRARIES)


if (MATLAB_MAT_LIBRARIES AND MATLAB_INCLUDE_DIR)
set(MATLAB_FOUND 1)
endif()
39 changes: 33 additions & 6 deletions plugins/matlab/CMakeLists.txt
Expand Up @@ -2,6 +2,11 @@

include(${PDAL_CMAKE_DIR}/matlab.cmake)

#set(CMAKE_SKIP_RPATH true)
#if (LINUX)

#endif()

PDAL_ADD_PLUGIN(libname_writer writer matlab
FILES
./filters/Script.cpp
Expand Down Expand Up @@ -32,38 +37,60 @@ PDAL_ADD_PLUGIN(matlab_libname filter matlab
${MATLAB_ENG_LIBRARY} ${MATLAB_MX_LIBRARY} ${MATLAB_MAT_LIBRARY}
)
target_include_directories(${matlab_libname} PRIVATE
${MATLAB_INCLUDE_DIR} )
${MATLAB_INCLUDE_DIR}
${PDAL_JSONCPP_INCLUDE_DIR} )

if (WITH_TESTS)
PDAL_ADD_TEST(pdal_io_matlab_writer_test
FILES
test/MatlabWriterTest.cpp
LINK_WITH
${MATLAB_MX_LIBRARY} ${MATLAB_MAT_LIBRARY} ${libname_writer}
${libname_writer}
)
target_include_directories(pdal_io_matlab_writer_test PRIVATE
${PDAL_IO_DIR}
${MATLAB_INCLUDE_DIR})
set_target_properties(pdal_io_matlab_writer_test
PROPERTIES
INSTALL_RPATH "${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}:${MATLAB_LIB_DIR}"
BUILD_WITH_INSTALL_RPATH true
)


PDAL_ADD_TEST(pdal_io_matlab_reader_test
FILES
test/MatlabReaderTest.cpp
LINK_WITH
${MATLAB_MX_LIBRARY} ${MATLAB_MAT_LIBRARY} ${libname_reader}
${libname_reader}
)
target_include_directories(pdal_io_matlab_reader_test PRIVATE
${PDAL_IO_DIR}
${MATLAB_INCLUDE_DIR})
set_target_properties(pdal_io_matlab_reader_test
PROPERTIES
INSTALL_RPATH "${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}:${MATLAB_LIB_DIR}"
BUILD_WITH_INSTALL_RPATH true
)

PDAL_ADD_TEST(pdal_filters_matlab_test
FILES
./filters/Script.cpp
./filters/Environment.cpp
./test/MatlabFilterTest.cpp
LINK_WITH ${MATLAB_ENG_LIBRARY} ${MATLAB_MX_LIBRARY} ${MATLAB_MAT_LIBRARY}
)
LINK_WITH
${MATLAB_ENG_LIBRARY}
${MATLAB_MX_LIBRARY}
${MATLAB_MAT_LIBRARY}
)
set_target_properties(pdal_filters_matlab_test
PROPERTIES
INSTALL_RPATH "${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}:${MATLAB_LIB_DIR}:${CMAKE_LIBRARY_OUTPUT_DIRECTORY}"
BUILD_WITH_INSTALL_RPATH true
)
]]
target_include_directories(pdal_filters_matlab_test PRIVATE
${ROOT_DIR} ${MATLAB_INCLUDE_DIR})
${ROOT_DIR}
${MATLAB_INCLUDE_DIR}
${PDAL_JSONCPP_INCLUDE_DIR} )
endif()

0 comments on commit 665a1d2

Please sign in to comment.