From b05100a9eaad5980ea7652137bc4a1c2d15d752f Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Thu, 26 Jan 2023 00:06:52 +0100 Subject: build: use cmake to build libvterm on all platform (#21986) Also remove Libvterm-tbl2inc_c.cmake as it's not required. It's used to generate files that are already provided by the Libvterm project by default. It's also not really something we need to concern ourselves with as it's more of an authoring tool for the Libvterm creator as mentioned in https://github.com/neovim/neovim/pull/21986#issuecomment-1403733054. --- cmake.deps/cmake/LibvtermCMakeLists.txt | 58 ++------------------------------- 1 file changed, 2 insertions(+), 56 deletions(-) (limited to 'cmake.deps/cmake/LibvtermCMakeLists.txt') diff --git a/cmake.deps/cmake/LibvtermCMakeLists.txt b/cmake.deps/cmake/LibvtermCMakeLists.txt index 079ad28ba0..777ce6c54c 100644 --- a/cmake.deps/cmake/LibvtermCMakeLists.txt +++ b/cmake.deps/cmake/LibvtermCMakeLists.txt @@ -2,43 +2,18 @@ cmake_minimum_required(VERSION 3.10) project(libvterm LANGUAGES C) include(GNUInstallDirs) -find_package(Perl) if(MSVC) - add_compile_options(/W3) add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE) else() - add_compile_options(-Wall -std=c99) + add_compile_options(-std=c99) endif() -# Generate includes from tables -file(GLOB TBL_FILES ${CMAKE_SOURCE_DIR}/src/encoding/*.tbl) -set(TBL_FILES_HEADERS) -foreach(file ${TBL_FILES}) - get_filename_component(basename ${file} NAME_WE) - set(tname encoding/${basename}.inc) - add_custom_command(OUTPUT - COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/encoding/ - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/tbl2inc_c.cmake ${file} ${CMAKE_BINARY_DIR}/${tname} - COMMENT "Generating ${tname}" - OUTPUT ${CMAKE_BINARY_DIR}/${tname} - ) - list(APPEND TBL_FILES_HEADERS ${tname}) - # Only used for verifying that the output of tbl2inc_c.cmake is correct - set(tname encoding-test/${basename}.inc) - add_custom_command(OUTPUT - COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/encoding-test/ - COMMAND ${PERL_EXECUTABLE} -CSD ${CMAKE_SOURCE_DIR}/tbl2inc_c.pl ${file} > ${CMAKE_BINARY_DIR}/${tname} - COMMENT "Generating ${tname}" - OUTPUT ${CMAKE_BINARY_DIR}/${tname} - ) -endforeach() - include_directories(${CMAKE_SOURCE_DIR}/include) include_directories(${CMAKE_BINARY_DIR}) file(GLOB VTERM_SOURCES ${CMAKE_SOURCE_DIR}/src/*.c) -add_library(vterm ${VTERM_SOURCES} ${TBL_FILES_HEADERS}) +add_library(vterm ${VTERM_SOURCES}) install(TARGETS vterm ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(FILES include/vterm.h include/vterm_keycodes.h @@ -54,33 +29,4 @@ if(NOT WIN32) endforeach() endif() -# Tests -add_executable(harness EXCLUDE_FROM_ALL t/harness.c) -target_link_libraries(harness vterm) -set_target_properties(harness PROPERTIES - # run-test.pl expects to find the harness in t/.libs/ - RUNTIME_OUTPUT_DIRECTORY t/.libs) - -if(Perl_FOUND) - file(GLOB TESTFILES ${CMAKE_SOURCE_DIR}/t/*.test) - add_custom_target(check) - foreach(testfile ${TESTFILES}) - get_filename_component(target_name ${testfile} NAME_WE) - add_custom_target(${target_name} - COMMAND ${PERL_EXECUTABLE} ${CMAKE_SOURCE_DIR}/t/run-test.pl ${testfile} - COMMENT "**${target_name} **" - DEPENDS harness) - add_dependencies(check ${target_name}) - endforeach() - - foreach(header_path ${TBL_FILES_HEADERS}) - get_filename_component(header_name ${header_path} NAME) - set(perl_header_path ${CMAKE_BINARY_DIR}/encoding-test/${header_name}) - add_custom_target(test-${header_name} - COMMAND ${CMAKE_COMMAND} -E compare_files - ${header_path} ${perl_header_path} - DEPENDS ${header_path} ${perl_header_path}) - endforeach() -endif() - # vim: set ft=cmake: -- cgit From aaea48aac6e227314ec08acec2a4c3c84538cab8 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sun, 26 Feb 2023 13:32:37 +0100 Subject: build: set libtermkey project language to C (#22410) This will prevent cmake from failing the build if a C++ compiler isn't found. --- cmake.deps/cmake/LibvtermCMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmake.deps/cmake/LibvtermCMakeLists.txt') diff --git a/cmake.deps/cmake/LibvtermCMakeLists.txt b/cmake.deps/cmake/LibvtermCMakeLists.txt index 777ce6c54c..0fb3227117 100644 --- a/cmake.deps/cmake/LibvtermCMakeLists.txt +++ b/cmake.deps/cmake/LibvtermCMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.10) -project(libvterm LANGUAGES C) +project(libvterm C) include(GNUInstallDirs) -- cgit From b155608bffd4e599d26fb648327705946458e012 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Fri, 24 Mar 2023 16:22:15 +0700 Subject: build: set CMAKE_C_STANDARD to 99 for all dependencies Older gcc versions (4.x) require passing --std=c99 compiler flag to prevent warnings from being emitted. Instead of setting it for each dependency, it's easier to just pass the CMAKE_C_STANDARD flag to all dependencies. This also prevents the scenario of us forgetting to set it if we add new dependencies. --- cmake.deps/cmake/LibvtermCMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) (limited to 'cmake.deps/cmake/LibvtermCMakeLists.txt') diff --git a/cmake.deps/cmake/LibvtermCMakeLists.txt b/cmake.deps/cmake/LibvtermCMakeLists.txt index 0fb3227117..7b1d95f531 100644 --- a/cmake.deps/cmake/LibvtermCMakeLists.txt +++ b/cmake.deps/cmake/LibvtermCMakeLists.txt @@ -5,8 +5,6 @@ include(GNUInstallDirs) if(MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE) -else() - add_compile_options(-std=c99) endif() include_directories(${CMAKE_SOURCE_DIR}/include) -- cgit From 8405649f92a8a8eb254944eca15e8b0169cbb6fb Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sun, 29 Oct 2023 02:09:19 +0200 Subject: build: use neovim/libvterm instead of neovim/deps for libvterm Using a mirror makes it easier to test patches as well as reducing maintenance when a new version is released. --- cmake.deps/cmake/LibvtermCMakeLists.txt | 53 +++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'cmake.deps/cmake/LibvtermCMakeLists.txt') diff --git a/cmake.deps/cmake/LibvtermCMakeLists.txt b/cmake.deps/cmake/LibvtermCMakeLists.txt index 7b1d95f531..0c31d32d64 100644 --- a/cmake.deps/cmake/LibvtermCMakeLists.txt +++ b/cmake.deps/cmake/LibvtermCMakeLists.txt @@ -7,6 +7,59 @@ if(MSVC) add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE) endif() +set(DECDRAWING [[ + static const struct StaticTableEncoding encoding_DECdrawing = { + { .decode = &decode_table }, + { + [0x60] = 0x25C6, + [0x61] = 0x2592, + [0x62] = 0x2409, + [0x63] = 0x240C, + [0x64] = 0x240D, + [0x65] = 0x240A, + [0x66] = 0x00B0, + [0x67] = 0x00B1, + [0x68] = 0x2424, + [0x69] = 0x240B, + [0x6a] = 0x2518, + [0x6b] = 0x2510, + [0x6c] = 0x250C, + [0x6d] = 0x2514, + [0x6e] = 0x253C, + [0x6f] = 0x23BA, + [0x70] = 0x23BB, + [0x71] = 0x2500, + [0x72] = 0x23BC, + [0x73] = 0x23BD, + [0x74] = 0x251C, + [0x75] = 0x2524, + [0x76] = 0x2534, + [0x77] = 0x252C, + [0x78] = 0x2502, + [0x79] = 0x2A7D, + [0x7a] = 0x2A7E, + [0x7b] = 0x03C0, + [0x7c] = 0x2260, + [0x7d] = 0x00A3, + [0x7e] = 0x00B7, + } + }; +]] +) + +set(UK [[ + static const struct StaticTableEncoding encoding_uk = { + { .decode = &decode_table }, + { + [0x23] = 0x00a3, + } + }; +]] +) + +file(WRITE src/encoding/DECdrawing.inc "${DECDRAWING}") +file(WRITE src/encoding/uk.inc "${UK}") + include_directories(${CMAKE_SOURCE_DIR}/include) include_directories(${CMAKE_BINARY_DIR}) -- cgit From 7a80e169c5b128e1aea961e888ca6e9c7b48dd27 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 20 Nov 2023 02:01:39 +0100 Subject: build: disable all compiler warnings from dependencies --- cmake.deps/cmake/LibvtermCMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) (limited to 'cmake.deps/cmake/LibvtermCMakeLists.txt') diff --git a/cmake.deps/cmake/LibvtermCMakeLists.txt b/cmake.deps/cmake/LibvtermCMakeLists.txt index 0c31d32d64..f9b448b50d 100644 --- a/cmake.deps/cmake/LibvtermCMakeLists.txt +++ b/cmake.deps/cmake/LibvtermCMakeLists.txt @@ -3,10 +3,6 @@ project(libvterm C) include(GNUInstallDirs) -if(MSVC) - add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE) -endif() - set(DECDRAWING [[ static const struct StaticTableEncoding encoding_DECdrawing = { { .decode = &decode_table }, -- cgit From 99b8a343e197cdec53f752e1cce01ae25eb45c12 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 20 Nov 2023 12:42:54 +0100 Subject: fixup: quick update, squash later --- cmake.deps/cmake/LibvtermCMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'cmake.deps/cmake/LibvtermCMakeLists.txt') diff --git a/cmake.deps/cmake/LibvtermCMakeLists.txt b/cmake.deps/cmake/LibvtermCMakeLists.txt index f9b448b50d..519926e542 100644 --- a/cmake.deps/cmake/LibvtermCMakeLists.txt +++ b/cmake.deps/cmake/LibvtermCMakeLists.txt @@ -1,6 +1,12 @@ cmake_minimum_required(VERSION 3.10) +# Can be removed once minimum version is at least 3.15 +if(POLICY CMP0092) + cmake_policy(SET CMP0092 NEW) +endif() project(libvterm C) +add_compile_options(-w) + include(GNUInstallDirs) set(DECDRAWING [[ -- cgit