mirror of https://github.com/joan2937/pigpio
Merge 0bd209f185
into 3e0a5085f1
This commit is contained in:
commit
aeda1d900c
148
CMakeLists.txt
148
CMakeLists.txt
|
@ -8,41 +8,92 @@ find_package(Threads REQUIRED)
|
||||||
find_package(RT REQUIRED)
|
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(SOCKET_INTERFACE "Build socket interface" ON)
|
||||||
|
option(TESTS "Build tests" OFF)
|
||||||
|
option(PIG2VCD "Build VCD format converter" OFF)
|
||||||
|
option(PYTHON_MODULE "Build Python module" 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)
|
||||||
|
|
||||||
# pig2vcd
|
install(TARGETS pigpiod_if pigpiod_if2 pigpiod pigs
|
||||||
add_executable(pig2vcd pig2vcd.c command.c)
|
EXPORT ${PROJECT_NAME}Targets
|
||||||
target_link_libraries(pig2vcd Threads::Threads)
|
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()
|
||||||
|
|
||||||
|
if(PIG2VCD)
|
||||||
|
# pig2vcd
|
||||||
|
add_executable(pig2vcd pig2vcd.c command.c)
|
||||||
|
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
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Configure and install project
|
# Configure and install project
|
||||||
|
|
||||||
|
@ -51,14 +102,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}
|
||||||
|
@ -88,38 +131,29 @@ install(
|
||||||
${ConfigPackageLocation}
|
${ConfigPackageLocation}
|
||||||
)
|
)
|
||||||
|
|
||||||
install(FILES pigpio.h pigpiod_if.h pigpiod_if2.h
|
if (MAN_PAGES)
|
||||||
DESTINATION include
|
file(GLOB man_1_SRC "*.1")
|
||||||
PERMISSIONS OWNER_READ OWNER_WRITE
|
install(FILES ${man_1_SRC}
|
||||||
GROUP_READ
|
DESTINATION man/man1
|
||||||
WORLD_READ
|
PERMISSIONS OWNER_READ OWNER_WRITE
|
||||||
)
|
GROUP_READ
|
||||||
|
WORLD_READ
|
||||||
|
)
|
||||||
|
|
||||||
file(GLOB man_1_SRC "*.1")
|
file(GLOB man_3_SRC "*.3")
|
||||||
install(FILES ${man_1_SRC}
|
install(FILES ${man_3_SRC}
|
||||||
DESTINATION man/man1
|
DESTINATION man/man3
|
||||||
PERMISSIONS OWNER_READ OWNER_WRITE
|
PERMISSIONS OWNER_READ OWNER_WRITE
|
||||||
GROUP_READ
|
GROUP_READ
|
||||||
WORLD_READ
|
WORLD_READ
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
file(GLOB man_3_SRC "*.3")
|
|
||||||
install(FILES ${man_3_SRC}
|
|
||||||
DESTINATION man/man3
|
|
||||||
PERMISSIONS OWNER_READ OWNER_WRITE
|
|
||||||
GROUP_READ
|
|
||||||
WORLD_READ
|
|
||||||
)
|
|
||||||
|
|
||||||
# Install python modules.
|
# Install python modules.
|
||||||
find_package(Python COMPONENTS Interpreter QUIET)
|
find_package(Python COMPONENTS Interpreter QUIET)
|
||||||
|
|
||||||
if(Python_FOUND)
|
if(Python_FOUND AND PYTHON_MODULE AND SOCKET_INTERFACE)
|
||||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/cmake/setup.py.in
|
install(CODE "execute_process(COMMAND ${Python_EXECUTABLE} ${CMAKE_SOURCE_DIR}/setup.py install --prefix=${CMAKE_INSTALL_PREFIX})")
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/setup.py
|
|
||||||
)
|
|
||||||
|
|
||||||
install(CODE "execute_process(COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/setup.py install)")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# package project
|
# package project
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
from distutils.core import setup
|
|
||||||
|
|
||||||
setup(name='pigpio',
|
|
||||||
version='1.44',
|
|
||||||
author='joan',
|
|
||||||
author_email='joan@abyz.me.uk',
|
|
||||||
maintainer='joan',
|
|
||||||
maintainer_email='joan@abyz.me.uk',
|
|
||||||
url='http://abyz.me.uk/rpi/pigpio/python.html',
|
|
||||||
description='Raspberry Pi GPIO module',
|
|
||||||
long_description='Raspberry Pi Python module to access the pigpio daemon',
|
|
||||||
download_url='http://abyz.me.uk/rpi/pigpio/pigpio.zip',
|
|
||||||
license='unlicense.org',
|
|
||||||
py_modules=['pigpio'],
|
|
||||||
keywords=['raspberrypi', 'gpio',],
|
|
||||||
classifiers=[
|
|
||||||
"Programming Language :: Python :: 2",
|
|
||||||
"Programming Language :: Python :: 3",
|
|
||||||
],
|
|
||||||
package_dir={ '': '${CMAKE_CURRENT_SOURCE_DIR}'}
|
|
||||||
)
|
|
||||||
|
|
Loading…
Reference in New Issue