Commit Graph

388 Commits

Author SHA1 Message Date
John Szakmeister
3b3811b165 Fix #867: cmake doesn't issue -isystem for versioned gcc
CMake purposefully disables the use of the `-isystem` flag on Apple
platforms, but it's overly blunt with the detection.  Apple's compilers
have supported the flag since at least 10.4.  Let's force the switch to
be on when gcc/g++ is detected on an Apple platform to reduce the
warnings out of the msgpack-related bits.
2014-06-27 06:58:46 -04:00
John Szakmeister
b235793dac Fix #838: build with "USE_BUNDLED=OFF" fails to find dependencies
Stop forcing some platform setting that are really intended to be used
for Travis CI.  Under other systems, like Arch Linux, it prevents
dependencies from being correctly located.
2014-06-27 06:52:59 -04:00
ZyX
70929f7e16 Add automatic generation of headers
- The 'stripdecls.py' script replaces declarations in all headers by includes to
  generated headers.
  `ag '#\s*if(?!ndef NEOVIM_).*((?!#\s*endif).*\n)*#ifdef INCLUDE_GENERATED'`
  was used for this.
- Add and integrate gendeclarations.lua into the build system to generate the
  required includes.
- Add -Wno-unused-function
- Made a bunch of old-style definitions ANSI

This adds a requirement: all type and structure definitions must be present
before INCLUDE_GENERATED_DECLARATIONS-protected include.

Warning: mch_expandpath (path.h.generated.h) was moved manually. So far it is
the only exception.
2014-06-02 11:04:17 -03:00
John Szakmeister
a581173e71 Turn off -Werror by default.
It inteferes with development activities by breaking your build in the
middle of a refactor.  Instead, let's enable -Werror on the Travis CI
builds via a TRAVIS_CI_BUILD option.
2014-05-29 17:37:12 -04:00
Eliseo Martínez
a6734844ca Introduce nvim namespace: Fix build process.
- Leave src as include dir (for includes to recognize 'nvim/' prefix).
- Change subdirectory from src to src/nvim.
- Fix msgpack generation.
- Fix some other paths to new locations.
2014-05-15 20:46:01 +02:00
Thiago de Arruda
ffe61e5ba1 Tell cmake to use -isystem third-party includes
This adds the `SYSTEM` parameter to `include_directories`, which will tell cmake
to use `-isystem` instead of `-I` for specifying include directories. One
advantage is that compilers won't emit warnings for included files that belong
to dependencies.
2014-05-15 08:21:13 -03:00
John Szakmeister
21bd990603 Don't allow undefined references under Linux.
Many other systems expect this already, but on Linux the default is to
allow them.  Let's turn that off.
2014-05-14 21:14:28 -04:00
John Szakmeister
7cb20fd1b0 Generate a lua module to help pass build-related settings.
This allows us to avoid hard-coding paths and using environment
variables to communicate key information to unit tests, which fits
with the overall goal of making sure that folks driving CMake directly
can continue to do out-of-tree builds.
2014-05-03 10:36:54 -04:00
Thiago de Arruda
9f7426ca16 Configure travis to perform a 32-bit build
- Build targeting 32-bit with travis
- Code in `before_install`/`after_success` was moved to travis.sh since it
  provides greater flexibility for detecting the build matrix environment. This
  improves the build speed since we now install only what's necessary.
- Now clint has a dedicated travis worker
2014-04-22 21:55:59 -03:00
Thiago de Arruda
78fd9386b6 Fix unit tests
Apparently busted 1.11.0 is broken(https://github.com/Olivine-Labs/busted/issues/236)
in a way that is causing the unit tests to fail. This pins the version to 1.10.0
and also fixes a wrong variable set when msgpack was added as a dependency
2014-04-14 16:46:16 -03:00
Thiago de Arruda
15f3bae801 Add checks for lpeg/cmsgpack lua packages
These checks will stop the build process with meaningful error messages if
any of those packages are not installed.
2014-04-13 07:32:52 -03:00
Thiago de Arruda
3ee5683a78 Use cmake to find a lua executable
A lua executable is now required for the build process since a lpeg-based script
is used for generating a dispatch function and metadata for the msgpack API
frontend. This removes the need for setting the LUA_BINARY environment variable.
Fixes #518.
2014-04-13 07:32:52 -03:00
Thiago de Arruda
878e6e661d Add cmake module for finding msgpack 2014-04-11 14:07:44 -03:00
Eliseo Martínez
ad48e7c648 Fix #451: Build broken on OSX.
Problem:  Build breaks in OSX if macports ncurses present, due to
          header conflict involving 'term.h'.
Solution: Modify include search order.
2014-04-03 21:00:43 +02:00
aph
7fd140b99a enable coveralls support 2014-04-01 08:06:20 -03:00
John Szakmeister
0efc815216 Append to CMAKE_PREFIX_PATH instead setting it outright.
Also, don't set it in the FindXxx cmake scripts--it's unnecessary, and
it resets the value.
2014-03-28 05:09:45 -04:00
John Szakmeister
7bd4d68d93 Don't require busted.
Only provide the unittest target if busted was found.  And only build
nvim-test if the unittest target exists by excluding nvim-test from all.
Note: this means nvim-test won't be built by default, but it will be
built when you try to run unittests.
2014-03-23 05:42:18 -04:00
John Szakmeister
1eed86883b Deal with the missing dependencies for libuv.
Since libuv.pc is broken at the moment, try to determine libuv's
dependencies ourselves.  This ports most of the checks from libuv into
our CMake build, and fixes the build on other unix platforms.
2014-03-21 15:22:00 -04:00
John Szakmeister
0b2f6a0cf4 Revamp the build system.
This achieves several goals:

 * Less reliance on scripts so we have better portability to Windows
   (though we still have a ways to go for proper Windows support).
   Luajit, luarocks, moonscript, and busted are all installed via CMake
   now.
 * Trying to make use of pkg-config to get the correct libraries.  The
   latest libuv is still broken in this regard, but we'll at least be in
   a position to use it.
 * Allow the use of Ninja or make.  The former runs faster in many
   environments, and automatically makes use of parallel builds.

This also allows for system installed dependencies--though not through
the Makefile just yet--and adds support for FreeBSD.

This also make us build libuv and luajit as static libraries only, since
we're only concerned about having static libraries for our bundled
dependencies.
2014-03-21 15:22:00 -04:00
James McCoy
a86b1a129e Use include paths relative to src/
As described in Google's style guide, the basis for Neovim's

> All of a project's header files should be listed as descendants of the
> project's source directory without use of UNIX directory shortcuts .
> (the current directory) or .. (the parent directory).

Add src as an include directory to facilitate this.
2014-03-14 21:54:32 -03:00
Thiago de Arruda
f6ace9962d Refactor travis build to use clang's sanitizers
- Valgrind configuration removed
- Fix errors reported by the undefined behavior sanitizer
- Travis will now run two build steps:
  - A normal build of a shared library for unit testing(in parallel with gcc)
  - A clang build with some sanitizers enabled for integration testing.

After these changes travis will run much faster, while providing valgrind-like
error detection.
2014-03-13 15:26:28 -03:00
Thiago de Arruda
2f1a2eb0f2 Fix free_all_mem and EXITFREE definition
Because of the '$' in `if(DEFINED $ENV{VALGRIND_CHECK})` EXITFREE wasn't being
defined, so the `free_all_mem` wasn't being included or called in the resulting
binary.

This commit fixes that, and also adds includes needed for `free_all_mem`
compilation.
2014-03-07 11:58:06 -03:00
Gaelan Steele
eb835bc2ca Use -Werror.
This makes all warnings errors. We don't want any warnings, so we should
enforce that.
2014-03-03 08:47:21 -03:00
Nicolas Hillegeer
3f29a02166 MAKE: ask gnulikes to warn and be pedantic + fixes
It seems clang 3.4 thinks the codebase is in fantastic shape and gcc 4.9.0
has only minor niggles, which I fixed:

- fix uninitialized member warning:
    In DEBUG mode the expr member doesn't get properly initialized to NULL.

- fix warnings about directive inside of macro's:
    On some platforms/compilers, sprintf is a macro. Putting macro directives
    inside of a macro is unportable and gcc 4.9 warns about that.

- fix signed vs. unsigned comparison warning:
    The in-memory table will luckily not even come close to the limits imposed
    by ssize_t. If it ever reaches that, we've got bigger problems.
2014-02-28 11:48:43 -03:00
John Szakmeister
ef6933bd60 Setup better warning flags for Clang. 2014-02-28 08:18:24 -03:00
John Szakmeister
fe226f5376 Only include libintl's include dir if libintl was found.
This prevents an error from CMake when libintl is not found.  It's not a
required library, so we must wrap the inclusion in a conditional.  It
was already done for the library.
2014-02-28 08:16:57 -03:00
Alexis Hildebrandt
05b9e11584 CMakeLists: Improve handling of libintl
by refactoring it into a separate CMake module
2014-02-27 19:11:48 +00:00
Alexis Hildebrandt
e728ce95ef Use GNU gettext from homebrew on Mac if available 2014-02-27 19:11:48 +00:00
Rich Wareham
1f827beff0 Use CMAKE_C_FLAGS variable to set compiler flags.
If the compiler is some GNU-alike variant, set the compiler flags to use
the gnu99 dialect of C and enable all warnings.

Non-GNU compilers may have to have their own magic added to set dialect
and enable warnings.

Closes #179.
2014-02-27 12:29:44 +00:00
Thiago de Arruda
cb9a368445 Add configuration to help debug memory leaks 2014-02-26 15:48:26 -03:00
Rich Wareham
de4fbf92d0 link to rt if it provides clock_gettime
As noted in #128, if clock_gettime is provided by librt then it does not
end up being linked into the static libuv.a binary. This might be
considered a bug in libuv but we can address it here.

Detect if librt provides the clock_gettime symbol and, if so, append it
to the list of libraries linked into nvim. On non-librt systems the
behaviour should be as before.
2014-02-26 07:10:21 -03:00
Rich Wareham
e94f933f39 CMakeLists: remove hardcoded .deps directory
We use the standard CMAKE_PREFIX_PATH variable to pass the location of
.deps as a search location on the command line. There is now no need for
explicitly hard-coding it.
2014-02-26 07:09:11 -03:00
Rich Wareham
2a6780431e make use of libuv when found by CMake 2014-02-26 07:09:11 -03:00
Rich Wareham
00ca93fb50 automatically discover libuv in CMake
Idiomatically discover if libuv is installed.
2014-02-26 07:08:44 -03:00
Rich Wareham
809885ea7d add custom CMake module path 2014-02-26 07:08:26 -03:00
Rich Wareham
fd346a95fa use CMake's built in pthread detection
CMake ships with a standard FindThreads module which can be used to a)
test for a threading library and b) confirm that it is pthread. It also
allows the hard-coding of the threading library name to be removed from
``src/CMakeLists.txt``.

Make it an error not to have a pthread library installed and indicate to
CMake that we strongly prefer pthread to any other platform threading
library.
2014-02-24 18:52:12 +00:00
jdiez17
be3ce617c7 Changed binary output directory from src/ to bin/ 2014-02-24 14:45:07 -03:00
Thiago de Arruda
72cf89bce8 Import vim from changeset v5628:c9cad40b4181
- Cleanup source tree, leaving only files necessary for compilation/testing
- Process files through unifdef to remove tons of FEAT_* macros
- Process files through uncrustify to normalize source code formatting.
- Port the build system to cmake
2014-01-31 10:39:15 -03:00