summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlberto <acompagn+fdio@cisco.com>2017-09-08 15:31:31 +0200
committerAlberto <acompagn+fdio@cisco.com>2017-09-08 15:31:31 +0200
commitccffdd8f80e1d57ab0c7f327f0350e89b6e154bc (patch)
tree5ebb974b12835b048f478febcd2a790bb8410dfa
parent58b8145dc54b9fe445465930ef76d9bf561b1be0 (diff)
Added support for Release and Debug mode. Added CICN_INSTALL_PREFIX variable to specify the install path for the plugin
Change-Id: Id922883decdbc8b687ae6441c242c3b469be14e2 Signed-off-by: Alberto <acompagn+fdio@cisco.com>
-rwxr-xr-xcicn-plugin/CMakeLists.txt20
1 files changed, 17 insertions, 3 deletions
diff --git a/cicn-plugin/CMakeLists.txt b/cicn-plugin/CMakeLists.txt
index c9ac3c12..b9bcfd83 100755
--- a/cicn-plugin/CMakeLists.txt
+++ b/cicn-plugin/CMakeLists.txt
@@ -67,10 +67,24 @@ set(CICN_API_TEST_SOURCE_FILES
set(CICN_API_TEST_HEADER_FILES
cicn/cicn_api.h)
+if (NOT CMAKE_BUILD_TYPE)
+ set (CMAKE_BUILD_TYPE "Release")
+endif (NOT CMAKE_BUILD_TYPE)
+
+
+SET(CICN_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/lib CACHE STRING "cicn_install_prefix")
+
+if (CMAKE_BUILD_TYPE STREQUAL "Release")
+ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wall -march=native -O3")
+elseif (CMAKE_BUILD_TYPE STREQUAL "Debug")
+ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -march=native -O0 -g")
+ add_definitions(-DCLIB_DEBUG -fPIC -fstack-protector-all)
+endif()
+
execute_process(COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/cicn)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cicn/cicn.api.h
COMMAND
- $ENV{CC} $ENV{CPPFLAGS} -E -P -x c-header ${CMAKE_CURRENT_SOURCE_DIR}/cicn/cicn.api |
+ ${CMAKE_C_COMPILER} $ENV{CPPFLAGS} -E -P -x c-header ${CMAKE_CURRENT_SOURCE_DIR}/cicn/cicn.api |
vppapigen --input - --output ${CMAKE_CURRENT_BINARY_DIR}/cicn/cicn.api.h
--show-name ${CMAKE_CURRENT_BINARY_DIR}/cicn/cicn.api.h
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/cicn/cicn.api)
@@ -102,8 +116,8 @@ set_target_properties(cicn_api_test_plugin
target_link_libraries(cicn_plugin)
target_link_libraries(cicn_api_test_plugin)
-set(VPP_INSTALL_PLUGIN ${CMAKE_INSTALL_PREFIX}/lib/vpp_plugins)
-set(VPP_INSTALL_API_TEST_PLUGIN ${CMAKE_INSTALL_PREFIX}/lib/vpp_api_test_plugins)
+set(VPP_INSTALL_PLUGIN ${CICN_INSTALL_PREFIX}/vpp_plugins)
+set(VPP_INSTALL_API_TEST_PLUGIN ${CICN_INSTALL_PREFIX}/vpp_api_test_plugins)
install(DIRECTORY DESTINATION ${VPP_INSTALL_PLUGIN})
install(TARGETS cicn_plugin