mirror of https://github.com/joan2937/pigpio
make socket interface and tests configurable
This commit is contained in:
parent
64c8bfbfc7
commit
d490e04103
|
@ -9,42 +9,88 @@ find_package(RT REQUIRED)
|
||||||
|
|
||||||
option(BUILD_SHARED_LIBS "Create shared libraries" ON)
|
option(BUILD_SHARED_LIBS "Create shared libraries" ON)
|
||||||
option(MAN_PAGES "Create manual pages" OFF)
|
option(MAN_PAGES "Create manual pages" OFF)
|
||||||
|
option(SOCKET_INTERFACE "Build socket interface" ON)
|
||||||
|
option(TESTS "Build tests" OFF)
|
||||||
|
|
||||||
add_compile_options(-Wall)
|
add_compile_options(-Wall)
|
||||||
|
|
||||||
# libpigpio.(so|a)
|
# libpigpio.(so|a)
|
||||||
add_library(pigpio pigpio.c command.c custom.cext)
|
add_library(pigpio pigpio.c command.c custom.cext)
|
||||||
|
|
||||||
# libpigpiod_if.(so|a)
|
install(TARGETS pigpio
|
||||||
add_library(pigpiod_if pigpiod_if.c command.c)
|
EXPORT ${PROJECT_NAME}Targets
|
||||||
|
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||||
|
ARCHIVE DESTINATION lib${LIB_SUFFIX}
|
||||||
|
RUNTIME DESTINATION bin
|
||||||
|
INCLUDES DESTINATION include
|
||||||
|
)
|
||||||
|
|
||||||
# libpigpiod_if2.(so|a)
|
install(FILES pigpio.h
|
||||||
add_library(pigpiod_if2 pigpiod_if2.c command.c)
|
DESTINATION include
|
||||||
|
PERMISSIONS OWNER_READ OWNER_WRITE
|
||||||
|
GROUP_READ
|
||||||
|
WORLD_READ
|
||||||
|
)
|
||||||
|
|
||||||
# x_pigpio
|
if(TESTS)
|
||||||
add_executable(x_pigpio x_pigpio.c)
|
# x_pigpio
|
||||||
target_link_libraries(x_pigpio pigpio RT::RT Threads::Threads)
|
add_executable(x_pigpio x_pigpio.c)
|
||||||
|
target_link_libraries(x_pigpio pigpio RT::RT Threads::Threads)
|
||||||
|
endif()
|
||||||
|
|
||||||
# x_pigpiod_if
|
if(SOCKET_INTERFACE)
|
||||||
add_executable(x_pigpiod_if x_pigpiod_if.c)
|
# libpigpiod_if.(so|a)
|
||||||
target_link_libraries(x_pigpiod_if pigpiod_if RT::RT Threads::Threads)
|
add_library(pigpiod_if pigpiod_if.c command.c)
|
||||||
|
|
||||||
# x_pigpiod_if2
|
# libpigpiod_if2.(so|a)
|
||||||
add_executable(x_pigpiod_if2 x_pigpiod_if2.c)
|
add_library(pigpiod_if2 pigpiod_if2.c command.c)
|
||||||
target_link_libraries(x_pigpiod_if2 pigpiod_if2 RT::RT Threads::Threads)
|
|
||||||
|
|
||||||
# pigpiod
|
# pigpiod
|
||||||
add_executable(pigpiod pigpiod.c)
|
add_executable(pigpiod pigpiod.c)
|
||||||
target_link_libraries(pigpiod pigpio RT::RT Threads::Threads)
|
target_link_libraries(pigpiod pigpio RT::RT Threads::Threads)
|
||||||
|
|
||||||
# pigs
|
# pigs
|
||||||
add_executable(pigs pigs.c command.c)
|
add_executable(pigs pigs.c command.c)
|
||||||
target_link_libraries(pigs Threads::Threads)
|
target_link_libraries(pigs Threads::Threads)
|
||||||
|
|
||||||
|
install(TARGETS pigpiod_if pigpiod_if2 pigpiod pigs
|
||||||
|
EXPORT ${PROJECT_NAME}Targets
|
||||||
|
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||||
|
ARCHIVE DESTINATION lib${LIB_SUFFIX}
|
||||||
|
RUNTIME DESTINATION bin
|
||||||
|
INCLUDES DESTINATION include
|
||||||
|
)
|
||||||
|
|
||||||
|
install(FILES pigpiod_if.h pigpiod_if2.h
|
||||||
|
DESTINATION include
|
||||||
|
PERMISSIONS OWNER_READ OWNER_WRITE
|
||||||
|
GROUP_READ
|
||||||
|
WORLD_READ
|
||||||
|
)
|
||||||
|
|
||||||
|
if(TESTS)
|
||||||
|
# x_pigpiod_if
|
||||||
|
add_executable(x_pigpiod_if x_pigpiod_if.c)
|
||||||
|
target_link_libraries(x_pigpiod_if pigpiod_if RT::RT Threads::Threads)
|
||||||
|
|
||||||
|
# x_pigpiod_if2
|
||||||
|
add_executable(x_pigpiod_if2 x_pigpiod_if2.c)
|
||||||
|
target_link_libraries(x_pigpiod_if2 pigpiod_if2 RT::RT Threads::Threads)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# pig2vcd
|
# pig2vcd
|
||||||
add_executable(pig2vcd pig2vcd.c command.c)
|
add_executable(pig2vcd pig2vcd.c command.c)
|
||||||
target_link_libraries(pig2vcd Threads::Threads)
|
target_link_libraries(pig2vcd Threads::Threads)
|
||||||
|
|
||||||
|
install(TARGETS pig2vcd
|
||||||
|
EXPORT ${PROJECT_NAME}Targets
|
||||||
|
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||||
|
ARCHIVE DESTINATION lib${LIB_SUFFIX}
|
||||||
|
RUNTIME DESTINATION bin
|
||||||
|
INCLUDES DESTINATION include
|
||||||
|
)
|
||||||
|
|
||||||
# Configure and install project
|
# Configure and install project
|
||||||
|
|
||||||
include (GenerateExportHeader)
|
include (GenerateExportHeader)
|
||||||
|
@ -52,14 +98,6 @@ include (CMakePackageConfigHelpers)
|
||||||
|
|
||||||
generate_export_header(${PROJECT_NAME})
|
generate_export_header(${PROJECT_NAME})
|
||||||
|
|
||||||
install(TARGETS pigpio pigpiod_if pigpiod_if2 pig2vcd pigpiod pigs
|
|
||||||
EXPORT ${PROJECT_NAME}Targets
|
|
||||||
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
|
||||||
ARCHIVE DESTINATION lib${LIB_SUFFIX}
|
|
||||||
RUNTIME DESTINATION bin
|
|
||||||
INCLUDES DESTINATION include
|
|
||||||
)
|
|
||||||
|
|
||||||
write_basic_package_version_file(
|
write_basic_package_version_file(
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
|
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
|
||||||
VERSION ${${PROJECT_NAME}_VERSION}
|
VERSION ${${PROJECT_NAME}_VERSION}
|
||||||
|
@ -89,13 +127,6 @@ install(
|
||||||
${ConfigPackageLocation}
|
${ConfigPackageLocation}
|
||||||
)
|
)
|
||||||
|
|
||||||
install(FILES pigpio.h pigpiod_if.h pigpiod_if2.h
|
|
||||||
DESTINATION include
|
|
||||||
PERMISSIONS OWNER_READ OWNER_WRITE
|
|
||||||
GROUP_READ
|
|
||||||
WORLD_READ
|
|
||||||
)
|
|
||||||
|
|
||||||
if (MAN_PAGES)
|
if (MAN_PAGES)
|
||||||
file(GLOB man_1_SRC "*.1")
|
file(GLOB man_1_SRC "*.1")
|
||||||
install(FILES ${man_1_SRC}
|
install(FILES ${man_1_SRC}
|
||||||
|
|
Loading…
Reference in New Issue