-
Notifications
You must be signed in to change notification settings - Fork 68
use cmake offical FindMatlab and matlab_add_mex #16
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
Open
congzhangzh
wants to merge
1
commit into
leoliuf:master
Choose a base branch
from
medlab:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,21 @@ | ||
|
|
||
| cmake_minimum_required(VERSION 2.8) | ||
| project(MRiLab) | ||
|
|
||
| set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}) | ||
| set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) | ||
| #set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) | ||
| set(CMAKE_SIZEOF_VOID_P 8) # use 64-bit by default | ||
| set(CMAKE_BUILD_TYPE Release) # use Release version by default | ||
|
|
||
| add_definitions(/DMATLAB_MEX_FILE) #define matlab macros | ||
| add_definitions(/DMX_COMPAT_32) | ||
|
|
||
| find_package(Matlab REQUIRED) | ||
| find_package(Matlab REQUIRED MX_LIBRARY ENG_LIBRARY MAIN_PROGRAM) | ||
| find_package(IPP) | ||
| find_package(Framewave) | ||
| find_package(OpenMP) | ||
| find_package(CUDA) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noticed you comment CUDA. Did you test CPU-only mode?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe, I am not sure, it seems this line should not be deleted |
||
| find_package(VTK) | ||
| find_package(Ismrmrd) | ||
| find_package(Boost COMPONENTS thread system) | ||
| find_package(Boost) | ||
|
|
||
| IF(MATLAB_FOUND) | ||
| add_subdirectory(engine) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1 @@ | ||
|
|
||
| add_subdirectory(DoGridding) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,3 @@ | ||
|
|
||
| INCLUDE_DIRECTORIES(${MATLAB_INCLUDE_DIR}) | ||
|
|
||
| add_library(DoGridding SHARED DoGridding.cpp ${CMAKE_SOURCE_DIR}/Matlabdef.def) | ||
| target_link_libraries(DoGridding ${MATLAB_LIBRARIES}) | ||
|
|
||
| if(WIN32) | ||
| if (CMAKE_CL_64) | ||
| SET_TARGET_PROPERTIES(DoGridding PROPERTIES SUFFIX .mexw64) | ||
| else(CMAKE_CL_64) | ||
| SET_TARGET_PROPERTIES(DoGridding PROPERTIES SUFFIX .mexw32) | ||
| endif(CMAKE_CL_64) | ||
| else(WIN32) | ||
| if (CMAKE_SIZEOF_VOID_P MATCHES "8") | ||
| SET_TARGET_PROPERTIES(DoGridding PROPERTIES SUFFIX .mexa64 PREFIX "") | ||
| else(CMAKE_SIZEOF_VOID_P MATCHES "8") | ||
| SET_TARGET_PROPERTIES(DoGridding PROPERTIES SUFFIX .mexglx PREFIX "") | ||
| endif (CMAKE_SIZEOF_VOID_P MATCHES "8") | ||
| endif(WIN32) | ||
| matlab_add_mex(NAME DoGridding SRC DoGridding.cpp ${CMAKE_SOURCE_DIR}/Matlabdef.def LINK_TO ${Matlab_LIBRARIES}) | ||
|
|
||
| install(TARGETS DoGridding DESTINATION ../bin) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
|
|
||
| include(${VTK_USE_FILE}) | ||
|
|
||
| if (VTK_FOUND) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,3 @@ | ||
| matlab_add_mex(NAME DoSARAverageAtCPU SRC DoSARAverageAtCPU.cpp ${CMAKE_SOURCE_DIR}/Matlabdef.def LINK_TO ${Matlab_LIBRARIES}) | ||
|
|
||
| INCLUDE_DIRECTORIES(${MATLAB_INCLUDE_DIR}) | ||
|
|
||
| add_library(DoSARAverageAtCPU SHARED DoSARAverageAtCPU.cpp ${CMAKE_SOURCE_DIR}/Matlabdef.def) | ||
| target_link_libraries(DoSARAverageAtCPU ${MATLAB_LIBRARIES}) | ||
|
|
||
| if(WIN32) | ||
| if (CMAKE_CL_64) | ||
| SET_TARGET_PROPERTIES(DoSARAverageAtCPU PROPERTIES SUFFIX .mexw64) | ||
| else(CMAKE_CL_64) | ||
| SET_TARGET_PROPERTIES(DoSARAverageAtCPU PROPERTIES SUFFIX .mexw32) | ||
| endif(CMAKE_CL_64) | ||
| else(WIN32) | ||
| if (CMAKE_SIZEOF_VOID_P MATCHES "8") | ||
| SET_TARGET_PROPERTIES(DoSARAverageAtCPU PROPERTIES SUFFIX .mexa64 PREFIX "") | ||
| else(CMAKE_SIZEOF_VOID_P MATCHES "8") | ||
| SET_TARGET_PROPERTIES(DoSARAverageAtCPU PROPERTIES SUFFIX .mexglx PREFIX "") | ||
| endif (CMAKE_SIZEOF_VOID_P MATCHES "8") | ||
| endif(WIN32) | ||
|
|
||
| install(TARGETS DoSARAverageAtCPU DESTINATION ../bin) | ||
| install(TARGETS DoSARAverageAtCPU DESTINATION ../bin) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
./cmake folder has not only FindMatlab.cmake but also files for IPP, Framewave etc.
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.
I agree with you, I should keep this line,
and combine ${CMAKE_SOURCE_DIR}/cmake with old CMAKE_MODULE_PATH like,
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH } ${CMAKE_SOURCE_DIR}/cmake)
or
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)