代码拉取完成,页面将自动刷新
同步操作将从 谢辉军/c-periphery 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
cmake_minimum_required(VERSION 2.6)
project(periphery C)
option(BUILD_TESTS "Build test programs" ON)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
# Check Linux kernel header files for character device GPIO support
include(CheckSourceCompiles)
check_source_compiles(C "#include <linux/gpio.h>\nint main(void) { GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME; return 0; }" HAVE_GPIO_CDEV_V2)
include(CheckSymbolExists)
check_symbol_exists(GPIO_GET_LINEEVENT_IOCTL linux/gpio.h HAVE_GPIO_CDEV_V1)
if(HAVE_GPIO_CDEV_V2)
set(GPIO_CDEV_SUPPORT 2)
elseif(HAVE_GPIO_CDEV_V1)
set(GPIO_CDEV_SUPPORT 1)
else()
set(GPIO_CDEV_SUPPORT 0)
message(WARNING "Missing character device GPIO support in Linux kernel header files. c-periphery will be built with legacy sysfs GPIO support only.")
endif()
add_definitions(-DPERIPHERY_GPIO_CDEV_SUPPORT=${GPIO_CDEV_SUPPORT})
# Library version
set(VERSION "2.4.2")
set(SOVERSION ${VERSION})
# Glob sources, headers, tests
file(GLOB_RECURSE periphery_SOURCES src/*.c)
file(GLOB_RECURSE periphery_HEADERS src/*.h)
file(GLOB_RECURSE periphery_TESTS tests/*.c)
# Expose git commit id into COMMIT_ID variable
execute_process(
COMMAND git --git-dir="${CMAKE_CURRENT_SOURCE_DIR}/.git" describe --abbrev --always --tags --dirty
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
OUTPUT_VARIABLE COMMIT_ID
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
# Define C flags and include directories
add_definitions(-DPERIPHERY_VERSION_COMMIT="${COMMIT_ID}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -pedantic -Wall -Wextra -Wno-stringop-truncation -fPIC")
set(CMAKE_C_FLAGS_DEBUG "-g")
set(CMAKE_C_FLAGS_RELEASE "-O3")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
# Declare library target
add_library(periphery ${periphery_SOURCES} ${periphery_HEADERS})
set_target_properties(periphery PROPERTIES SOVERSION ${VERSION})
include(GNUInstallDirs)
# Generate pkg-config pc file
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/libperiphery.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libperiphery.pc @ONLY)
# Declare install targets
install(TARGETS periphery DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES ${periphery_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libperiphery.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
# Declare test targets if enabled
if(BUILD_TESTS)
foreach(TEST_SOURCE ${periphery_TESTS})
get_filename_component(TEST_PROGRAM ${TEST_SOURCE} NAME_WE)
add_executable(${TEST_PROGRAM} ${TEST_SOURCE})
target_link_libraries(${TEST_PROGRAM} periphery pthread)
set(TEST_PROGRAMS ${TEST_PROGRAMS} ${TEST_PROGRAM})
endforeach()
add_custom_target(tests DEPENDS periphery ${TEST_PROGRAMS})
endif()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。