summaryrefslogtreecommitdiffstats
path: root/stacks/lwip_stack/tools/CMakeLists.txt
blob: cc8f408fe1f52663a5e48c37ae5a00bef8bb8165 (plain)
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
#########################################################################
#
# Copyright (c) 2018 Huawei Technologies Co.,Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#########################################################################

if(WITH_HAL_LIB)
else()
endif()
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${NSTACKTOOLS_PATH})
LINK_DIRECTORIES(${LIB_PATH_SHARED} ${LIB_PATH_STATIC})
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/platform/SecureC/include/)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -fPIC -fPIE -pie -m64 -mssse3 -std=gnu89")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -Wshadow -Wfloat-equal -Wformat=2")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector -fstack-protector-all")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-z,relro,-z,now -Wl,--disable-new-dtags,--rpath,.")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-z,noexecstack -mcmodel=medium")

INCLUDE_DIRECTORIES(
	../src/include/
	../../../thirdparty/glog/glog-0.3.5/src/
	../../SecureC/include/
	../../../src/include/
	../../../src/framework/include/common/
	../../../src/framework/include/
	../../../src/framework/include/common/generic/
)

#ADD_EXECUTABLE(narp narp.c)
#ADD_EXECUTABLE(nnetstat nnetstat.c)

ADD_EXECUTABLE(ntcpdump ntcpdump.c)
if(WITH_SECUREC_LIB)
TARGET_LINK_LIBRARIES(
    ntcpdump
    pthread
    rt
    securec
    -Wl,--whole-archive
    libjson-c.a
    libglog.a
    nStackFw 
    -Wl,--no-whole-archive,-lstdc++ -ldl
    rte_eal
    rte_mempool
    rte_mbuf
    rte_ring
)
else()
TARGET_LINK_LIBRARIES(
        ntcpdump
        pthread
        rt
        -Wl,--whole-archive
        libjson-c.a
        libglog.a
        nStackFw 
        -Wl,--no-whole-archive,-lstdc++ -ldl
        rte_eal
        rte_mempool
        rte_mbuf
        rte_ring
)
endif()

if(WITH_SECUREC_LIB)
ADD_DEPENDENCIES(ntcpdump JSON GLOG SECUREC DPDK)
else()
ADD_DEPENDENCIES(ntcpdump JSON GLOG DPDK)
endif()


ADD_EXECUTABLE(nping nping.c)

if(WITH_SECUREC_LIB)
ADD_DEPENDENCIES(nping SECUREC DPDK)
else()
ADD_DEPENDENCIES(nping DPDK)
endif()

if(WITH_SECUREC_LIB)
TARGET_LINK_LIBRARIES(nping libnStackAPI.so securec -Wl,-rpath=. -lpthread -lrt -ldl)
else()
TARGET_LINK_LIBRARIES(nping libnStackAPI.so -Wl,-rpath=. -lpthread -lrt -ldl)
endif()