xref: /libbtbb/python/pcaptools/CMakeLists.txt (revision c88a18d946b2ca65916ee429b75c184792bbbbeb)
1# Copyright 2013 Dominic Spill
2#
3# This file is part of Libbtbb (pcapdump)
4#
5# GNU Radio is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2, or (at your option)
8# any later version.
9#
10# GNU Radio is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with GNU Radio; see the file COPYING.  If not, write to
17# the Free Software Foundation, Inc., 51 Franklin Street,
18# Boston, MA 02110-1301, USA.
19
20set(SETUP_PY_IN ${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in)
21set(SETUP_PY    ${CMAKE_CURRENT_BINARY_DIR}/setup.py)
22set(DEPS        ${CMAKE_CURRENT_SOURCE_DIR}/pcapdump/__init__.py
23                ${CMAKE_CURRENT_SOURCE_DIR}/pcapdump/pcapdump.py)
24set(OUTPUT      ${CMAKE_CURRENT_BINARY_DIR}/build)
25
26configure_file(${SETUP_PY_IN} ${SETUP_PY})
27
28add_custom_command(OUTPUT ${OUTPUT}/timestamp
29                   COMMAND ${PYTHON_EXECUTABLE} setup.py build
30                   COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT}/timestamp
31                   DEPENDS ${DEPS})
32
33add_custom_target(pcapdump ALL DEPENDS ${OUTPUT}/timestamp)
34install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} build -b ${OUTPUT} install --prefix=${CMAKE_INSTALL_PREFIX})")
35
36add_custom_target(btaptap ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/btaptap)
37install(PROGRAMS btaptap DESTINATION ${INSTALL_DEFAULT_BINDIR})
38
39