Commit Graph

258 Commits

Author SHA1 Message Date
Florian Walch
b904c33e41 CMake: Rename target "test" to "functionaltest".
Remove build warning:

    The target name "test" is reserved or not valid for certain CMake
    features, such as generator expressions, and may result in undefined
    behavior.
2014-11-05 11:54:20 +01:00
Florian Walch
5714afc11e CMake: Modify _FORTIFY_SOURCE only for release builds.
Remove build warning for Debug builds:

    # warning _FORTIFY_SOURCE requires compiling with optimization (-O)
2014-11-05 11:54:15 +01:00
John Szakmeister
64ea00299d build: turn down the _FORTIFY_SOURCE level on gcc >= 4.0 2014-11-05 03:53:31 -05:00
John Szakmeister
5e65400c6f Add missing linker flags required for LuaJIT on 64-bit Mac OS X.
This was brought up in #1294.
2014-10-17 06:50:13 -04:00
Thiago de Arruda
69561ea922 test: Remove run-functional-tests.py
Now that the lua client is available, python/lupa are no longer necessary to run
the functional tests. The helper functions previously defined in
run-functional-tests.py were adapted to test/functional/helpers.lua.
2014-10-16 09:21:37 -03:00
Justin M. Keyes
92b17e174f cmake: handle missing git or .git/
GetGitRevisionDescription.cmake: we don't need fine-grained failure
modes, we only need "yes" or "no".

fix #1292
2014-10-15 14:45:42 -04:00
Justin M. Keyes
a1901941f8 version: generate "build number" from commit timestamp
- cmake: git_timestamp() returns last commit time formatted as
  `YYYYMMddHHmm`.
- Always include commit hash in :version and --version output.

`nvim --version` sample output:
  NVIM 0.0.0-alpha+201410070245 (compiled Oct  7 2014 05:30:45)
  Commit: f747b2b1ff7bfe7eb00cc2be82d7af87c98f1111
2014-10-07 10:23:15 +00:00
Justin M. Keyes
2c2fee4d1f version: report commit hash as "build number" in long version string 2014-10-07 10:03:14 +00:00
Thiago de Arruda
42d5b526b9 test: Replace vroom by lua/busted for functional tests
The 'lupa' python package provides a simple way to seamless integrate lua and
python code.

This commit replaces vroom by a python script that exposes the 'neovim' package
to a lua state, and invokes busted to run functional tests. This is a temporary
solution that will enable writing functional tests using lua/bused while a lua
client library is not available.

The reason for dropping vroom is flexibility: Lua/busted has a nice DSL-style
syntax while also providing the customization power of a full programming
language. Another reason is to use a single framework for unit/functional tests.

Two other changes were performed in this commit:

- Instead of "gcc-unittest/gcc-ia32", the travis builds for gcc are now
  identified by "gcc/gcc-32". They will run unit/functional tests for both 64
  and 32 bits.
- Old integration tests(in src/nvim/testdir) are now ran by the 'oldtest' target
2014-09-30 17:37:16 -03:00
John Szakmeister
0d35369324 build: install with the correct permissions
The install() command will create the parent directories, but it does so
with the user's umask.  We want to do our best to make sure the correct
permissions are being set, without clobbering existing permissions.

To do this, this commit introduces an install_helper(), which is similar
in signature to the install() command, to help ensure that directories
are created ahead of the actual install() command.  This will attempt to
use 0644 permissions for files and 0755 permissions for directories by
default--though they can be overridden.

To make this work correctly, without trying to introduce some mechanism
with setting the umask, it meant that there's a small portion that makes
use of an "internal" version of the file() command.  It has been tested
on CMake 2.8.11, 2.8.12, and 3.0.2, and works correctly on all versions.

This fixes #1201 and #1086.
2014-09-22 05:56:52 -04:00
Thiago de Arruda
ddecfb763b deps: Switch lua msgpack library to one that supports 2.0 2014-09-16 14:14:00 -03:00
Florian Walch
0a01b3052e Update busted to 2.0.rc3.
Default to verbose output to show more information in case of errors.
Fix #1031.
2014-09-11 20:03:35 +02:00
Rui Abreu Ferreira
426f906485 Add 'bit' to the list of lua dependencies
- ex_cmds.lua requires the 'bit' module
2014-08-29 05:56:21 -04:00
Florian Walch
1310820e4f CMake: Generate helptags during install step.
Fix #1056.
2014-08-23 09:32:47 -04:00
Joey Gouly
5fffe1ab8e Set the policy to 'OLD' to avoid warning CMP0026 in CMake 3.0. 2014-08-23 09:00:19 -04:00
Rui Abreu Ferreira
718beb2613 Add install target for runtime dir 2014-07-31 08:13:58 -03:00
Pavel Platto
47084ea765 Use strict function prototypes #945
`-Wstrict-prototypes` warn if a function is declared or defined without
specifying the argument types.

This warning disallow function prototypes with empty parameter list.
In C, a function declared with an empty parameter list accepts an
arbitrary number of arguments when being called. This is for historic
reasons; originally, C functions didn't have prototypes, as C evolved
from B, a typeless language. When prototypes were added, the original
typeless declarations were left in the language for backwards
compatibility.
Instead we should provide `void` in argument list to state
that function doesn't have arguments.

Also this warning disallow declaring type of the parameters after the
parentheses because Neovim header generator produce no declarations for
old-stlyle prototypes: it expects to find `{` after prototype.
2014-07-14 20:28:40 +02:00
Rui Abreu Ferreira
5d44f89a8c Check dependencies for each lua interpreter.
- When USE_BUNDLED=OFF and the system has multiple lua interpreters
  (luajit AND lua) it may occur that only the later has the needed
  dependencies (lua-lpeg, lua-cmsgpack). If we pick luajit then
  finding the dependencies FAILS.
- This commit groups detection of the lua interpreter with the lua
  dependencies it tries to find them for both the interpreters and
  choses the first one that has them.

Helped-by: John Szakmeister <john@szakmeister.net>
2014-07-11 19:28:54 -04:00
Rui Abreu Ferreira
6f0d3c0e77 Refactor the lua dependency checking.
This is in preparation for the next step, which is to find a suitable
lua interpreter, rather than just erroring when an interpreter is found
but doesn't have the necessary dependencies.

Helped-by: John Szakmeister <john@szakmeister.net>
2014-07-11 19:28:54 -04:00
Rui Abreu Ferreira
40bc328813 Remove pthread fatal check from CMakeLists.txt #891 2014-06-30 13:37:38 -04:00
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