Commit Graph

93 Commits

Author SHA1 Message Date
Peter Wu d10f149161 cmake: fix Windows support
Fix Windows build by defining `ssize_t` when missing and adjusting the
install commands.

Add support for ENABLE_WERROR=1 while at it.

Tested with MSVC 2013 on Windows 7 x64.
2016-03-16 17:33:20 +01:00
Peter Wu 3a2a943fe9 cmake: do not fail without libxml2
Avoid adding a LIBXML2_LIBRARIES-NOTFOUND to the libraries list when it
is not found. Likewise for OpenSSL.
2016-03-16 17:33:10 +01:00
Peter Wu f34971774b cmake: use -std=c++11 instead of -std=gnu+11
Matches autotools behavior. The m4_if logic was misread...
2016-03-16 14:52:42 +01:00
Peter Wu f8a9a21428 cmake: add _U_ and NGHTTP2_NORETURN to config.h
Do not add _U_ and NGHTTP2_NORETURN definitions to the command line,
instead add it to config.h. This matches what autotools does.
2016-03-16 14:25:58 +01:00
Peter Wu 0c49e5d56e cmake: enable assertions by default
Users can disable this by setting -DCMAKE_C_FLAGS=-DNDEBUG or
-DCMAKE_CXX_FLAGS=-DNDEBUG to disable assertions as desired.
2016-03-16 14:10:42 +01:00
Peter Wu b348a02b85 cmake: fix printed C/CXX flags
Build type-specific flags are added before other flags, reflect this in
the output.
2016-03-15 13:58:53 +01:00
Peter Wu 439636c579 cmake: set CMAKE_BUILD_TYPE=RelWithDebInfo by default
NOTE: RelWithDebInfo *disables* assertions by default. To keep
assertions, use CMAKE_BUILD_TYPE=Debug or CMAKE_BUILD_TYPE=None.
2016-03-15 13:40:15 +01:00
Peter Wu 2ddb83206b cmake: sync with v1.8.0-63-g37b09f6
Adds missing source files and configure.ac changes since
v1.7.0-93-g093eb51.
2016-03-14 17:20:37 +01:00
Peter Wu dad222b8f4 cmake: fix jemalloc, libevent include dirs
Caught with cmake --warn-uninitialized.
2016-03-13 16:42:35 +01:00
Peter Wu a45540fd79 Lower libev version requirement
libev 4.11 seems to build fine as demonstrated by Travis with autotools.
2016-03-13 13:15:50 +01:00
Peter Wu 618073e2b4 cmake: add "check" target
Add a "check" target that builds tests before running them.
2016-03-12 00:57:30 +01:00
Peter Wu 9ab5ef3b5b cmake: make find_package non-QUIET
Also fix useless MRUBY_LIBRARIES output and add the CMake build type
(e.g. Release, Debug, etc.)
2016-02-16 16:29:39 +01:00
Peter Wu 4814d14db5 cmake: fix installing nghttp2_asio.pc, manpages, README.rst 2016-02-16 16:25:50 +01:00
Peter Wu 77e8190b6c cmake: fix symbol visibility issues
libnghttp2.so was missing -fvisibility=hidden. libnghttp2_asio.so on the
other hand had hidden visibility which resulted in no exported symbols
and a broken asio client examples.

Just build a static nghttp2 library to solve this issue.
2016-02-16 16:04:01 +01:00
Peter Wu f4b2a4ab00 cmake: always enable warnings without -Werror
Warnings are useful, let's enable them by default.
2016-02-16 14:57:05 +01:00
Peter Wu 3dd57e1f59 cmake: fix feature availability reporting
Some detected libraries were not reported when a feature is disabled.
This change removes unnecessary second find_package calls and sets
HAVE_xxx immediately based on xxx_FOUND.
2016-02-16 14:01:44 +01:00
Peter Wu 1b67b2d33e cmake: improve Spdylay detection
Auto-detect spdylay availability using CMake, making pkg-config
completely optional.
2016-02-16 12:48:36 +01:00
Peter Wu 9bc6dc7113 cmake: add python support
FindCython.cmake was taken from
https://github.com/thewtex/cython-cmake-example. The UseCython module
works, but since it is lacking an installation target setup.py will be
used instead.
2016-02-16 12:17:49 +01:00
Peter Wu f407f7f406 cmake: add mruby support, fix tests dir
mruby is always invoked now (mirrors the autotools behavior). It could
be optimized though to only trigger the mruby build when the static
library is missing.

Also fix typo in NGHTTP2_TESTS_DIR macro definition (detected when
invoking the Ninja generator).
2016-02-15 23:14:27 +01:00
Peter Wu 8c46d9181f cmake: process tests directory
Split the nghttp2 library into objects and a shared library from those
objects. This is needed because of symbol visibility. An advantage over
the autotools build is that there are no worries about static versus
static library builds.

Test:

    cmake $srcdir
    make nghttpx-unittest main failmalloc
    make test
2016-02-15 01:57:13 +01:00
Peter Wu cc92ebf471 cmake: add auto-detection, improve library search
Add auto-detection to the most important features (app, hpack, etc.).
Move options to a separate file for easier search.

Add cmake-based Libevent, jansson and CUnit search. Move pkg-config
handling for Libev and jemalloc to their cmake files.

Note: duplicates find_package before including CMakeOptions.txt and when
checking for features. Maybe that can be cleaned up later...
2016-02-15 01:12:07 +01:00
Peter Wu c96cf1b303 cmake: improve final variable list
Remove build/host/target by a single target system name (CMake is
different for cross-compiling, you are suggested to set
CMAKE_TOOLCHAIN_FILE).

Fix various library variables, remove CFLAGS (INCLUDE_DIRS could be used
instead though, but I consider that minor information that could be
added later if wanted).

Fix various variable names (prefix, boost, etc.).
2016-02-14 13:22:32 +01:00
Peter Wu 503f0a29a7 cmake: add integration-tests 2016-02-13 20:13:43 +01:00
Peter Wu ee285fa5da cmake: process script/ 2016-02-13 20:13:43 +01:00
Peter Wu 8c562bd38d cmake: process contrib/ 2016-02-13 20:13:43 +01:00
Peter Wu 15adc23277 cmake: working doc (sphinx-build), out-of-tree! 2016-02-13 20:13:43 +01:00
Peter Wu a2ec695ec9 cmake: add python stub
Might not be the best approach, maybe use thewtex/cython-cmake-example?
2016-02-13 20:13:43 +01:00
Peter Wu 55b270587b cmake: build examples 2016-02-13 20:13:43 +01:00
Peter Wu 5297136bc0 cmake: use PRIVATE instead of PUBLIC
Avoids leaking compile flags to dependents.
2016-02-13 20:13:43 +01:00
Peter Wu 61bb6428fd cmake: add third-party and src
Remaining work:
 - integrate mruby and neverbleed
 - integrate cunit
2016-02-13 20:13:42 +01:00
Peter Wu ccd2d34160 cmake: Install headers 2016-02-13 20:13:42 +01:00
Peter Wu ea6eed10c7 cmake: fix version in soname 2016-02-13 20:13:42 +01:00
Peter Wu 7a86758edb cmake: Fix libnghttp2.pc paths
Must be absolute instead of relative
2016-02-13 20:13:42 +01:00
Peter Wu 90d66ea4a9 cmake: fix detection of -Werror flag
Do not use minus sign in macro names.
2016-02-13 20:13:42 +01:00
Peter Wu 5b21c39bb2 cmake: add lib, add versioning info, install lib
Also remove some headers which were not checked anyway and add macros to
cmakeconfig.h.in (based on the headers list in the CMakeLists.txt file).
2016-02-13 20:13:42 +01:00
Peter Wu 744e80d579 cmake: Fill in auto-tools compatible paths 2016-02-13 20:13:42 +01:00
Peter Wu 3842fe175c cmake: attempt to get diagnostic output right 2016-02-13 20:13:42 +01:00
Peter Wu 900667a998 cmake: moar .in file via configure_file 2016-02-13 20:13:42 +01:00
Peter Wu 147e098827 cmake: test for warning flags 2016-02-13 20:13:42 +01:00
Peter Wu 5819d03c68 cmake: more functions
AC_CHECK_TYPES and AC_C_BIGENDIAN were removed because nothing checks
the resulting macros...
2016-02-13 20:13:42 +01:00
Peter Wu 90f5bf796d cmake: check more headers and sizeof 2016-02-13 20:13:42 +01:00
Peter Wu 2b63980758 cmake: more dependency checks 2016-02-13 20:13:42 +01:00
Peter Wu 65d33c553c CMake WIP
Not working:
 - option(... check)
 - not finished everything (see XXX and FIXME)
 - still halway converting
2016-02-13 20:13:42 +01:00