Commit Graph

72 Commits

Author SHA1 Message Date
John Szakmeister
7b6f705e5f build: probe the compiler to see if we need to turn down _FORTIFY_SOURCE
Some builds don't use Release (such as Gentoo, though it can be told
to).  So let's go a bit further and probe the compiler to see if we need
to turn down the _FORTIFY_SOURCE level.
2014-11-25 20:18:51 -05:00
Florian Walch
96b31ca048 CMake: Set -Wconversion by default. 2014-11-19 17:21:21 +01:00
Rui Abreu Ferreira
2b887ec66b Use cmake --build instead of Make
- If possble try to abstract away from Make, and use cmake --build
- third-party still needs to find Make to build some components
- Removed search for Make from CMakeLists.txt
* for CMake < 3.0 --build has no color output
2014-11-14 14:35:16 +00:00
John Szakmeister
2540155591 build: fix CMAKE_MODULE_PATH usage
Fixes #1447.  `CMAKE_MODULE_PATH` is meant to be a list of directories,
and as such, is not the proper way to launch our scripts.  Let's use
`${PROJECT_SOURCE_DIR}/cmake` instead.  Also, let's not outright set
`CMAKE_MODULE_PATH`, but instead append our location to the list.
2014-11-10 19:26:01 -05:00
Florian Walch
176930fa56 version: Add compilation info. 2014-11-09 18:34:57 +01:00
John Szakmeister
dcccc1a50d Merge pull request #1437 from jszakmeister/build-search-fixes
A few fixes for some build-related issues.
2014-11-09 08:31:33 -05:00
John Szakmeister
d51c0a9471 build: only attempt to use -Og if it's supported
Commit a1d411f9c9 just assumes that gcc
will support the `-Og` option, but gcc that comes with Ubuntu 12.04 does
not.  Let's check to see if the flag is supported, and then decide
whether to enable it or not.
2014-11-09 06:58:17 -05:00
Justin M. Keyes
c9df7ba308 Merge pull request #1383 from fwalch/nvim-buildtype
CMake: Set custom RelWithDebInfo compile flags.
2014-11-08 18:39:12 -05:00
John Szakmeister
9344a40e74 build: pull iconv detection into its own FindIconv.cmake file
This will provide better control for those who may want to alter which
one gets used.
2014-11-08 16:22:35 -05:00
John Szakmeister
203a5166a0 build: give priority to /sw and /opt/local on Mac OS X
Unfortunately, we can't force the specific inclusion of a header file.
So if anything add /opt/local/include to the include path--such as
libintl--then other dependencies might be drawn from /opt/local at
compile time, even though we detected them elsewhere at configure time.
This, in turn, causes issues with mixed versions, such as the iconv.h
header being pulled from /opt/local/include, but linked against the
library in /usr/lib--which can be mismatched versions.

So, despite CMake's best effort to treat /sw and /opt/local as just
another system area, we really need to give them preferential treatment.
To do this, we add them to CMAKE_PREFIX_PATH.

This fixes an issue discovered while re-enabling iconv in #1370.
2014-11-08 16:21:47 -05:00
John Szakmeister
05f78d30ac build: use the proper libintl include variable
What was there worked, but it wasn't meant to be the variable that you
use for inclusion.
2014-11-08 16:11:12 -05:00
Florian Walch
a1d411f9c9 CMake: Set custom RelWithDebInfo compile flags. 2014-11-08 21:54:30 +01:00
John Szakmeister
5d97f3fc2c build: default to using -O2 for release builds
The -O3 optimization level can often lead to dangerous (and sometimes
incorrect) optimizations being performed.  So let's use a level that's
more stable.
2014-11-07 06:21:54 -05:00
John Szakmeister
5ba1d980fb build: fix running of functional tests directly with CMake
If you aren't just building everything into build/, then the functional
tests fail because they can't find the nvim executable.  Let's pass in
the location of the nvim executable, and set NVIM_PRG environment
variable accordingly.
2014-11-05 07:26:35 -05:00
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