diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b818f4..8711a23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,10 +5,12 @@ project( LANGUAGES CXX) option(BUILD_TESTS "Build tests" OFF) +option(BUILD_SHARED_LIBS "Build using shared libraries is turned off" OFF) message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") message(STATUS "Build tests: ${BUILD_TESTS}") +set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/README.md b/README.md index d8a6cc1..22b4bf8 100644 --- a/README.md +++ b/README.md @@ -381,5 +381,10 @@ more information. # TODO: - [ ] Add pre built binaries to the github releases + - For static build I used the followig configure command: + ``` + ./configure -static -prefix /home/barts/code/snapshot/3rdparty/Qt/ -submodules qtbase,qtmultimedia,qtwayland -icu + ``` + - [ ] Add an uninstall target? - [ ] Cross compile for raspberry pi diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 31765ea..052d16d 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -1,3 +1,9 @@ add_executable(snapshot main.cpp ${CMAKE_SOURCE_DIR}/resources/resources.qrc) target_link_libraries(snapshot PRIVATE snapshotapp) install(TARGETS snapshot DESTINATION bin) + +set(CPACK_PACKAGE_NAME ${PROJECT_NAME}) +set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) +set(CPACK_GENERATOR "ZIP") + +include(CPack) diff --git a/scripts/install-qt b/scripts/install-qt index f8df6b6..55bbd48 100755 --- a/scripts/install-qt +++ b/scripts/install-qt @@ -1,28 +1,22 @@ #!/usr/bin/env bash set -euo pipefail -usage="Usage: $0 +usage="Usage: $0 Installs Qt 6.6.1 to 3rdparty/Qt. For this script to work, you need to set the QT_INSTALLER_JWT_TOKEN environment variable to your jwt token. Check the website of Qt for more information. +Optionally, you can add more Qt packages to install by adding them as +arguments. + Options: -h, --help Show this help message and exit" -while [[ $# -gt 0 ]]; do - case "$1" in - -h | --help) - echo "$usage" - exit 0 - ;; - *) - echo "Unknown option: $1" - echo "$usage" - exit 1 - ;; - esac -done +if [[ "$*" == *-h* ]] || [[ "$*" == *--help* ]]; then + echo "$usage" + exit 0 +fi tmp_dir=$(mktemp -d) this_dir=$(dirname "$(realpath "${BASH_SOURCE:-$0}")") @@ -32,6 +26,6 @@ multimedia="qt.qt6.661.addons.qtmultimedia" curl "https://d13lb3tujbc8s0.cloudfront.net/onlineinstallers/qt-unified-linux-x64-4.6.1-online.run" -o "$tmp_dir/qt-installer.run" chmod +x "$tmp_dir/qt-installer.run" -"$tmp_dir/qt-installer.run" --root "$install_dir" --accept-licenses --accept-obligations --default-answer --confirm-command install $base $multimedia +"$tmp_dir/qt-installer.run" --root "$install_dir" --accept-licenses --accept-obligations --default-answer --confirm-command install $base $multimedia $@ rm -rf "$tmp_dir" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7285e1b..cbbd4ce 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,8 @@ -list(APPEND CMAKE_PREFIX_PATH ${CMAKE_SOURCE_DIR}/3rdparty/Qt/6.6.1/gcc_64/lib/cmake) +list(APPEND CMAKE_PREFIX_PATH + ${CMAKE_SOURCE_DIR}/3rdparty/Qt/6.6.1/gcc_64/lib/cmake) +list(APPEND CMAKE_PREFIX_PATH ${CMAKE_SOURCE_DIR}/3rdparty/Qt/lib/cmake) +set(Boost_USE_STATIC_LIBS ON) find_package(spdlog REQUIRED) find_package(Boost REQUIRED COMPONENTS filesystem) find_package(Qt6 REQUIRED COMPONENTS Widgets Multimedia MultimediaWidgets) @@ -12,9 +15,9 @@ file(GLOB_RECURSE INCLUDES "${CMAKE_SOURCE_DIR}/include/*") add_library(snapshotapp ${SOURCES} ${INCLUDES}) target_include_directories( snapshotapp - PUBLIC ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/3rdparty/include ${Boost_INCLUDE_DIRS} + PUBLIC ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/3rdparty/include + ${Boost_INCLUDE_DIRS} INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/snapshotapp_autogen/include) target_link_libraries( snapshotapp PUBLIC spdlog::spdlog_header_only Qt6::Widgets Qt6::Multimedia Qt6::MultimediaWidgets Boost::filesystem) -install(TARGETS snapshotapp DESTINATION lib)