summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-01-08 17:30:47 -0500
committerpommicket <pommicket@gmail.com>2023-01-09 13:24:03 -0500
commit1051788217ead36b554efe38259dfd257e851fc2 (patch)
treea069061d093408ce04fa77d06aa45abbe7b8e1db
parentea70e513d8a927680f2795d4bad9aba788f32d77 (diff)
windows cmake build
-rw-r--r--CMakeLists.txt21
-rw-r--r--lsp.c1
2 files changed, 18 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0315b11..a12c9b3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,10 +1,23 @@
-cmake_minimum_required(VERSION 3.0)
+cmake_minimum_required(VERSION 3.1)
project(ted)
set(SOURCES buffer.c build.c colors.c command.c config.c find.c gl.c ide-autocomplete.c
ide-definitions.c ide-highlights.c ide-hover.c ide-signature-help.c ide-usages.c
lsp.c lsp-json.c lsp-parse.c lsp-write.c main.c menu.c node.c os.c session.c
stb_image.c stb_truetype.c syntax.c tags.c ted.c text.c ui.c util.c)
-add_executable(ted ${SOURCES})
+if (MSVC)
+ add_executable(ted WIN32 ${SOURCES})
+else()
+ add_executable(ted ${SOURCES})
+endif()
target_compile_definitions(ted PUBLIC DEBUG=1)
-target_link_libraries(ted m SDL2)
-target_link_libraries(ted ${CMAKE_SOURCE_DIR}/libpcre2-32.a)
+if(MSVC)
+ target_sources(ted PRIVATE ted.res)
+ target_include_directories(ted PUBLIC ${CMAKE_SOURCE_DIR}/SDL2/include ${CMAKE_SOURCE_DIR}/pcre2)
+ target_compile_options(ted PRIVATE /MD /W4 /wd4200 /wd4204 /wd4221 /wd4706 /wd4214 /D_CRT_SECURE_NO_WARNINGS)
+ set(SDL2_LIB_DIR ${CMAKE_SOURCE_DIR}/SDL2/lib/x64)
+ target_link_libraries(ted ${SDL2_LIB_DIR}/SDL2.lib)
+ target_link_libraries(ted ${CMAKE_SOURCE_DIR}/pcre2-32-static.lib)
+else()
+ target_link_libraries(ted m SDL2)
+ target_link_libraries(ted ${CMAKE_SOURCE_DIR}/libpcre2-32.a)
+endif()
diff --git a/lsp.c b/lsp.c
index 8f2c1af..af61254 100644
--- a/lsp.c
+++ b/lsp.c
@@ -525,6 +525,7 @@ LSP *lsp_create(const char *root_dir, const char *command, const char *configura
// document ID 0 is reserved
LSPDocumentID zero_id = lsp_document_id(lsp, "");
+ (void)zero_id;
assert(zero_id == 0);
arr_add(lsp->workspace_folders, lsp_document_id(lsp, root_dir));