diff options
author | Damjan Marion <damarion@cisco.com> | 2018-08-27 15:59:30 +0200 |
---|---|---|
committer | Damjan Marion <damarion@cisco.com> | 2018-08-27 16:00:17 +0200 |
commit | 33ed3e4c7d0fa1335642ad45e4e52c7ba15cded6 (patch) | |
tree | 1e31042e398c19a4dba078f248d296823f1419f5 | |
parent | 917dc3b39dca1ddd0b268076d02cf15cf3e3de0c (diff) |
cmake: fix clang build and few minor fixes
Change-Id: If5b850c939f7a5383f9a7eff8ac41708c3428a90
Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r-- | src/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/cmake/cpu.cmake | 8 | ||||
-rw-r--r-- | src/vpp-api/vapi/CMakeLists.txt | 3 |
3 files changed, 11 insertions, 5 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ae710077bbb..8757053af64 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -30,6 +30,11 @@ set(CMAKE_C_FLAGS_COMMON "-DFORTIFY_SOURCE=2 -fstack-protector-all -Werror") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${CMAKE_C_FLAGS_COMMON} -DCLIB_DEBUG") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${CMAKE_C_FLAGS_COMMON}") +check_c_compiler_flag("-Wno-address-of-packed-member" compiler_flag_no_address_of_packed_member) +if (compiler_flag_no_address_of_packed_member) + add_definitions(-Wno-address-of-packed-member) +endif() + ############################################################################## # install config ############################################################################## diff --git a/src/cmake/cpu.cmake b/src/cmake/cpu.cmake index 9a0dfdd5bcb..0e1171de3ea 100644 --- a/src/cmake/cpu.cmake +++ b/src/cmake/cpu.cmake @@ -17,12 +17,12 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*") set(CMAKE_C_FLAGS "-march=corei7 -mtune=corei7-avx ${CMAKE_C_FLAGS}") set(VPP_LIB_DIR_NAME lib64) - check_c_compiler_flag("-march=core-avx2" AVX2) - if(AVX2) + check_c_compiler_flag("-march=core-avx2" compiler_flag_march_core_avx2) + if(compiler_flag_march_core_avx2) list(APPEND MARCH_VARIANTS "avx2\;-march=core-avx2 -mtune=core-avx2") endif() - check_c_compiler_flag("-march=skylake-avx512" AVX512) - if(AVX512) + check_c_compiler_flag("-march=skylake-avx512" compiler_flag_march_skylake_avx512) + if(compiler_flag_march_skylake_avx512) list(APPEND MARCH_VARIANTS "avx512\;-march=skylake-avx512 -mtune=skylake-avx512") endif() elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)") diff --git a/src/vpp-api/vapi/CMakeLists.txt b/src/vpp-api/vapi/CMakeLists.txt index 8feb12e3dcf..103e7c50d16 100644 --- a/src/vpp-api/vapi/CMakeLists.txt +++ b/src/vpp-api/vapi/CMakeLists.txt @@ -50,7 +50,7 @@ foreach(f ${VPP_API_FILES}) list(APPEND VAPICLIENT_API_CPP_HEADERS ${output}) endforeach () -add_custom_target(all-vapi-headers ALL DEPENDS +add_custom_target(all-vapi-headers DEPENDS ${VAPICLIENT_API_C_HEADERS} ${VAPICLIENT_API_CPP_HEADERS} ) @@ -61,6 +61,7 @@ add_vpp_library(vapiclient libvapiclient.map LINK_LIBRARIES vppinfra vlibmemoryclient svm pthread m rt + DEPENDS all-vapi-headers ) install( |