AW-Security-Media-Lib/CMakeLists.txt

89 lines
3.2 KiB
CMake
Raw Normal View History

2022-09-18 03:35:35 +08:00
cmake_minimum_required(VERSION 3.9)
project(SecMedia VERSION 0.0.1 DESCRIPTION "Security Media Package")
2022-09-18 03:57:32 +08:00
set(CMAKE_CXX_STANDARD 11)
2022-09-18 03:35:35 +08:00
2022-09-18 05:14:38 +08:00
if(${CMAKE_BUILD_TYPE} MATCHES "Release")
message(STATUS "Release版本")
set(BuildType "Release")
add_definitions(-DNDEBUG)
add_definitions(-DDEBUG_LOG)
elseif(${CMAKE_BUILD_TYPE} MATCHES "MinSizeRel")
message(STATUS "MinSizeRel版本")
set(BuildType "MinSizeRel")
else()
set(BuildType "Debug")
message(STATUS "Debug版本")
add_definitions(-DDEBUG_LOG)
add_definitions(-DNDEBUG)
endif()
2022-09-18 03:35:35 +08:00
SET(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/release/lib)
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/release/out)
set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_C_FLAGS$ "${CMAKE_C_FLAGS} -fvisibility = hidden")
set(CMAKE_CXX_FLAGS$ "${CMAKE_CXX_FLAGS} -fvisibility = hidden")
2023-03-14 04:30:54 -06:00
set(SecMedia_Root ${CMAKE_CURRENT_SOURCE_DIR}/src)
2022-09-18 03:35:35 +08:00
add_compile_options(-fPIC)
add_compile_options(-fvisibility=hidden)
2022-09-18 04:59:50 +08:00
#add_compile_options(-std=c++11)
2023-03-14 04:30:54 -06:00
#add_compile_options(-mcpu=cortex-a7 -mfloat-abi=softfp -mfpu=neon-vfpv4 -mno-unaligned-access -fno-aggressive-loop-optimizations -Wcast-align)
2022-09-18 03:35:35 +08:00
include(GNUInstallDirs)
include(GenerateExportHeader)
2023-03-14 04:30:54 -06:00
include_directories(${SecMedia_Root}/SVAC/src/svac_src)
#添加svac解密
aux_source_directory(${SecMedia_Root}/SVAC/src/sm2sm3 src_DEC)
aux_source_directory(${SecMedia_Root}/SVAC/src/svac_src src_DEC)
add_library(SVAC_DEC STATIC ${src_DEC})
#添加svac加密
#include_directories(${DEC_ENC_Algorithm}/SVAC/svac_enc)
#file(GLOB src_DEC_ENC ${DEC_ENC_Algorithm}/SVAC/svac_enc/*/*.c ${DEC_ENC_Algorithm}/SVAC/svac_enc/*/*.h)
aux_source_directory(${SecMedia_Root}/SVAC/src/sm2sm3_enc src_ENC)
aux_source_directory(${SecMedia_Root}/SVAC/src/svac_src src_ENC)
add_library(SVAC_ENC STATIC ${src_ENC})
list(APPEND LINK_LIB_SVAC_LIST SVAC_DEC)
list(APPEND LINK_LIB_SVAC_LIST SVAC_ENC)
2022-09-18 03:35:35 +08:00
include_directories(include src)
2022-09-18 04:18:06 +08:00
# add_definitions(-DGENERATE_EXPORT)
2022-09-18 03:35:35 +08:00
2023-03-14 04:30:54 -06:00
#file(GLOB SecMedia_src_list ${SecMedia_Root}/SVAC/./*.c ${SecMedia_Root}/SVAC/./*.h)
file(GLOB SecMedia_src_list ${SecMedia_Root}/*/*.cpp ${SecMedia_Root}/*/*.h ${SecMedia_Root}/*/*.c ${SecMedia_Root}/*/*/*.cpp ${SecMedia_Root}/*/*/*.h ${SecMedia_Root}/*/*/*.c)
file(GLOB SecMedia_api_list ${CMAKE_CURRENT_SOURCE_DIR}/include/common.h)
2022-09-18 03:35:35 +08:00
2023-03-14 04:30:54 -06:00
# # target_compile_options(${PROJECT_NAME} PRIVATE -fvisibility=hidden)
2022-09-18 03:35:35 +08:00
2023-03-14 04:30:54 -06:00
#add_library(${PROJECT_NAME} SHARED ${SecMedia_src_list})
2023-04-09 20:16:03 -06:00
add_library(${PROJECT_NAME} STATIC ${SecMedia_src_list})
2023-03-14 04:30:54 -06:00
target_link_libraries(${PROJECT_NAME} ${LINK_LIB_SVAC_LIST})
target_include_directories(${PROJECT_NAME} PRIVATE ${SecMedia_Root}/.)
2022-09-18 03:35:35 +08:00
2023-03-14 04:30:54 -06:00
set_target_properties(${PROJECT_NAME} PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION 1
PUBLIC_HEADER ${SecMedia_api_list}
)
# CXX_VISIBILITY_PRESET hidden
# CMAKE_C_FLAGS hidden)
2022-09-18 03:35:35 +08:00
2023-03-14 04:30:54 -06:00
list(APPEND LINK_LIB_LIST ${PROJECT_NAME})
#set(LINK_LIB_LIST )
2022-09-18 03:35:35 +08:00
#MESSAGE(STATUS ${SecMedia_api_list})
#configure_file(SecMedia.pc.in SecMedia.pc @ONLY)
# install(TARGETS ${PROJECT_NAME}
# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
# PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
# install(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc
# DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)
2022-09-18 04:59:50 +08:00
2023-03-14 04:30:54 -06:00
2022-09-18 04:59:50 +08:00
2022-09-18 03:35:35 +08:00
add_subdirectory(test)