forked from ni/libnifpga-usrp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
83 lines (69 loc) · 2.27 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
cmake_minimum_required(VERSION 2.4.0)
project(nifpga)
enable_testing()
set(CMAKE_CXX_STANDARD 17)
include_directories(include)
add_library(nifpga SHARED
src/Bitfile.cpp
src/DeviceFile.cpp
src/DeviceTree.cpp
src/dtgen.cpp
src/ErrnoMap.cpp
src/Fifo.cpp
src/FifoInfo.cpp
src/NiFpga.cpp
src/RegisterInfo.cpp
src/ResourceInfo.cpp
src/Session.cpp
src/SysfsFile.cpp
src/Type.cpp
src/libb64/cdecode.cpp
)
set_target_properties(nifpga PROPERTIES
CXX_VISIBILITY_PRESET hidden
SOVERSION 1)
if(ENABLE_VALGRIND)
target_compile_definitions(nifpga PRIVATE ENABLE_VALGRIND)
endif(ENABLE_VALGRIND)
target_link_options(nifpga PRIVATE "LINKER:-z,defs")
add_executable(lvbitx2dtso
src/Bitfile.cpp
src/DeviceTree.cpp
src/dtgen.cpp
src/FifoInfo.cpp
src/lvbitx2dtso.cpp
src/RegisterInfo.cpp
src/ResourceInfo.cpp
src/Type.cpp
src/libb64/cdecode.cpp
)
add_custom_command(
OUTPUT libnifpga.so.symalias
DEPENDS src/libnifpga.exports
COMMAND sed -n "s/NiFpga_\\(\\w\\+\\)/-defsym=NiFpgaDll_\\1=&/p" ${CMAKE_SOURCE_DIR}/src/libnifpga.exports > libnifpga.so.symalias VERBATIM
COMMENT "Generate compatibility aliases"
)
add_custom_target(nifpga_symalias DEPENDS libnifpga.so.symalias)
target_link_options(nifpga PRIVATE "LINKER:@libnifpga.so.symalias")
target_link_options(nifpga PRIVATE "LINKER:--version-script=libnifpga.so.map")
add_custom_command(
OUTPUT libnifpga.so.map
DEPENDS src/libnifpga.exports
COMMAND echo "{" > libnifpga.so.map
COMMAND echo " global:" >> libnifpga.so.map
COMMAND sed "/^NiFpga_/p; s/NiFpga_/NiFpgaDll_/" < ${CMAKE_SOURCE_DIR}/src/libnifpga.exports | sed "s/.*/ &;/" >> libnifpga.so.map VERBATIM
COMMAND echo " local:" >> libnifpga.so.map
COMMAND echo " *;" >> libnifpga.so.map
COMMAND echo "};" >> libnifpga.so.map
COMMENT "Generate version script"
)
add_custom_target(nifpga_map DEPENDS libnifpga.so.map)
add_dependencies(nifpga nifpga_map nifpga_symalias)
install(TARGETS nifpga DESTINATION lib)
install(TARGETS lvbitx2dtso DESTINATION bin)
file(GLOB HEADERS include/*.h)
install(FILES ${HEADERS} DESTINATION include)
add_executable(test_packedarray
tests/test_PackedArray.cpp
)
add_test(NAME test_packedarray COMMAND test_packedarray)