mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 11:15:14 -07:00
build/msvc: Add CMakeLists.txt and header for Unibilium
A header was added for compatibility with MSVC and CMakeLists.txt was added for building with CMake.
This commit is contained in:
parent
f2b6145d74
commit
fa6f892055
9
third-party/CMakeLists.txt
vendored
9
third-party/CMakeLists.txt
vendored
@ -103,13 +103,8 @@ set(LUA_SHA256 2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333)
|
||||
set(LUAROCKS_URL https://github.com/luarocks/luarocks/archive/v2.4.3.tar.gz)
|
||||
set(LUAROCKS_SHA256 ea1881d6954f2a98c34f93674571c8f0cbdbc28dedb3fa3cb56b6a91886d1a99)
|
||||
|
||||
if(WIN32)
|
||||
set(UNIBILIUM_URL https://github.com/b-r-o-c-k/unibilium/archive/v2.0.0.tar.gz)
|
||||
set(UNIBILIUM_SHA256 37a81954f78a27a024b805b330f0b1c082d6c1e9aeed32509a00272c1695cdac)
|
||||
else()
|
||||
set(UNIBILIUM_URL https://github.com/mauke/unibilium/archive/v2.0.0.tar.gz)
|
||||
set(UNIBILIUM_SHA256 78997d38d4c8177c60d3d0c1aa8c53fd0806eb21825b7b335b1768d7116bc1c1)
|
||||
endif()
|
||||
set(UNIBILIUM_URL https://github.com/mauke/unibilium/archive/v2.0.0.tar.gz)
|
||||
set(UNIBILIUM_SHA256 78997d38d4c8177c60d3d0c1aa8c53fd0806eb21825b7b335b1768d7116bc1c1)
|
||||
|
||||
if(WIN32)
|
||||
set(LIBTERMKEY_URL https://github.com/equalsraf/libtermkey/archive/tb-windows.zip)
|
||||
|
18
third-party/cmake/BuildUnibilium.cmake
vendored
18
third-party/cmake/BuildUnibilium.cmake
vendored
@ -11,12 +11,18 @@ if(WIN32)
|
||||
-DTARGET=unibilium
|
||||
-DUSE_EXISTING_SRC_DIR=${USE_EXISTING_SRC_DIR}
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
|
||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/unibilium
|
||||
-DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}
|
||||
# Pass toolchain
|
||||
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-DCMAKE_GENERATOR=${CMAKE_GENERATOR}
|
||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/UnibiliumCMakeLists.txt
|
||||
${DEPS_BUILD_DIR}/src/unibilium/CMakeLists.txt
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/msvc-compat/unistd.h
|
||||
${DEPS_BUILD_DIR}/src/unibilium/msvc-compat/unistd.h
|
||||
COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/unibilium
|
||||
-DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}
|
||||
# Pass toolchain
|
||||
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-DCMAKE_GENERATOR=${CMAKE_GENERATOR}
|
||||
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE}
|
||||
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config ${CMAKE_BUILD_TYPE})
|
||||
else()
|
||||
|
27
third-party/cmake/UnibiliumCMakeLists.txt
vendored
Normal file
27
third-party/cmake/UnibiliumCMakeLists.txt
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
cmake_minimum_required(VERSION 2.8.7)
|
||||
project(unibilium LANGUAGES C)
|
||||
|
||||
file(GLOB SRC_FILES ${PROJECT_SOURCE_DIR}/*.c)
|
||||
add_library(unibilium ${SRC_FILES})
|
||||
set_target_properties(unibilium PROPERTIES PUBLIC_HEADER ${PROJECT_SOURCE_DIR}/unibilium.h
|
||||
VERSION "${VERSION_MAJOR}.${VERSION_MINOR}")
|
||||
|
||||
if(NOT WIN32)
|
||||
execute_process(COMMAND "shell ncursesw6-config --terminfo-dirs 2>/dev/null || \
|
||||
ncurses6-config --terminfo-dirs 2>/dev/null || \
|
||||
ncursesw5-config --terminfo-dirs 2>/dev/null || \
|
||||
ncurses5-config --terminfo-dirs 2>/dev/null || \
|
||||
echo '/etc/terminfo:/lib/terminfo:/usr/share/terminfo:/usr/lib/terminfo:/usr/local/share/terminfo:/usr/local/lib/terminfo'"
|
||||
OUTPUT_VARIABLE TERMINFO_DIRS)
|
||||
endif()
|
||||
target_compile_definitions(unibilium PUBLIC TERMINFO_DIRS ${TERMINFO_DIRS})
|
||||
|
||||
if(MSVC)
|
||||
target_include_directories(unibilium PUBLIC ${PROJECT_SOURCE_DIR}/msvc-compat)
|
||||
endif()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
install(TARGETS unibilium
|
||||
PUBLIC_HEADER
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
10
third-party/msvc-compat/unistd.h
vendored
Normal file
10
third-party/msvc-compat/unistd.h
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef GUARD_UNIBILIUM_UNISTD_H_
|
||||
#define GUARD_UNIBILIUM_UNISTD_H_
|
||||
|
||||
#ifdef _WIN64
|
||||
typedef unsigned __int64 ssize_t;
|
||||
#else
|
||||
typedef _W64 unsigned int ssize_t;
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user