forked from kit-cel/simulink-hackrf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
61 lines (51 loc) · 1.97 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
50
51
52
53
54
55
56
57
58
59
60
61
cmake_minimum_required(VERSION 3.0)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
##########################################################################
project(simulink_hackrf LANGUAGES C VERSION 1.0.0)
include("local.cmake" OPTIONAL) # defs to make IDE happy
if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
message(FATAL_ERROR "In-source builds are not allowed.")
endif()
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/Documents/MATLAB"
CACHE PATH "default install prefix" FORCE)
endif()
set(INSTALL_DESTINATION "." CACHE PATH "install directory relative to prefix")
##########################################################################
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(LIBHACKRF REQUIRED)
get_filename_component(HACKRF_LIB_DIR ${LIBHACKRF_LIBRARIES} DIRECTORY)
find_package(Matlab REQUIRED)
if(NOT MATLAB_MEX_PATH)
find_program(MATLAB_MEX_PATH mex mex.bat
HINTS ${MATLAB_ROOT}/bin
PATHS ${MATLAB_ROOT}/bin
DOC "The mex program path"
)
if(NOT MATLAB_MEX_PATH)
message(FATAL_ERROR "Can't find Matlab MEX compiler")
endif()
endif()
##########################################################################
set(mex_extra_args "-silent" "-largeArrayDims")
if(CMAKE_VERBOSE_MAKEFILE)
list(APPEND mex_extra_args "-v")
endif()
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
list(APPEND mex_extra_args "-g")
endif()
##########################################################################
add_subdirectory(src)
add_subdirectory(blockset)
##########################################################################
# uninstall target
configure_file(
"${PROJECT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY
)
add_custom_target(
uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
)