2014-11-18 06:01:24 -07:00
|
|
|
cmake_minimum_required(VERSION 2.8.7)
|
|
|
|
project(NEOVIM)
|
2014-01-31 06:39:15 -07:00
|
|
|
|
2014-02-24 13:54:45 -07:00
|
|
|
# Point CMake at any custom modules we may ship
|
2014-11-10 17:26:01 -07:00
|
|
|
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
2014-02-24 13:54:45 -07:00
|
|
|
|
2014-03-03 08:09:06 -07:00
|
|
|
# Prefer our bundled versions of dependencies.
|
2014-12-11 10:17:20 -07:00
|
|
|
set(DEPS_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/.deps/usr" CACHE PATH "Path prefix for finding dependencies")
|
|
|
|
list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX})
|
2015-02-24 11:59:29 -07:00
|
|
|
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${DEPS_PREFIX}/lib/pkgconfig")
|
2014-03-03 08:09:06 -07:00
|
|
|
|
2014-11-08 14:16:39 -07:00
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
|
|
|
# CMake tries to treat /sw and /opt/local as extension of the system path, but
|
|
|
|
# that doesn't really work out very well. Once you have a dependency that
|
|
|
|
# resides there and have to add it as an include directory, then any other
|
|
|
|
# dependency that could be satisfied from there must be--otherwise you can end
|
|
|
|
# up with conflicting versions. So, let's make them more of a priority having
|
|
|
|
# them be included as one of the first places to look for dependencies.
|
|
|
|
list(APPEND CMAKE_PREFIX_PATH /sw /opt/local)
|
|
|
|
|
|
|
|
# Work around some old, broken detection by CMake for knowing when to use the
|
|
|
|
# isystem flag. Apple's compilers have supported this for quite some time
|
|
|
|
# now.
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
|
|
|
set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
|
|
|
|
endif()
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2014-11-09 05:52:15 -07:00
|
|
|
# Set available build types for CMake GUIs.
|
|
|
|
# A different build type can still be set by -DCMAKE_BUILD_TYPE=...
|
|
|
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
|
|
|
|
STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
|
|
|
|
|
|
|
|
# Set default build type.
|
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
|
|
message(STATUS "CMAKE_BUILD_TYPE not given; setting to 'RelWithDebInfo'.")
|
|
|
|
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build." FORCE)
|
|
|
|
endif()
|
|
|
|
|
2014-10-06 22:45:05 -07:00
|
|
|
# Version tokens
|
2014-10-04 15:32:47 -07:00
|
|
|
include(GetGitRevisionDescription)
|
2014-10-06 22:45:05 -07:00
|
|
|
get_git_head_revision(GIT_REFSPEC NVIM_VERSION_COMMIT)
|
2014-11-05 03:54:15 -07:00
|
|
|
if(NOT NVIM_VERSION_COMMIT)
|
2014-10-15 11:40:18 -07:00
|
|
|
set(NVIM_VERSION_COMMIT "?")
|
|
|
|
endif()
|
2014-10-04 15:32:47 -07:00
|
|
|
set(NVIM_VERSION_MAJOR 0)
|
|
|
|
set(NVIM_VERSION_MINOR 0)
|
|
|
|
set(NVIM_VERSION_PATCH 0)
|
|
|
|
set(NVIM_VERSION_PRERELEASE "-alpha")
|
2014-10-06 22:45:05 -07:00
|
|
|
# TODO(justinmk): UTC time would be nice here #1071
|
|
|
|
git_timestamp(GIT_TIMESTAMP)
|
2014-10-04 15:32:47 -07:00
|
|
|
# TODO(justinmk): do not set this for "release" builds #1071
|
2014-11-05 03:54:15 -07:00
|
|
|
if(GIT_TIMESTAMP)
|
2014-10-15 11:40:18 -07:00
|
|
|
set(NVIM_VERSION_BUILD "+${GIT_TIMESTAMP}")
|
|
|
|
endif()
|
2014-11-09 05:52:15 -07:00
|
|
|
set(NVIM_VERSION_BUILD_TYPE "${CMAKE_BUILD_TYPE}")
|
|
|
|
# NVIM_VERSION_CFLAGS set further below.
|
2014-01-31 06:39:15 -07:00
|
|
|
|
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
|
2014-11-07 04:21:54 -07:00
|
|
|
# Default to -O2 on release builds.
|
|
|
|
string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
|
|
|
|
|
2014-11-18 06:01:24 -07:00
|
|
|
# Enable -Wconversion.
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion")
|
|
|
|
|
2014-11-04 15:06:18 -07:00
|
|
|
# gcc 4.0 and better turn on _FORTIFY_SOURCE=2 automatically. This currently
|
|
|
|
# does not work with Neovim due to some uses of dynamically-sized structures.
|
|
|
|
# See https://github.com/neovim/neovim/issues/223 for details.
|
2014-11-21 01:42:59 -07:00
|
|
|
include(CheckCSourceCompiles)
|
2014-12-16 04:02:42 -07:00
|
|
|
|
|
|
|
# Include the build type's default flags in the check for _FORTIFY_SOURCE,
|
|
|
|
# otherwise we may incorrectly identify the level as acceptable and find out
|
|
|
|
# later that it was not when optimizations were enabled. CFLAGS is applied
|
|
|
|
# even though you don't see it in CMAKE_REQUIRED_FLAGS.
|
|
|
|
set(INIT_FLAGS_NAME CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE})
|
|
|
|
string(TOUPPER ${INIT_FLAGS_NAME} INIT_FLAGS_NAME)
|
|
|
|
if(${INIT_FLAGS_NAME})
|
|
|
|
set(CMAKE_REQUIRED_FLAGS "${${INIT_FLAGS_NAME}}")
|
|
|
|
endif()
|
|
|
|
|
2014-11-21 01:42:59 -07:00
|
|
|
check_c_source_compiles("
|
|
|
|
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 1
|
|
|
|
#error \"_FORTIFY_SOURCE > 1\"
|
|
|
|
#endif
|
|
|
|
int
|
|
|
|
main(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
" _FORTIFY_SOURCE_ACCEPTABLE)
|
|
|
|
|
|
|
|
if(NOT _FORTIFY_SOURCE_ACCEPTABLE)
|
2014-12-12 10:45:21 -07:00
|
|
|
# Extract possible prefix to _FORTIFY_SOURCE (e.g. -Wp,-D_FORTIFY_SOURCE).
|
|
|
|
STRING(REGEX MATCH "[^\ ]+-D_FORTIFY_SOURCE" _FORTIFY_SOURCE_PREFIX "${CMAKE_C_FLAGS}")
|
|
|
|
STRING(REPLACE "-D_FORTIFY_SOURCE" "" _FORTIFY_SOURCE_PREFIX "${_FORTIFY_SOURCE_PREFIX}" )
|
|
|
|
if (NOT _FORTIFY_SOURCE_PREFIX STREQUAL "")
|
|
|
|
message(STATUS "Detected _FORTIFY_SOURCE Prefix=${_FORTIFY_SOURCE_PREFIX}")
|
|
|
|
endif()
|
2014-11-04 15:06:18 -07:00
|
|
|
# -U in add_definitions doesn't end up in the correct spot, so we add it to
|
|
|
|
# the flags variable instead.
|
2014-12-12 10:45:21 -07:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_FORTIFY_SOURCE_PREFIX}-U_FORTIFY_SOURCE ${_FORTIFY_SOURCE_PREFIX}-D_FORTIFY_SOURCE=1")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_FORTIFY_SOURCE_PREFIX}-U_FORTIFY_SOURCE ${_FORTIFY_SOURCE_PREFIX}-D_FORTIFY_SOURCE=1")
|
2014-11-04 15:06:18 -07:00
|
|
|
endif()
|
|
|
|
|
2014-07-13 00:03:07 -07:00
|
|
|
add_definitions(-Wall -Wextra -pedantic -Wno-unused-parameter
|
|
|
|
-Wstrict-prototypes -std=gnu99)
|
2014-05-14 16:08:41 -07:00
|
|
|
|
|
|
|
option(
|
|
|
|
TRAVIS_CI_BUILD "Travis CI build. Extra compilation flags will be set." OFF)
|
|
|
|
|
|
|
|
if(TRAVIS_CI_BUILD)
|
|
|
|
message(STATUS "Travis CI build enabled.")
|
|
|
|
add_definitions(-Werror)
|
|
|
|
endif()
|
2014-02-27 05:27:20 -07:00
|
|
|
|
2014-11-09 04:58:17 -07:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
|
|
|
include(CheckCCompilerFlag)
|
|
|
|
check_c_compiler_flag(-Og HAS_OG_FLAG)
|
|
|
|
else()
|
|
|
|
set(HAS_OG_FLAG 0)
|
|
|
|
endif()
|
|
|
|
|
2014-11-08 04:49:04 -07:00
|
|
|
# Set custom build flags for RelWithDebInfo.
|
|
|
|
# -DNDEBUG purposely omitted because we want assertions.
|
2014-11-09 04:58:17 -07:00
|
|
|
if(HAS_OG_FLAG)
|
2014-11-08 04:49:04 -07:00
|
|
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Og -g"
|
|
|
|
CACHE STRING "Flags used by the compiler during release builds with debug info." FORCE)
|
|
|
|
else()
|
|
|
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g"
|
|
|
|
CACHE STRING "Flags used by the compiler during release builds with debug info." FORCE)
|
|
|
|
endif()
|
2014-05-10 06:24:13 -07:00
|
|
|
|
2014-01-31 06:39:15 -07:00
|
|
|
if(CMAKE_BUILD_TYPE MATCHES Debug)
|
|
|
|
set(DEBUG 1)
|
|
|
|
else()
|
|
|
|
set(DEBUG 0)
|
|
|
|
endif()
|
|
|
|
|
2014-11-08 04:49:04 -07:00
|
|
|
add_definitions(-DINCLUDE_GENERATED_DECLARATIONS)
|
|
|
|
add_definitions(-DHAVE_CONFIG_H)
|
|
|
|
|
2014-05-14 18:14:28 -07:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-undefined")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
|
|
|
|
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined")
|
|
|
|
endif()
|
|
|
|
|
2015-02-23 13:45:11 -07:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_NAME STREQUAL "SunOS")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-undefined -lsocket")
|
|
|
|
endif()
|
|
|
|
|
2014-10-17 03:50:13 -07:00
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
|
|
# Required for luajit.
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS
|
|
|
|
"${CMAKE_EXE_LINKER_FLAGS} -pagezero_size 10000 -image_base 100000000")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS
|
|
|
|
"${CMAKE_SHARED_LINKER_FLAGS} -image_base 100000000")
|
|
|
|
set(CMAKE_MODULE_LINKER_FLAGS
|
|
|
|
"${CMAKE_MODULE_LINKER_FLAGS} -image_base 100000000")
|
|
|
|
endif()
|
|
|
|
|
2014-03-30 04:57:23 -07:00
|
|
|
option(USE_GCOV "Enable gcov support" OFF)
|
|
|
|
|
|
|
|
if(USE_GCOV)
|
|
|
|
message(STATUS "Enabling gcov support")
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage")
|
|
|
|
endif()
|
|
|
|
|
2014-04-03 12:00:43 -07:00
|
|
|
include_directories("${PROJECT_BINARY_DIR}/config")
|
|
|
|
include_directories("${PROJECT_SOURCE_DIR}/src")
|
|
|
|
|
2014-02-26 03:06:59 -07:00
|
|
|
# Modules used by platform auto-detection
|
|
|
|
include(CheckLibraryExists)
|
|
|
|
|
2014-04-03 12:00:43 -07:00
|
|
|
find_package(LibUV REQUIRED)
|
2014-05-15 04:21:13 -07:00
|
|
|
include_directories(SYSTEM ${LIBUV_INCLUDE_DIRS})
|
2014-04-03 12:00:43 -07:00
|
|
|
|
2014-04-10 11:39:34 -07:00
|
|
|
find_package(Msgpack REQUIRED)
|
2014-05-15 04:21:13 -07:00
|
|
|
include_directories(SYSTEM ${MSGPACK_INCLUDE_DIRS})
|
2014-04-10 11:39:34 -07:00
|
|
|
|
2014-04-03 12:00:43 -07:00
|
|
|
find_package(LuaJit REQUIRED)
|
2014-05-15 04:21:13 -07:00
|
|
|
include_directories(SYSTEM ${LUAJIT_INCLUDE_DIRS})
|
2014-04-03 12:00:43 -07:00
|
|
|
|
2015-03-08 14:25:26 -07:00
|
|
|
option(LIBUNIBILIUM_USE_STATIC "Use static libunibilium" ON)
|
2015-02-13 08:06:05 -07:00
|
|
|
find_package(LibUnibilium REQUIRED)
|
|
|
|
include_directories(SYSTEM ${LIBUNIBILIUM_INCLUDE_DIRS})
|
|
|
|
|
2015-03-08 14:25:26 -07:00
|
|
|
option(LIBTERMKEY_USE_STATIC "Use static libtermkey" ON)
|
2015-02-13 08:06:05 -07:00
|
|
|
find_package(LibTermkey REQUIRED)
|
2015-03-14 23:07:06 -07:00
|
|
|
include_directories(SYSTEM ${LIBTERMKEY_INCLUDE_DIRS})
|
2015-02-13 08:06:05 -07:00
|
|
|
|
2015-03-08 14:25:26 -07:00
|
|
|
option(LIBVTERM_USE_STATIC "Use static libvterm" ON)
|
2015-02-28 06:41:53 -07:00
|
|
|
find_package(LibVterm REQUIRED)
|
|
|
|
include_directories(SYSTEM ${LIBVTERM_INCLUDE_DIRS})
|
|
|
|
|
2014-04-03 12:00:43 -07:00
|
|
|
find_package(LibIntl)
|
|
|
|
if(LibIntl_FOUND)
|
2014-11-08 14:09:47 -07:00
|
|
|
include_directories(SYSTEM ${LibIntl_INCLUDE_DIRS})
|
2014-04-03 12:00:43 -07:00
|
|
|
endif()
|
|
|
|
|
2014-11-08 14:18:04 -07:00
|
|
|
find_package(Iconv)
|
|
|
|
if(Iconv_FOUND)
|
|
|
|
include_directories(SYSTEM ${Iconv_INCLUDE_DIRS})
|
2014-04-03 12:00:43 -07:00
|
|
|
endif()
|
|
|
|
|
2014-02-24 11:52:12 -07:00
|
|
|
# Determine platform's threading library. Set CMAKE_THREAD_PREFER_PTHREAD
|
2014-06-25 14:47:27 -07:00
|
|
|
# explicitly to indicate a strong preference for pthread.
|
2014-02-24 11:52:12 -07:00
|
|
|
set(CMAKE_THREAD_PREFER_PTHREAD ON)
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
2014-03-03 08:09:06 -07:00
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
2014-11-30 19:22:46 -07:00
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
2014-02-22 08:30:50 -07:00
|
|
|
|
2014-07-11 04:12:18 -07:00
|
|
|
# Find Lua interpreter
|
2014-07-11 04:12:10 -07:00
|
|
|
include(LuaHelpers)
|
2014-09-16 10:12:58 -07:00
|
|
|
set(LUA_DEPENDENCIES lpeg MessagePack bit)
|
2014-07-11 04:12:18 -07:00
|
|
|
if(NOT LUA_PRG)
|
|
|
|
foreach(CURRENT_LUA_PRG luajit lua)
|
|
|
|
# If LUA_PRG is set find_program() will not search
|
|
|
|
unset(LUA_PRG CACHE)
|
|
|
|
unset(LUA_PRG_WORKS)
|
|
|
|
find_program(LUA_PRG ${CURRENT_LUA_PRG})
|
|
|
|
|
|
|
|
if(LUA_PRG)
|
|
|
|
check_lua_deps(${LUA_PRG} "${LUA_DEPENDENCIES}" LUA_PRG_WORKS)
|
|
|
|
if(LUA_PRG_WORKS)
|
|
|
|
break()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
else()
|
|
|
|
check_lua_deps(${LUA_PRG} "${LUA_DEPENDENCIES}" LUA_PRG_WORKS)
|
|
|
|
endif()
|
2014-04-13 03:06:35 -07:00
|
|
|
|
2014-07-11 04:12:10 -07:00
|
|
|
if(NOT LUA_PRG_WORKS)
|
|
|
|
message(FATAL_ERROR "A suitable Lua interpreter was not found")
|
2014-04-13 03:06:35 -07:00
|
|
|
endif()
|
|
|
|
|
2014-07-11 04:12:10 -07:00
|
|
|
message(STATUS "Using the Lua interpreter ${LUA_PRG}")
|
2014-04-13 03:06:35 -07:00
|
|
|
|
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-19 04:37:22 -07:00
|
|
|
# Setup busted.
|
2014-03-03 08:09:06 -07:00
|
|
|
find_program(BUSTED_PRG busted)
|
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-19 04:37:22 -07:00
|
|
|
if(NOT BUSTED_OUTPUT_TYPE)
|
|
|
|
set(BUSTED_OUTPUT_TYPE "utfTerminal")
|
|
|
|
endif()
|
2014-03-03 08:09:06 -07:00
|
|
|
|
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-19 04:37:22 -07:00
|
|
|
# CMake is painful here. It will create the destination using the user's
|
|
|
|
# current umask, and we don't want that. And we don't just want to install
|
|
|
|
# the target directory, as it will mess with existing permissions. So this
|
|
|
|
# seems like the best compromise. If we create it, then everyone can see it.
|
|
|
|
# If it's preexisting, leave it alone.
|
|
|
|
include(InstallHelpers)
|
|
|
|
|
|
|
|
install_helper(
|
|
|
|
DIRECTORY runtime
|
|
|
|
DESTINATION share/nvim)
|
|
|
|
|
|
|
|
file(GLOB_RECURSE RUNTIME_PROGRAMS
|
|
|
|
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
runtime/*.pl runtime/*.awk runtime/*.sh
|
|
|
|
runtime/tools/ref
|
|
|
|
runtime/tools/vimm)
|
|
|
|
|
|
|
|
foreach(PROG ${RUNTIME_PROGRAMS})
|
|
|
|
get_filename_component(BASEDIR ${PROG} PATH)
|
|
|
|
install_helper(PROGRAMS ${PROG} DESTINATION share/nvim/${BASEDIR})
|
|
|
|
endforeach()
|
|
|
|
|
2014-11-10 17:26:01 -07:00
|
|
|
install(SCRIPT ${PROJECT_SOURCE_DIR}/cmake/GenerateHelptags.cmake)
|
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-19 04:37:22 -07:00
|
|
|
|
|
|
|
# Go down the tree.
|
2014-03-03 08:09:06 -07:00
|
|
|
|
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-19 04:37:22 -07:00
|
|
|
add_subdirectory(src/nvim)
|
2014-11-09 05:52:15 -07:00
|
|
|
# Read compilation flags from src/nvim,
|
|
|
|
# used in config subdirectory below.
|
|
|
|
include(GetCompileFlags)
|
|
|
|
get_compile_flags(NVIM_VERSION_CFLAGS)
|
|
|
|
|
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-19 04:37:22 -07:00
|
|
|
add_subdirectory(test/includes)
|
2014-11-09 05:52:15 -07:00
|
|
|
add_subdirectory(config)
|
2015-02-23 08:34:20 -07:00
|
|
|
add_subdirectory(test/functional/job) # compile pty test program
|
|
|
|
|
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-19 04:37:22 -07:00
|
|
|
|
|
|
|
# Setup some test-related bits. We do this after going down the tree because we
|
|
|
|
# need some of the targets.
|
2014-03-22 04:14:55 -07:00
|
|
|
if(BUSTED_PRG)
|
2014-04-30 02:10:37 -07:00
|
|
|
get_property(TEST_INCLUDE_DIRS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
PROPERTY INCLUDE_DIRECTORIES)
|
2014-07-15 14:35:08 -07:00
|
|
|
|
|
|
|
# Set policy CMP0026 to OLD so we avoid CMake warnings on newer
|
|
|
|
# versions of cmake.
|
|
|
|
if(POLICY CMP0026)
|
|
|
|
cmake_policy(SET CMP0026 OLD)
|
|
|
|
endif()
|
2014-04-30 02:10:37 -07:00
|
|
|
get_target_property(TEST_LIBNVIM_PATH nvim-test LOCATION)
|
|
|
|
|
|
|
|
configure_file(
|
|
|
|
test/config/paths.lua.in
|
|
|
|
${CMAKE_BINARY_DIR}/test/config/paths.lua)
|
|
|
|
|
2014-03-22 04:14:55 -07:00
|
|
|
add_custom_target(unittest
|
|
|
|
COMMAND ${CMAKE_COMMAND}
|
|
|
|
-DBUSTED_PRG=${BUSTED_PRG}
|
2014-04-14 12:46:16 -07:00
|
|
|
-DLUA_PRG=${LUA_PRG}
|
2014-03-22 04:14:55 -07:00
|
|
|
-DWORKING_DIR=${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
-DBUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
|
|
|
|
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
|
2014-04-30 02:10:37 -07:00
|
|
|
-DBUILD_DIR=${CMAKE_BINARY_DIR}
|
2014-09-29 05:43:52 -07:00
|
|
|
-DTEST_TYPE=unit
|
2014-11-10 17:26:01 -07:00
|
|
|
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
2014-03-22 04:14:55 -07:00
|
|
|
DEPENDS nvim-test unittest-headers)
|
2014-09-29 05:43:52 -07:00
|
|
|
|
2014-11-05 03:54:20 -07:00
|
|
|
add_custom_target(functionaltest
|
2014-09-29 05:43:52 -07:00
|
|
|
COMMAND ${CMAKE_COMMAND}
|
2014-10-08 08:56:28 -07:00
|
|
|
-DBUSTED_PRG=${BUSTED_PRG}
|
2014-11-05 05:26:35 -07:00
|
|
|
-DNVIM_PRG=$<TARGET_FILE:nvim>
|
2014-09-29 05:43:52 -07:00
|
|
|
-DWORKING_DIR=${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
-DBUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
|
|
|
|
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
|
|
|
|
-DBUILD_DIR=${CMAKE_BINARY_DIR}
|
|
|
|
-DTEST_TYPE=functional
|
2014-11-10 17:26:01 -07:00
|
|
|
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
2015-02-23 08:34:20 -07:00
|
|
|
DEPENDS nvim tty-test)
|
2014-03-22 04:14:55 -07:00
|
|
|
endif()
|