Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improves ergonomics when pkg-config is missing and updates docs #171

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ include (GNUInstallDirs)
include (${CMAKE_MODULE_PATH}/platform.cmake)
include (${CMAKE_MODULE_PATH}/ragel.cmake)

find_package(PkgConfig QUIET)
find_package(PkgConfig)

if(NOT PkgConfig_FOUND)
message(STATUS "Could not find pkg-config. Will not generate pkg-config metadata for libhs.")
endif()

if (NOT CMAKE_BUILD_TYPE)
message(STATUS "Default build type 'Release with debug info'")
Expand Down
8 changes: 7 additions & 1 deletion cmake/pcre.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,16 @@ if (PCRE_BUILD_SOURCE)
else ()
# pkgconf should save us
find_package(PkgConfig)
if (NOT PkgConfig_FOUND)
message(STATUS "pkg-config was not found. This is required to dynamically link libpcre.")
return ()
# first check for sqlite on the system
endif ()

pkg_check_modules(PCRE libpcre>=${PCRE_REQUIRED_VERSION})
if (PCRE_FOUND)
set(CORRECT_PCRE_VERSION TRUE)
message(STATUS "PCRE version ${PCRE_REQUIRED_VERSION} or above")
message(STATUS "Found PCRE version ${PCRE_REQUIRED_VERSION} or above")
else ()
message(STATUS "PCRE version ${PCRE_REQUIRED_VERSION} or above not found")
return ()
Expand Down
10 changes: 7 additions & 3 deletions cmake/sqlite3.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
option(SQLITE_PREFER_STATIC "Build sqlite3 statically instead of using an installed lib" OFF)

if(NOT WIN32 AND NOT SQLITE_PREFER_STATIC)
find_package(PkgConfig QUIET)
find_package(PkgConfig)

# first check for sqlite on the system
pkg_check_modules(SQLITE3 sqlite3)
if(NOT PkgConfig_FOUND)
message(STATUS "pkg-config was not found. This is required to dynamically link sqlite3.")
else()
# first check for sqlite on the system
pkg_check_modules(SQLITE3 sqlite3)
endif()
endif()

if (NOT SQLITE3_FOUND)
Expand Down
21 changes: 21 additions & 0 deletions doc/dev-reference/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,27 @@ system (e.g. Debian/Ubuntu/RedHat packages, FreeBSD ports, etc). However,
ensure that the correct version is present. As for Windows, in order to have
Ragel, you may use Cygwin to build it from source.

Optional Dependencies
---------------------

The following dependencies are optional. Their required versions are listed
in the table below.

* pkg-config will be used to generate pkg-config metadata for ``libhs``.
Additionally it must be installed to dynamically link Sqlite and PCRE,
which are build the ``hsbench`` and ``hscollider``.
* Sqlite is required to build the ``hsbench`` benchmarking tool.
* PCRE is required to build the ``hscollider`` tool.

======================================================================= =========== ====================================
Dependency Version Notes
======================================================================= =========== ====================================
`pkg-config <https://www.freedesktop.org/wiki/Software/pkg-config/>`_ N/A
`Sqlite <https://www.sqlite.org/index.html>`_ >=3 Versions 3.8.7-3.8.10 are **not**
compatible.
`PCRE <https://www.pcre.org/>`_ >=8.41
======================================================================= =========== ====================================

Boost Headers
-------------

Expand Down