diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 04429d4..3047a9a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,15 +15,6 @@ jobs: strategy: matrix: include: - - os: linux - runs-on: ubuntu-latest - arch: amd64 - - os: darwin - runs-on: macos-latest - arch: amd64 - - os: darwin - runs-on: macos-latest - arch: arm64 - os: windows runs-on: windows-latest arch: amd64 @@ -41,17 +32,7 @@ jobs: if: matrix.os == 'linux' run: | sudo apt-get update - sudo apt-get install -y sqlite3 libsqlite3-dev build-essential - - - name: Install dependencies (macOS) - if: matrix.os == 'darwin' - run: | - brew install sqlite3 - - - name: Install dependencies (Windows) - if: matrix.os == 'windows' - run: | - choco install sqlite + sudo apt-get install -y libsqlite3-dev build-essential - name: Build SQLite (Unix) if: matrix.os != 'windows' @@ -68,6 +49,12 @@ jobs: make make install + - name: Setup MSVC (Windows) + if: matrix.os == 'windows' + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x64 + - name: Build SQLite (Windows) if: matrix.os == 'windows' run: | @@ -78,10 +65,19 @@ jobs: Rename-Item sqlite-autoconf-3450100 sqlite-latest } cd sqlite-latest - # Use MSYS2/MinGW for Windows build - bash -c "./configure --prefix=$(pwd)/../install --enable-static --disable-shared 'CFLAGS=-DSQLITE_ENABLE_DBPAGE_VTAB=1 -O2'" - bash -c "make" - bash -c "make install" + # Use Visual Studio tools for Windows build as recommended by SQLite docs + nmake /f Makefile.msc clean + nmake /f Makefile.msc sqlite3.c + nmake /f Makefile.msc sqlite3.exe + # Create install directory structure + New-Item -ItemType Directory -Force -Path "../install/bin" + New-Item -ItemType Directory -Force -Path "../install/include" + New-Item -ItemType Directory -Force -Path "../install/lib" + # Copy built files to install directory + Copy-Item "sqlite3.exe" "../install/bin/" + Copy-Item "sqlite3.h" "../install/include/" + Copy-Item "sqlite3ext.h" "../install/include/" + if (Test-Path "sqlite3.lib") { Copy-Item "sqlite3.lib" "../install/lib/" } - name: Build Bridge run: | @@ -126,8 +122,8 @@ jobs: if: matrix.os == 'windows' run: | cd client - # Use make with MSYS2/MinGW - bash -c "make build" + # MSVC environment is already set up from previous step + make build - name: Create release directory run: | diff --git a/bridge/sqlite_rsync.c b/bridge/sqlite_rsync.c index f597c46..1f2479f 100644 --- a/bridge/sqlite_rsync.c +++ b/bridge/sqlite_rsync.c @@ -1,6 +1,4 @@ #define SQLITE_ENABLE_DBPAGE_VTAB 1 -#define SQLITE_RSYNC_NO_MAIN -#define SQLITE_RSYNC_USE_H #ifndef SQLITE_RSYNC_C_INCLUDED #define SQLITE_RSYNC_C_INCLUDED @@ -126,7 +124,7 @@ static void win32_fatal_error(const char *zMsg) fprintf(stderr, "%s", zMsg); exit(1); } -extern int _open_osfhandle(intptr_t, int); +#include /* For _open_osfhandle */ #else #include #include @@ -175,7 +173,7 @@ extern int sqlite3_sha_init( ** ** Return the number of errors. */ -static int win32_create_child_process( +int win32_create_child_process( wchar_t *zCmd, /* The command that the child process will run */ HANDLE hIn, /* Standard input */ HANDLE hOut, /* Standard output */ diff --git a/bridge/sqlite_rsync.h b/bridge/sqlite_rsync.h index edcc8e0..e7772d9 100644 --- a/bridge/sqlite_rsync.h +++ b/bridge/sqlite_rsync.h @@ -15,8 +15,6 @@ ** similar to "rsync". */ -#define SQLITE_RSYNC_USE_H - #ifndef SQLITE_RSYNC_H_INCLUDED #define SQLITE_RSYNC_H_INCLUDED diff --git a/bridge/sqlite_rsync_wrapper.c b/bridge/sqlite_rsync_wrapper.c index 6bf7aa6..876b868 100644 --- a/bridge/sqlite_rsync_wrapper.c +++ b/bridge/sqlite_rsync_wrapper.c @@ -1,13 +1,14 @@ -#define SQLITE_RSYNC_NO_MAIN -#define SQLITE_RSYNC_USE_H - #include "sqlite_rsync.h" #include "sqlite_rsync_wrapper.h" #include #include #include +#ifdef _WIN32 +#include +#else #include #include +#endif #ifndef SQLITE_RSYNC_WRAPPER_C_INCLUDED #define SQLITE_RSYNC_WRAPPER_C_INCLUDED