mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #18544 from bfredl/hashyhash
refactor(eval): use Hashy McHashFace instead of gperf
This commit is contained in:
commit
e2d3e73748
@ -614,7 +614,6 @@ endif()
|
|||||||
|
|
||||||
find_program(LUACHECK_PRG luacheck)
|
find_program(LUACHECK_PRG luacheck)
|
||||||
find_program(FLAKE8_PRG flake8)
|
find_program(FLAKE8_PRG flake8)
|
||||||
find_program(GPERF_PRG gperf)
|
|
||||||
|
|
||||||
include(InstallHelpers)
|
include(InstallHelpers)
|
||||||
|
|
||||||
|
@ -185,16 +185,9 @@ if(NOT MSVC)
|
|||||||
set_source_files_properties(
|
set_source_files_properties(
|
||||||
${EXTERNAL_SOURCES} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-conversion -Wno-missing-noreturn -Wno-missing-format-attribute -Wno-double-promotion")
|
${EXTERNAL_SOURCES} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-conversion -Wno-missing-noreturn -Wno-missing-format-attribute -Wno-double-promotion")
|
||||||
|
|
||||||
# gperf generates ANSI-C with incorrect linkage, ignore it.
|
|
||||||
check_c_compiler_flag(-Wstatic-in-inline HAS_WSTATIC_IN_INLINE)
|
|
||||||
if(HAS_WSTATIC_IN_INLINE)
|
|
||||||
set_source_files_properties(
|
|
||||||
eval/funcs.c PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-static-in-inline -Wno-conversion")
|
|
||||||
else()
|
|
||||||
set_source_files_properties(
|
set_source_files_properties(
|
||||||
eval/funcs.c PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-conversion")
|
eval/funcs.c PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-conversion")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT "${MIN_LOG_LEVEL}" MATCHES "^$")
|
if(NOT "${MIN_LOG_LEVEL}" MATCHES "^$")
|
||||||
add_definitions(-DMIN_LOG_LEVEL=${MIN_LOG_LEVEL})
|
add_definitions(-DMIN_LOG_LEVEL=${MIN_LOG_LEVEL})
|
||||||
@ -408,14 +401,9 @@ add_custom_command(OUTPUT ${GENERATED_EX_CMDS_ENUM} ${GENERATED_EX_CMDS_DEFS}
|
|||||||
DEPENDS ${EX_CMDS_GENERATOR} ${CMAKE_CURRENT_LIST_DIR}/ex_cmds.lua
|
DEPENDS ${EX_CMDS_GENERATOR} ${CMAKE_CURRENT_LIST_DIR}/ex_cmds.lua
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT GPERF_PRG)
|
|
||||||
message(FATAL_ERROR "gperf was not found.")
|
|
||||||
endif()
|
|
||||||
add_custom_command(OUTPUT ${GENERATED_FUNCS} ${FUNCS_DATA}
|
add_custom_command(OUTPUT ${GENERATED_FUNCS} ${FUNCS_DATA}
|
||||||
COMMAND ${LUA_PRG} ${FUNCS_GENERATOR}
|
COMMAND ${LUA_PRG} ${FUNCS_GENERATOR}
|
||||||
${CMAKE_CURRENT_LIST_DIR} ${GENERATED_DIR} ${API_METADATA} ${FUNCS_DATA}
|
${CMAKE_CURRENT_LIST_DIR} ${LUA_SHARED_MODULE_SOURCE} ${GENERATED_DIR} ${API_METADATA} ${FUNCS_DATA}
|
||||||
COMMAND ${GPERF_PRG}
|
|
||||||
${GENERATED_DIR}/funcs.generated.h.gperf --output-file=${GENERATED_FUNCS}
|
|
||||||
DEPENDS ${FUNCS_GENERATOR} ${CMAKE_CURRENT_LIST_DIR}/eval.lua ${API_METADATA}
|
DEPENDS ${FUNCS_GENERATOR} ${CMAKE_CURRENT_LIST_DIR}/eval.lua ${API_METADATA}
|
||||||
)
|
)
|
||||||
list(APPEND NVIM_GENERATED_FOR_SOURCES
|
list(APPEND NVIM_GENERATED_FOR_SOURCES
|
||||||
|
@ -80,9 +80,6 @@ typedef enum {
|
|||||||
kSomeMatchStrPos, ///< Data for matchstrpos().
|
kSomeMatchStrPos, ///< Data for matchstrpos().
|
||||||
} SomeMatchType;
|
} SomeMatchType;
|
||||||
|
|
||||||
KHASH_MAP_INIT_STR(functions, VimLFuncDef)
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||||
# include "eval/funcs.c.generated.h"
|
# include "eval/funcs.c.generated.h"
|
||||||
|
|
||||||
@ -134,14 +131,11 @@ char_u *get_function_name(expand_T *xp, int idx)
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while ((size_t)++intidx < ARRAY_SIZE(functions)
|
|
||||||
&& functions[intidx].name[0] == '\0') {}
|
|
||||||
|
|
||||||
if ((size_t)intidx >= ARRAY_SIZE(functions)) {
|
const char *const key = functions[++intidx].name;
|
||||||
|
if (!key) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *const key = functions[intidx].name;
|
|
||||||
const size_t key_len = strlen(key);
|
const size_t key_len = strlen(key);
|
||||||
memcpy(IObuff, key, key_len);
|
memcpy(IObuff, key, key_len);
|
||||||
IObuff[key_len] = '(';
|
IObuff[key_len] = '(';
|
||||||
@ -178,18 +172,19 @@ char_u *get_expr_name(expand_T *xp, int idx)
|
|||||||
/// @param[in] name Name of the function.
|
/// @param[in] name Name of the function.
|
||||||
///
|
///
|
||||||
/// @return pointer to the function definition or NULL if not found.
|
/// @return pointer to the function definition or NULL if not found.
|
||||||
const VimLFuncDef *find_internal_func(const char *const name)
|
const EvalFuncDef *find_internal_func(const char *const name)
|
||||||
FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_PURE FUNC_ATTR_NONNULL_ALL
|
FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_PURE FUNC_ATTR_NONNULL_ALL
|
||||||
{
|
{
|
||||||
size_t len = strlen(name);
|
size_t len = strlen(name);
|
||||||
return find_internal_func_gperf(name, len);
|
int index = find_internal_func_hash(name, len);
|
||||||
|
return index >= 0 ? &functions[index] : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int call_internal_func(const char_u *const fname, const int argcount, typval_T *const argvars,
|
int call_internal_func(const char_u *const fname, const int argcount, typval_T *const argvars,
|
||||||
typval_T *const rettv)
|
typval_T *const rettv)
|
||||||
FUNC_ATTR_NONNULL_ALL
|
FUNC_ATTR_NONNULL_ALL
|
||||||
{
|
{
|
||||||
const VimLFuncDef *const fdef = find_internal_func((const char *)fname);
|
const EvalFuncDef *const fdef = find_internal_func((const char *)fname);
|
||||||
if (fdef == NULL) {
|
if (fdef == NULL) {
|
||||||
return ERROR_UNKNOWN;
|
return ERROR_UNKNOWN;
|
||||||
} else if (argcount < fdef->min_argc) {
|
} else if (argcount < fdef->min_argc) {
|
||||||
@ -207,7 +202,7 @@ int call_internal_method(const char_u *const fname, const int argcount, typval_T
|
|||||||
typval_T *const rettv, typval_T *const basetv)
|
typval_T *const rettv, typval_T *const basetv)
|
||||||
FUNC_ATTR_NONNULL_ALL
|
FUNC_ATTR_NONNULL_ALL
|
||||||
{
|
{
|
||||||
const VimLFuncDef *const fdef = find_internal_func((const char *)fname);
|
const EvalFuncDef *const fdef = find_internal_func((const char *)fname);
|
||||||
if (fdef == NULL) {
|
if (fdef == NULL) {
|
||||||
return ERROR_UNKNOWN;
|
return ERROR_UNKNOWN;
|
||||||
} else if (fdef->base_arg == BASE_NONE) {
|
} else if (fdef->base_arg == BASE_NONE) {
|
||||||
|
@ -9,19 +9,19 @@ typedef void (*FunPtr)(void);
|
|||||||
/// Prototype of C function that implements VimL function
|
/// Prototype of C function that implements VimL function
|
||||||
typedef void (*VimLFunc)(typval_T *args, typval_T *rvar, FunPtr data);
|
typedef void (*VimLFunc)(typval_T *args, typval_T *rvar, FunPtr data);
|
||||||
|
|
||||||
/// Special flags for base_arg @see VimLFuncDef
|
/// Special flags for base_arg @see EvalFuncDef
|
||||||
#define BASE_NONE 0 ///< Not a method (no base argument).
|
#define BASE_NONE 0 ///< Not a method (no base argument).
|
||||||
#define BASE_LAST UINT8_MAX ///< Use the last argument as the method base.
|
#define BASE_LAST UINT8_MAX ///< Use the last argument as the method base.
|
||||||
|
|
||||||
/// Structure holding VimL function definition
|
/// Structure holding VimL function definition
|
||||||
typedef struct fst {
|
typedef struct {
|
||||||
char *name; ///< Name of the function.
|
char *name; ///< Name of the function.
|
||||||
uint8_t min_argc; ///< Minimal number of arguments.
|
uint8_t min_argc; ///< Minimal number of arguments.
|
||||||
uint8_t max_argc; ///< Maximal number of arguments.
|
uint8_t max_argc; ///< Maximal number of arguments.
|
||||||
uint8_t base_arg; ///< Method base arg # (1-indexed), BASE_NONE or BASE_LAST.
|
uint8_t base_arg; ///< Method base arg # (1-indexed), BASE_NONE or BASE_LAST.
|
||||||
VimLFunc func; ///< Function implementation.
|
VimLFunc func; ///< Function implementation.
|
||||||
FunPtr data; ///< Userdata for function implementation.
|
FunPtr data; ///< Userdata for function implementation.
|
||||||
} VimLFuncDef;
|
} EvalFuncDef;
|
||||||
|
|
||||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||||
# include "eval/funcs.h.generated.h"
|
# include "eval/funcs.h.generated.h"
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
local mpack = require('mpack')
|
local mpack = require('mpack')
|
||||||
|
|
||||||
local nvimsrcdir = arg[1]
|
local nvimsrcdir = arg[1]
|
||||||
local autodir = arg[2]
|
local shared_file = arg[2]
|
||||||
local metadata_file = arg[3]
|
local autodir = arg[3]
|
||||||
local funcs_file = arg[4]
|
local metadata_file = arg[4]
|
||||||
|
local funcs_file = arg[5]
|
||||||
|
|
||||||
|
_G.vim = loadfile(shared_file)()
|
||||||
|
|
||||||
if nvimsrcdir == '--help' then
|
if nvimsrcdir == '--help' then
|
||||||
print([[
|
print([[
|
||||||
@ -20,7 +23,9 @@ package.path = nvimsrcdir .. '/?.lua;' .. package.path
|
|||||||
|
|
||||||
local funcsfname = autodir .. '/funcs.generated.h'
|
local funcsfname = autodir .. '/funcs.generated.h'
|
||||||
|
|
||||||
local gperfpipe = io.open(funcsfname .. '.gperf', 'wb')
|
local hashy = require'generators.hashy'
|
||||||
|
|
||||||
|
local hashpipe = io.open(funcsfname, 'wb')
|
||||||
|
|
||||||
local funcs = require('eval').funcs
|
local funcs = require('eval').funcs
|
||||||
local metadata = mpack.unpack(io.open(metadata_file, 'rb'):read("*all"))
|
local metadata = mpack.unpack(io.open(metadata_file, 'rb'):read("*all"))
|
||||||
@ -38,21 +43,15 @@ local funcsdata = io.open(funcs_file, 'w')
|
|||||||
funcsdata:write(mpack.pack(funcs))
|
funcsdata:write(mpack.pack(funcs))
|
||||||
funcsdata:close()
|
funcsdata:close()
|
||||||
|
|
||||||
gperfpipe:write([[
|
|
||||||
%language=ANSI-C
|
|
||||||
%global-table
|
|
||||||
%readonly-tables
|
|
||||||
%define initializer-suffix ,0,0,BASE_NONE,NULL,NULL
|
|
||||||
%define word-array-name functions
|
|
||||||
%define hash-function-name hash_internal_func_gperf
|
|
||||||
%define lookup-function-name find_internal_func_gperf
|
|
||||||
%omit-struct-type
|
|
||||||
%struct-type
|
|
||||||
VimLFuncDef;
|
|
||||||
%%
|
|
||||||
]])
|
|
||||||
|
|
||||||
for name, def in pairs(funcs) do
|
local names = vim.tbl_keys(funcs)
|
||||||
|
|
||||||
|
local neworder, hashfun = hashy.hashy_hash("find_internal_func", names, function (idx)
|
||||||
|
return "functions["..idx.."].name"
|
||||||
|
end)
|
||||||
|
hashpipe:write("static const EvalFuncDef functions[] = {\n")
|
||||||
|
for _, name in ipairs(neworder) do
|
||||||
|
local def = funcs[name]
|
||||||
local args = def.args or 0
|
local args = def.args or 0
|
||||||
if type(args) == 'number' then
|
if type(args) == 'number' then
|
||||||
args = {args, args}
|
args = {args, args}
|
||||||
@ -62,7 +61,10 @@ for name, def in pairs(funcs) do
|
|||||||
local base = def.base or "BASE_NONE"
|
local base = def.base or "BASE_NONE"
|
||||||
local func = def.func or ('f_' .. name)
|
local func = def.func or ('f_' .. name)
|
||||||
local data = def.data or "NULL"
|
local data = def.data or "NULL"
|
||||||
gperfpipe:write(('%s, %s, %s, %s, &%s, (FunPtr)%s\n')
|
hashpipe:write((' { "%s", %s, %s, %s, &%s, (FunPtr)%s },\n')
|
||||||
:format(name, args[1], args[2], base, func, data))
|
:format(name, args[1], args[2], base, func, data))
|
||||||
end
|
end
|
||||||
gperfpipe:close()
|
hashpipe:write(' { NULL, 0, 0, BASE_NONE, NULL, NULL },\n')
|
||||||
|
hashpipe:write("};\n\n")
|
||||||
|
hashpipe:write(hashfun)
|
||||||
|
hashpipe:close()
|
||||||
|
12
third-party/CMakeLists.txt
vendored
12
third-party/CMakeLists.txt
vendored
@ -39,7 +39,6 @@ set(DEPS_DOWNLOAD_DIR "${DEPS_BUILD_DIR}/downloads" CACHE PATH "Dependencies dow
|
|||||||
|
|
||||||
option(USE_BUNDLED "Use bundled dependencies." ON)
|
option(USE_BUNDLED "Use bundled dependencies." ON)
|
||||||
|
|
||||||
option(USE_BUNDLED_GPERF "Use the bundled version of gperf." ${USE_BUNDLED})
|
|
||||||
option(USE_BUNDLED_UNIBILIUM "Use the bundled unibilium." ${USE_BUNDLED})
|
option(USE_BUNDLED_UNIBILIUM "Use the bundled unibilium." ${USE_BUNDLED})
|
||||||
option(USE_BUNDLED_LIBTERMKEY "Use the bundled libtermkey." ${USE_BUNDLED})
|
option(USE_BUNDLED_LIBTERMKEY "Use the bundled libtermkey." ${USE_BUNDLED})
|
||||||
option(USE_BUNDLED_LIBVTERM "Use the bundled libvterm." ${USE_BUNDLED})
|
option(USE_BUNDLED_LIBVTERM "Use the bundled libvterm." ${USE_BUNDLED})
|
||||||
@ -109,10 +108,6 @@ else()
|
|||||||
set(DEPS_C_COMPILER "${CMAKE_C_COMPILER}")
|
set(DEPS_C_COMPILER "${CMAKE_C_COMPILER}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(USE_BUNDLED_GPERF)
|
|
||||||
enable_language(CXX)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER)
|
if(CMAKE_CXX_COMPILER)
|
||||||
set(DEPS_CXX_COMPILER "${CMAKE_CXX_COMPILER}")
|
set(DEPS_CXX_COMPILER "${CMAKE_CXX_COMPILER}")
|
||||||
endif()
|
endif()
|
||||||
@ -176,9 +171,6 @@ set(LUV_SHA256 cabb7e650f35992686eb95ae167c71614e281cd2979fc804e4e70f8051555728)
|
|||||||
set(LUA_COMPAT53_URL https://github.com/keplerproject/lua-compat-5.3/archive/v0.9.tar.gz)
|
set(LUA_COMPAT53_URL https://github.com/keplerproject/lua-compat-5.3/archive/v0.9.tar.gz)
|
||||||
set(LUA_COMPAT53_SHA256 ad05540d2d96a48725bb79a1def35cf6652a4e2ec26376e2617c8ce2baa6f416)
|
set(LUA_COMPAT53_SHA256 ad05540d2d96a48725bb79a1def35cf6652a4e2ec26376e2617c8ce2baa6f416)
|
||||||
|
|
||||||
set(GPERF_URL https://github.com/neovim/deps/raw/ff5b4b18a87397a8564016071ae64f64bcd8c635/opt/gperf-3.1.tar.gz)
|
|
||||||
set(GPERF_SHA256 588546b945bba4b70b6a3a616e80b4ab466e3f33024a352fc2198112cdbb3ae2)
|
|
||||||
|
|
||||||
# cat.exe curl.exe curl-ca-bundle.crt diff.exe tee.exe xxd.exe
|
# cat.exe curl.exe curl-ca-bundle.crt diff.exe tee.exe xxd.exe
|
||||||
set(WINTOOLS_URL https://github.com/neovim/deps/raw/d66e306abf5b846484b4f2adffd896bce7e065d2/opt/win32tools.zip)
|
set(WINTOOLS_URL https://github.com/neovim/deps/raw/d66e306abf5b846484b4f2adffd896bce7e065d2/opt/win32tools.zip)
|
||||||
set(WINTOOLS_SHA256 2fb2f8d69070b3f16e029913fb95008e6be33893d77fc358012396c275a0fdb7)
|
set(WINTOOLS_SHA256 2fb2f8d69070b3f16e029913fb95008e6be33893d77fc358012396c275a0fdb7)
|
||||||
@ -242,10 +234,6 @@ if(USE_BUNDLED_LUV)
|
|||||||
include(BuildLuv)
|
include(BuildLuv)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(USE_BUNDLED_GPERF)
|
|
||||||
include(BuildGperf)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(USE_BUNDLED_GETTEXT)
|
if(USE_BUNDLED_GETTEXT)
|
||||||
include(BuildGettext)
|
include(BuildGettext)
|
||||||
endif()
|
endif()
|
||||||
|
68
third-party/cmake/BuildGperf.cmake
vendored
68
third-party/cmake/BuildGperf.cmake
vendored
@ -1,68 +0,0 @@
|
|||||||
# Gperf recipe. Gperf is only required when building Neovim, when
|
|
||||||
# cross compiling we still want to build for the HOST system, whenever
|
|
||||||
# writing a recipe that is meant for cross-compile, use the HOSTDEPS_* variables
|
|
||||||
# instead of DEPS_* - check the main CMakeLists.txt for a list.
|
|
||||||
|
|
||||||
# BuildGperf(CONFIGURE_COMMAND ... BUILD_COMMAND ... INSTALL_COMMAND ...)
|
|
||||||
# Reusable function to build Gperf, wraps ExternalProject_Add.
|
|
||||||
# Failing to pass a command argument will result in no command being run
|
|
||||||
function(BuildGperf)
|
|
||||||
cmake_parse_arguments(_gperf
|
|
||||||
""
|
|
||||||
""
|
|
||||||
"CONFIGURE_COMMAND;BUILD_COMMAND;INSTALL_COMMAND"
|
|
||||||
${ARGN})
|
|
||||||
|
|
||||||
if(NOT _gperf_CONFIGURE_COMMAND AND NOT _gperf_BUILD_COMMAND
|
|
||||||
AND NOT _gperf_INSTALL_COMMAND)
|
|
||||||
message(FATAL_ERROR "Must pass at least one of CONFIGURE_COMMAND, BUILD_COMMAND, INSTALL_COMMAND")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
ExternalProject_Add(gperf
|
|
||||||
PREFIX ${DEPS_BUILD_DIR}
|
|
||||||
URL ${GPERF_URL}
|
|
||||||
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/gperf
|
|
||||||
DOWNLOAD_COMMAND ${CMAKE_COMMAND}
|
|
||||||
-DPREFIX=${DEPS_BUILD_DIR}
|
|
||||||
-DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/gperf
|
|
||||||
-DURL=${GPERF_URL}
|
|
||||||
-DEXPECTED_SHA256=${GPERF_SHA256}
|
|
||||||
-DTARGET=gperf
|
|
||||||
-DUSE_EXISTING_SRC_DIR=${USE_EXISTING_SRC_DIR}
|
|
||||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
|
|
||||||
BUILD_IN_SOURCE 1
|
|
||||||
CONFIGURE_COMMAND "${_gperf_CONFIGURE_COMMAND}"
|
|
||||||
BUILD_COMMAND "${_gperf_BUILD_COMMAND}"
|
|
||||||
INSTALL_COMMAND "${_gperf_INSTALL_COMMAND}")
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
set(GPERF_BUILDARGS CC=${HOSTDEPS_C_COMPILER} CXX=${HOSTDEPS_CXX_COMPILER}
|
|
||||||
LD=${HOSTDEPS_C_COMPILER})
|
|
||||||
|
|
||||||
if(UNIX OR (MINGW AND CMAKE_CROSSCOMPILING))
|
|
||||||
|
|
||||||
BuildGperf(
|
|
||||||
CONFIGURE_COMMAND ${DEPS_BUILD_DIR}/src/gperf/configure
|
|
||||||
--prefix=${HOSTDEPS_INSTALL_DIR}
|
|
||||||
MAKE=${MAKE_PRG} ${GPERF_BUILDARGS}
|
|
||||||
INSTALL_COMMAND ${MAKE_PRG} install)
|
|
||||||
|
|
||||||
elseif(MSVC OR MINGW)
|
|
||||||
|
|
||||||
BuildGperf(
|
|
||||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/GperfCMakeLists.txt
|
|
||||||
${DEPS_BUILD_DIR}/src/gperf/CMakeLists.txt
|
|
||||||
COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/gperf/CMakeLists.txt
|
|
||||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
|
||||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
|
||||||
-DCMAKE_GENERATOR=${CMAKE_GENERATOR}
|
|
||||||
-DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
|
|
||||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
|
||||||
-DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}
|
|
||||||
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE}
|
|
||||||
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config ${CMAKE_BUILD_TYPE})
|
|
||||||
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "Trying to build gperf in an unsupported system ${CMAKE_SYSTEM_NAME}/${CMAKE_C_COMPILER_ID}")
|
|
||||||
endif()
|
|
30
third-party/cmake/GperfCMakeLists.txt
vendored
30
third-party/cmake/GperfCMakeLists.txt
vendored
@ -1,30 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 2.8.12)
|
|
||||||
project(gperf LANGUAGES C CXX)
|
|
||||||
|
|
||||||
add_executable(gperf
|
|
||||||
lib/getline.cc
|
|
||||||
lib/hash.cc
|
|
||||||
lib/getopt.c
|
|
||||||
lib/getopt1.c
|
|
||||||
src/version.cc
|
|
||||||
src/positions.cc
|
|
||||||
src/options.cc
|
|
||||||
src/keyword.cc
|
|
||||||
src/keyword-list.cc
|
|
||||||
src/input.cc
|
|
||||||
src/bool-array.cc
|
|
||||||
src/hash-table.cc
|
|
||||||
src/search.cc
|
|
||||||
src/output.cc
|
|
||||||
src/main.cc)
|
|
||||||
|
|
||||||
include_directories(lib)
|
|
||||||
|
|
||||||
# Copy the config.h template without modifying it
|
|
||||||
# because none of the definitions are necessary
|
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/config.h.in ${CMAKE_BINARY_DIR}/config/config.h)
|
|
||||||
include_directories(${CMAKE_BINARY_DIR}/config)
|
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
install(TARGETS gperf
|
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
|
Loading…
Reference in New Issue
Block a user