From c39508371addcb3e3f556e9fb2b7add0b5217546 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Wed, 20 May 2020 11:28:19 +0000 Subject: [PATCH 1/4] build: fix CLI where readline headers aren't in default search path -- Found Readline: /usr/local/include -- Performing Test READLINE_NO_CURSES_TEST -- Performing Test READLINE_NO_CURSES_TEST - Failed -- readline test failed - some systems expect you to link with termcap or curses libraries -- please find an example there: https://bugzilla.redhat.com/show_bug.cgi?id=499837 -- trying to find and link curses library... -- Found Curses: /usr/lib/libcurses.so -- Performing Test READLINE_CURSES_TEST -- Performing Test READLINE_CURSES_TEST - Failed CMake Warning at cli/CMakeLists.txt:46 (message): no readline library found, using stub /usr/bin/cc -DREADLINE_NO_CURSES_TEST -fPIE -o CMakeFiles/cmTC_2e5b8.dir/src.c.o -c src.c src.c:3:10: fatal error: 'readline/readline.h' file not found #include ^~~~~~~~~~~~~~~~~~~~~ /usr/bin/c++ -DHAVE_LIBMAGIC -DMTPZ_ENABLED -DUSB_BACKEND_LIBUSB -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -I../ -I../mtp/backend/posix -I../mtp/backend/libusb -isystem ../cli/Readline_INCLUDE_DIR -O3 -DNDEBUG -fPIE -Wall -pthread -std=gnu++11 -MD -MT cli/CMakeFiles/aft-mtp-cli.dir/CommandLine.cpp.o -MF cli/CMakeFiles/aft-mtp-cli.dir/CommandLine.cpp.o.d -o cli/CMakeFiles/aft-mtp-cli.dir/CommandLine.cpp.o -c ../cli/CommandLine.cpp ../cli/CommandLine.cpp:26:10: fatal error: 'readline/readline.h' file not found #include ^~~~~~~~~~~~~~~~~~~~~ --- cli/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cli/CMakeLists.txt b/cli/CMakeLists.txt index 90ba4a2c..e02bce2a 100644 --- a/cli/CMakeLists.txt +++ b/cli/CMakeLists.txt @@ -9,6 +9,7 @@ set(CLI_SOURCES cli.cpp) if (READLINE_FOUND) + set(CMAKE_REQUIRED_INCLUDES ${Readline_INCLUDE_DIR}) set(CMAKE_REQUIRED_LIBRARIES ${Readline_LIBRARY}) set(READLINE_TEST_SRC " #include @@ -35,6 +36,7 @@ int main(int argc, char **argv) { endif() endif() + set(CMAKE_REQUIRED_INCLUDES) set(CMAKE_REQUIRED_LIBRARIES) endif() @@ -47,6 +49,7 @@ else() endif() add_executable(aft-mtp-cli ${CLI_SOURCES}) +target_include_directories(aft-mtp-cli SYSTEM PRIVATE ${Readline_INCLUDE_DIR}) target_link_libraries(aft-mtp-cli ${MTP_LIBRARIES} ${CLI_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) install(TARGETS aft-mtp-cli RUNTIME DESTINATION bin) From 2b21953c8886841fb8371e9d83d90f811c4ce0e2 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Wed, 20 May 2020 11:19:30 +0000 Subject: [PATCH 2/4] build: fix BUILD_PYTHON where pybind11 is a separate package -- Looking for include file pybind11/pybind11.h -- Looking for include file pybind11/pybind11.h - not found CMake Warning at CMakeLists.txt:64 (message): pybind11 not found, skipping python bindings /usr/bin/c++ -I/usr/local/include/python3.7m -fPIE -o CMakeFiles/cmTC_43052.dir/pybind11_FOUND.cpp.o -c build/CMakeFiles/CheckIncludeFiles/pybind11_FOUND.cpp build/CMakeFiles/CheckIncludeFiles/pybind11_FOUND.cpp:2:10: fatal error: 'pybind11/pybind11.h' file not found #include ^~~~~~~~~~~~~~~~~~~~~ --- CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eca82da7..258a2371 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,8 +56,12 @@ endif() if (PYTHON_FOUND) set(CMAKE_POSITION_INDEPENDENT_CODE ON) - set(CMAKE_REQUIRED_INCLUDES ${Python_INCLUDE_DIRS}) - check_include_files("pybind11/pybind11.h" pybind11_FOUND LANGUAGE CXX) + find_package(pybind11) + if (NOT pybind11_FOUND) + set(CMAKE_REQUIRED_INCLUDES ${Python_INCLUDE_DIRS}) + check_include_files("pybind11/pybind11.h" pybind11_FOUND LANGUAGE CXX) + set(CMAKE_REQUIRED_INCLUDES) + endif() if (pybind11_FOUND) add_subdirectory(python) else() From 4e4f0920bd91b0d162a121ae7b09a4b7e65f24dc Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Wed, 20 May 2020 10:53:25 +0000 Subject: [PATCH 3/4] CI: add FreeBSD job --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index c9a6c4f5..73f61485 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,8 @@ matrix: include: - os: linux compiler: gcc + - os: freebsd + compiler: clang - os: osx osx_image: xcode10.1 compiler: clang @@ -15,6 +17,8 @@ install: - | if [ "${TRAVIS_OS_NAME}" = "linux" ]; then sudo apt-get -y install qt5-default libfuse-dev libmagic-dev libtag1-dev libssl-dev + elif [ "${TRAVIS_OS_NAME}" = "freebsd" ]; then + sudo pkg install -y ninja qt5-qmake qt5-buildtools qt5-widgets fusefs-libs pybind11 taglib elif [ "${TRAVIS_OS_NAME}" = "osx" ]; then brew tap homebrew/cask && brew install qt5 homebrew/cask/osxfuse taglib openssl@1.1 fi @@ -32,6 +36,9 @@ script: export VERSION=$(git rev-parse --short HEAD) && ./linuxdeployqt-continuous-x86_64.AppImage appdir/usr/share/applications/*.desktop -bundle-non-qt-libs && ./linuxdeployqt-continuous-x86_64.AppImage appdir/usr/share/applications/*.desktop -appimage + elif [ "${TRAVIS_OS_NAME}" = "freebsd" ]; then + cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DUSB_BACKEND_LIBUSB=YES + cmake --build build elif [ "${TRAVIS_OS_NAME}" = "osx" ]; then mkdir build && cd build && From 932259449258c759585a6a22a37f664aa6b0e51e Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Wed, 20 May 2020 11:16:24 +0000 Subject: [PATCH 4/4] CI: add dependency for python module on macOS --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 73f61485..04d258d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ install: elif [ "${TRAVIS_OS_NAME}" = "freebsd" ]; then sudo pkg install -y ninja qt5-qmake qt5-buildtools qt5-widgets fusefs-libs pybind11 taglib elif [ "${TRAVIS_OS_NAME}" = "osx" ]; then - brew tap homebrew/cask && brew install qt5 homebrew/cask/osxfuse taglib openssl@1.1 + brew tap homebrew/cask && brew install qt5 homebrew/cask/osxfuse pybind11 taglib openssl@1.1 fi script: