epubgrep/CMakeLists.txt
tastytea 00e3edb9f2
Only search files in spine, in the right order.
The spine lists all content documents in their linear reading order. So we're
finally getting our results in the right order! 🎉

Since we skip the images and fonts, which usually make up the most bytes in an
EPUB file, the performance increase is immense. I measured 60-70% in a very
short test.

Closes: #1
2021-05-29 17:34:43 +02:00

55 lines
1.5 KiB
CMake

cmake_minimum_required(VERSION 3.12...3.18)
# Global build options.
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "The type of build.")
set(XGETTEXT_CMD "xgettext" CACHE STRING "The command for xgettext.")
project(epubgrep
VERSION 0.3.2
DESCRIPTION "Search tool for EPUB e-books"
HOMEPAGE_URL "https://schlomp.space/tastytea/epubgrep"
LANGUAGES CXX)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
# Project build options.
option(WITH_TESTS "Compile tests." NO)
option(FALLBACK_BUNDLED "Fall back to bundled libs." YES)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
include(cmake/debug_flags.cmake)
# All dependencies except test dependencies.
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
find_package(Boost 1.65.0 REQUIRED COMPONENTS locale program_options regex)
find_package(Gettext REQUIRED)
find_package(Filesystem REQUIRED COMPONENTS Final Experimental)
find_package(LibArchive 3.2 REQUIRED)
find_package(fmt 4 REQUIRED CONFIG)
find_package(termcolor CONFIG)
if(NOT termcolor_FOUND)
if(FALLBACK_BUNDLED)
message(STATUS "Using bundled version of Termcolor.")
add_subdirectory(dist/termcolor EXCLUDE_FROM_ALL)
else()
message(FATAL_ERROR "Termcolor was not found.")
endif()
endif()
find_package(Threads REQUIRED)
find_package(pugixml 1 REQUIRED CONFIG)
add_subdirectory(src)
if(WITH_TESTS)
add_subdirectory(tests)
endif()
add_subdirectory(translations)
add_subdirectory(man)
include(cmake/packages.cmake)