-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
49 lines (36 loc) · 1.23 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
cmake_minimum_required(VERSION 2.8.3)
project(mtimesx)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEFINEUNIX -largeArrayDims -lopenblas")
if(NOT DEFINED CMAKE_SUPPRESS_DEVELOPER_WARNINGS)
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE INTERNAL "No dev warnings")
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
find_package(OpenBLAS REQUIRED)
find_package(MATLAB QUIET)
if (MATLAB_FOUND)
# MATLAB Macro definitions
add_definitions(/DMATLAB_MEX_FILE)
add_definitions(/DMX_COMPAT_32)
add_library(${PROJECT_NAME} SHARED
src/${PROJECT_NAME}.c
)
target_link_libraries(${PROJECT_NAME}
${MATLAB_LIBRARIES}
${OPENBLAS_LIBRARIES}
)
if (UNIX AND APPLE)
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX .mexmaci64 PREFIX "")
elseif (UNIX)
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX .mexa64 PREFIX "")
endif()
install(TARGETS ${PROJECT_NAME}
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}
)
install(DIRECTORY cmake/
DESTINATION "share/${PROJECT_NAME}"
FILES_MATCHING PATTERN "*.cmake"
)
endif()