Skip to content

Commit cb2d683

Browse files
committed
feat: windows support
1 parent 70e7268 commit cb2d683

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

.github/workflows/test.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@ jobs:
99
strategy:
1010
fail-fast: false
1111
matrix:
12-
os: [ubuntu-22.04, ubuntu-22.04-arm]
12+
include:
13+
- os: ubuntu-22.04
14+
deps: sudo apt-get install -y cmake libssl-dev
15+
- os: ubuntu-22.04-arm
16+
deps: sudo apt-get install -y cmake libssl-dev
17+
- os: windows-latest
18+
deps: choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y
19+
- os: windows-11-arm
20+
deps: choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y
1321

1422
runs-on: ${{ matrix.os }}
1523

@@ -19,7 +27,7 @@ jobs:
1927
submodules: recursive
2028

2129
- name: Install dependencies
22-
run: sudo apt-get install -y cmake libssl-dev
30+
run: ${{ matrix.deps }}
2331

2432
- name: Setup lde
2533
uses: lde-org/setup-lde@master

build.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ local function exec(cmd)
1313
end
1414

1515
local build = src .. sep .. "build"
16-
exec('cmake -S "' .. src .. '" -B "' .. build .. '" -DBUILD_SHARED_LIBS=ON -DBUILD_TESTS=OFF -DBUILD_CLI=OFF -DUSE_SSH=OFF -DUSE_HTTPS=OpenSSL')
17-
exec('cmake --build "' .. build .. '" --config Release -j' .. (isWindows and "" or "$(nproc)"))
16+
local https = isWindows and "WinHTTP" or "OpenSSL"
17+
exec('cmake -S "' .. src .. '" -B "' .. build .. '" -DBUILD_SHARED_LIBS=ON -DBUILD_TESTS=OFF -DBUILD_CLI=OFF -DUSE_SSH=OFF -DUSE_HTTPS=' .. https)
18+
exec('cmake --build "' .. build .. '" --config Release' .. (isWindows and "" or " -j$(nproc)"))
1819

1920
if isWindows then
2021
exec('copy "' .. build .. '\\Release\\git2.dll" "' .. outLib .. '"')

src/init.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ ffi.cdef [[
5858
]]
5959

6060
local here = debug.getinfo(1, "S").source:sub(2):match("(.*[/\\])") or ""
61-
local lib = ffi.load(here .. "libgit2.so")
61+
local sep = string.sub(package.config, 1, 1)
62+
local lib = ffi.load(here .. (sep == "\\" and "git2.dll" or "libgit2.so"))
6263

6364
lib.git_libgit2_init()
6465

0 commit comments

Comments
 (0)