Skip to content

Commit

Permalink
make it compilable on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
kohnish committed Jun 3, 2023
1 parent fec52a9 commit edff05b
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 34 deletions.
52 changes: 26 additions & 26 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ jobs:
- name: install
run: cd build && make install/strip && sha256sum ../bin/vim9-fuzzy | awk '{print $1}' > sha256.txt

# - name: cmake-win
# run: mkdir -p build-win && cd build-win && cmake -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_STATIC=ON -DCMAKE_TOOLCHAIN_FILE=../native/toolchains/windows.cmake ..
- name: cmake-win
run: mkdir -p build-win && cd build-win && cmake -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_STATIC=ON -DCMAKE_TOOLCHAIN_FILE=../native/toolchains/windows.cmake ..

# - name: build-win
# run: cd build-win && make -j
- name: build-win
run: cd build-win && make -j

# - name: install-win
# run: cd build-win && make install/strip && sha256sum ../bin/vim9-fuzzy.exe | awk '{print $1}' > sha256.txt
- name: install-win
run: cd build-win && make install/strip && sha256sum ../bin/vim9-fuzzy.exe | awk '{print $1}' > sha256.txt

- name: release
id: create_release
Expand Down Expand Up @@ -70,24 +70,24 @@ jobs:
asset_name: sha256-linux-x86-64.txt
asset_content_type: application/zip

# - name: upload-win
# id: upload-release-asset-win
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: bin/vim9-fuzzy.exe
# asset_name: vim9-fuzzy-win-x86-64
# asset_content_type: application/zip
- name: upload-win
id: upload-release-asset-win
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: bin/vim9-fuzzy.exe
asset_name: vim9-fuzzy-win-x86-64
asset_content_type: application/zip

# - name: sha256-upload-win
# id: upload-sha256-win-asset
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: build-win/sha256.txt
# asset_name: sha256-win-x86-64.txt
# asset_content_type: application/zip
- name: sha256-upload-win
id: upload-sha256-win-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build-win/sha256.txt
asset_name: sha256-win-x86-64.txt
asset_content_type: application/zip
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ noremap <C-k> :Vim9FuzzyPwdFile<CR>
# Path for keeping most recently used files (Default here)
g:vim9_fuzzy_mru_path = $HOME .. "/.vim/pack/plugins/opt/vim9-fuzzy/mru"
# For fuzzy yank history search
# For fuzzy yank history search (No windows support)
# Enable yank hook (Default false)
g:vim9_fuzzy_yank_enabled = true
noremap <C-y> :Vim9FuzzyYank<CR>
Expand Down
20 changes: 19 additions & 1 deletion native/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,28 @@ set(src
search_helper.c
fuzzy.c
mru.c
yank.c
str_pool.c
)

get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames)
foreach (_variableName ${_variableNames})
if (ARGV0)
unset(MATCHED)
string(REGEX MATCH ${ARGV0} MATCHED ${_variableName})
if (NOT MATCHED)
continue()
endif()
endif()
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()

if(NOT WIN32)
list(APPEND src
yank.c
)
endif()

set(lib
uv
jsmn
Expand Down
20 changes: 14 additions & 6 deletions native/app/json_msg_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
#include "fuzzy.h"
#include "mru.h"
#include "search_helper.h"
#include "yank.h"
#include <jsmn.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <uv.h>
#ifndef _WIN32
#include "yank.h"
#endif

#define MAX_JSON_TOKENS 128
#define MAX_JSON_ELM_SIZE PATH_MAX
Expand Down Expand Up @@ -137,28 +139,34 @@ void handle_json_msg(uv_loop_t *loop, const char *json_str) {
queue_mru_search(loop, "", mru_path, seq);
} else if (strcmp(cmd, "write_mru") == 0) {
write_mru(mru_path, value);
} else if (strcmp(cmd, "init_yank") == 0) {
queue_yank_search(loop, "", yank_path, seq);
} else if (strcmp(cmd, "mru") == 0) {
queue_mru_search(loop, value, mru_path, seq);
#ifndef _WIN32
} else if (strcmp(cmd, "init_yank") == 0) {
queue_yank_search(loop, "", yank_path, seq);
} else if (strcmp(cmd, "yank") == 0) {
queue_yank_search(loop, value, yank_path, seq);
#endif
}
}

void init_handlers(void) {
init_file_mutex();
init_mru_mutex();
init_yank_mutex();
init_cancel_mutex();
#ifndef _WIN32
init_yank_mutex();
#endif
}

void deinit_handlers(void) {
deinit_file();
deinit_mru();
deinit_yank();
deinit_file_mutex();
deinit_mru_mutex();
deinit_yank_mutex();
deinit_cancel_mutex();
#ifndef _WIN32
deinit_yank();
deinit_yank_mutex();
#endif
}

0 comments on commit edff05b

Please sign in to comment.