2016-07-29 05:53:44 -07:00
|
|
|
include(CMakeParseArguments)
|
|
|
|
|
|
|
|
# BuildLibvterm(CONFIGURE_COMMAND ... BUILD_COMMAND ... INSTALL_COMMAND ...)
|
|
|
|
# Failing to pass a command argument will result in no command being run
|
|
|
|
function(BuildLibvterm)
|
|
|
|
cmake_parse_arguments(_libvterm
|
|
|
|
""
|
|
|
|
""
|
2018-03-01 21:39:35 -07:00
|
|
|
"PATCH_COMMAND;CONFIGURE_COMMAND;BUILD_COMMAND;INSTALL_COMMAND"
|
2016-07-29 05:53:44 -07:00
|
|
|
${ARGN})
|
|
|
|
|
|
|
|
if(NOT _libvterm_CONFIGURE_COMMAND AND NOT _libvterm_BUILD_COMMAND
|
|
|
|
AND NOT _libvterm_INSTALL_COMMAND)
|
|
|
|
message(FATAL_ERROR "Must pass at least one of CONFIGURE_COMMAND, BUILD_COMMAND, INSTALL_COMMAND")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
ExternalProject_Add(libvterm
|
|
|
|
PREFIX ${DEPS_BUILD_DIR}
|
|
|
|
URL ${LIBVTERM_URL}
|
|
|
|
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libvterm
|
|
|
|
DOWNLOAD_COMMAND ${CMAKE_COMMAND}
|
|
|
|
-DPREFIX=${DEPS_BUILD_DIR}
|
|
|
|
-DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/libvterm
|
|
|
|
-DURL=${LIBVTERM_URL}
|
|
|
|
-DEXPECTED_SHA256=${LIBVTERM_SHA256}
|
|
|
|
-DTARGET=libvterm
|
|
|
|
-DUSE_EXISTING_SRC_DIR=${USE_EXISTING_SRC_DIR}
|
|
|
|
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
|
2018-03-01 21:39:35 -07:00
|
|
|
PATCH_COMMAND "${_libvterm_PATCH_COMMAND}"
|
2016-07-29 05:53:44 -07:00
|
|
|
BUILD_IN_SOURCE 1
|
|
|
|
CONFIGURE_COMMAND "${_libvterm_CONFIGURE_COMMAND}"
|
|
|
|
BUILD_COMMAND "${_libvterm_BUILD_COMMAND}"
|
|
|
|
INSTALL_COMMAND "${_libvterm_INSTALL_COMMAND}")
|
|
|
|
endfunction()
|
|
|
|
|
2015-04-16 02:01:08 -07:00
|
|
|
if(WIN32)
|
2018-03-01 21:39:35 -07:00
|
|
|
if(MSVC)
|
|
|
|
set(LIBVTERM_PATCH_COMMAND
|
2018-03-06 19:38:10 -07:00
|
|
|
${GIT_EXECUTABLE} -C ${DEPS_BUILD_DIR}/src/libvterm init
|
2018-03-17 14:20:14 -07:00
|
|
|
COMMAND ${GIT_EXECUTABLE} -C ${DEPS_BUILD_DIR}/src/libvterm apply --ignore-whitespace
|
2018-09-03 21:41:55 -07:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/patches/libvterm-Remove-VLAs-for-MSVC.patch)
|
2018-03-01 21:39:35 -07:00
|
|
|
endif()
|
2016-07-29 05:53:44 -07:00
|
|
|
set(LIBVTERM_CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy
|
2018-03-17 14:20:30 -07:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/cmake/LibvtermCMakeLists.txt
|
|
|
|
${DEPS_BUILD_DIR}/src/libvterm/CMakeLists.txt
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/cmake/Libvterm-tbl2inc_c.cmake
|
|
|
|
${DEPS_BUILD_DIR}/src/libvterm/tbl2inc_c.cmake
|
|
|
|
COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/libvterm
|
2016-07-29 05:53:44 -07:00
|
|
|
-DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}
|
|
|
|
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
|
|
|
"-DCMAKE_C_FLAGS:STRING=${CMAKE_C_COMPILER_ARG1} -fPIC"
|
|
|
|
-DCMAKE_GENERATOR=${CMAKE_GENERATOR})
|
|
|
|
set(LIBVTERM_BUILD_COMMAND ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE})
|
|
|
|
set(LIBVTERM_INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config ${CMAKE_BUILD_TYPE})
|
|
|
|
else()
|
|
|
|
set(LIBVTERM_INSTALL_COMMAND ${MAKE_PRG} CC=${DEPS_C_COMPILER}
|
2018-03-01 02:23:21 -07:00
|
|
|
PREFIX=${DEPS_INSTALL_DIR}
|
|
|
|
CFLAGS=-fPIC
|
2019-10-14 06:16:58 -07:00
|
|
|
LDFLAGS+=-static
|
2018-03-01 02:23:21 -07:00
|
|
|
${DEFAULT_MAKE_CFLAGS}
|
|
|
|
install)
|
2015-04-16 02:01:08 -07:00
|
|
|
endif()
|
|
|
|
|
2018-03-01 21:39:35 -07:00
|
|
|
BuildLibvterm(PATCH_COMMAND ${LIBVTERM_PATCH_COMMAND}
|
|
|
|
CONFIGURE_COMMAND ${LIBVTERM_CONFIGURE_COMMAND}
|
2016-07-29 05:53:44 -07:00
|
|
|
BUILD_COMMAND ${LIBVTERM_BUILD_COMMAND}
|
|
|
|
INSTALL_COMMAND ${LIBVTERM_INSTALL_COMMAND})
|
2015-03-09 06:24:21 -07:00
|
|
|
|
2015-03-10 03:04:06 -07:00
|
|
|
list(APPEND THIRD_PARTY_DEPS libvterm)
|