-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
100 lines (76 loc) · 2.28 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
cmake_minimum_required(VERSION 3.11)
project(tblink-rpc-hdl)
include (ExternalProject)
message("tblink-rpc-hdl: PACKAGES_DIR=${PACKAGES_DIR}")
if(NOT WIN32)
add_compile_options(-fPIC)
endif()
set(CMAKE_CXX_STANDARD 11)
#********************************************************************
#* Configure dependencies
#********************************************************************
if (NOT PACKAGES_DIR)
set(PACKAGES_DIR ${CMAKE_SOURCE_DIR}/packages)
set (TBLINK_RPC_CORE_DIR "${PACKAGES_DIR}/tblink-rpc-core")
# add_subdirectory(tests)
else()
endif()
if (TBLINK_RPC_CORE_DIR)
add_subdirectory(${TBLINK_RPC_CORE_DIR} ${CMAKE_BINARY_DIR}/tblink-rpc-core)
endif()
foreach(CompilerFlag ${CompilerFlags})
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
string(REPLACE "/MDd" "/MTd" ${CompilerFlag} "${${CompilerFlag}}")
endforeach()
file(GLOB tblink_rpc_hdl_dpi_SRC
src/dpi/*.cpp
src/dpi/*.h)
list(APPEND tblink_rpc_hdl_dpi_SRC
src/vpi/vpi_api.cpp
src/vpi/VpiHandle.cpp
)
file(GLOB tblink_rpc_hdl_vpi_SRC
src/vpi/*.cpp
src/vpi/*.h)
# add_library(tblink_rpc_hdl_static ${tblink_rpc_hdl_SRC})
#
# target_include_directories(tblink_rpc_hdl_static PRIVATE
# ${PACKAGES_DIR}/tblink-rpc-core/cpp/include
# ${PACKAGES_DIR}/tblink-rpc-core/cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/cpp
# ${CMAKE_BINARY_DIR}/glog/include
# )
#
# install(TARGETS tblink_rpc_hdl_static
# DESTINATION lib
# EXPORT tblink_rpc_hdl-targets)
add_library(tblink_rpc_hdl_dpi SHARED ${tblink_rpc_hdl_dpi_SRC})
target_include_directories(tblink_rpc_hdl_dpi PRIVATE
${PACKAGES_DIR}/tblink-rpc-core/cpp/include
${PACKAGES_DIR}/tblink-rpc-core/cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/vpi
)
add_dependencies(tblink_rpc_hdl_dpi
tblink_rpc_core_static
)
target_link_libraries(
tblink_rpc_hdl_dpi
-Wl,--whole-archive
tblink_rpc_core_static
-Wl,--no-whole-archive
)
add_library(tblink_rpc_hdl_vpi SHARED ${tblink_rpc_hdl_vpi_SRC})
target_include_directories(tblink_rpc_hdl_vpi PRIVATE
${PACKAGES_DIR}/tblink-rpc-core/cpp/include
${PACKAGES_DIR}/tblink-rpc-core/cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/vpi
)
add_dependencies(tblink_rpc_hdl_vpi
tblink_rpc_core_static
)
target_link_libraries(
tblink_rpc_hdl_vpi
-Wl,--whole-archive
tblink_rpc_core_static
-Wl,--no-whole-archive
)