mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-23 00:39:20 +08:00
for msvc abi builds, add support for using sqlite from a vcpkg installation if available
This commit is contained in:
parent
cd824aeaee
commit
0dd10f85ba
23
appveyor.yml
23
appveyor.yml
@ -1,6 +1,12 @@
|
|||||||
environment:
|
environment:
|
||||||
TARGET: 1.15.0-x86_64-pc-windows-gnu
|
matrix:
|
||||||
|
- TARGET: 1.15.0-x86_64-pc-windows-gnu
|
||||||
MSYS2_BITS: 64
|
MSYS2_BITS: 64
|
||||||
|
- TARGET: 1.15.0-x86_64-pc-windows-msvc
|
||||||
|
VCPKG_DEFAULT_TRIPLET: x64-windows
|
||||||
|
- TARGET: nightly-x86_64-pc-windows-msvc
|
||||||
|
VCPKG_DEFAULT_TRIPLET: x64-windows-static
|
||||||
|
RUSTFLAGS: -Ctarget-feature=+crt-static
|
||||||
install:
|
install:
|
||||||
- ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-${env:TARGET}.exe"
|
- ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-${env:TARGET}.exe"
|
||||||
- rust-%TARGET%.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust"
|
- rust-%TARGET%.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust"
|
||||||
@ -9,11 +15,18 @@ install:
|
|||||||
- rustc -V
|
- rustc -V
|
||||||
- cargo -V
|
- cargo -V
|
||||||
- ps: Start-FileDownload 'https://sqlite.org/2017/sqlite-dll-win64-x64-3170000.zip' # download SQLite dll (useful only when the `bundled` feature is not set)
|
- ps: Start-FileDownload 'https://sqlite.org/2017/sqlite-dll-win64-x64-3170000.zip' # download SQLite dll (useful only when the `bundled` feature is not set)
|
||||||
- cmd: 7z e sqlite-dll-win64-x64-3170000.zip -y > nul
|
- if not defined VCPKG_DEFAULT_TRIPLET 7z e sqlite-dll-win64-x64-3170000.zip -y > nul
|
||||||
- ps: Start-FileDownload 'https://sqlite.org/2017/sqlite-amalgamation-3170000.zip' # download SQLite headers (useful only when the `bundled` feature is not set)
|
- ps: Start-FileDownload 'https://sqlite.org/2017/sqlite-amalgamation-3170000.zip' # download SQLite headers (useful only when the `bundled` feature is not set)
|
||||||
- cmd: 7z e sqlite-amalgamation-3170000.zip -y > nul
|
- if not defined VCPKG_DEFAULT_TRIPLET 7z e sqlite-amalgamation-3170000.zip -y > nul
|
||||||
- SET SQLITE3_LIB_DIR=%APPVEYOR_BUILD_FOLDER% # specify where the SQLite dll has been downloaded (useful only when the `bundled` feature is not set)
|
- if not defined VCPKG_DEFAULT_TRIPLET SET SQLITE3_LIB_DIR=%APPVEYOR_BUILD_FOLDER% # specify where the SQLite dll has been downloaded (useful only when the `bundled` feature is not set)
|
||||||
- SET SQLITE3_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER% # specify where the SQLite headers have been downloaded (useful only when the `bundled` feature is not set)
|
- if not defined VCPKG_DEFAULT_TRIPLET SET SQLITE3_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER% # specify where the SQLite headers have been downloaded (useful only when the `bundled` feature is not set)
|
||||||
|
# install vcpkg and the sqlite3 package
|
||||||
|
- if defined VCPKG_DEFAULT_TRIPLET git clone https://github.com/Microsoft/vcpkg c:\projects\vcpkg
|
||||||
|
- if defined VCPKG_DEFAULT_TRIPLET c:\projects\vcpkg\bootstrap-vcpkg.bat
|
||||||
|
- if defined VCPKG_DEFAULT_TRIPLET set VCPKG_ROOT=c:\projects\vcpkg
|
||||||
|
- if defined VCPKG_DEFAULT_TRIPLET %VCPKG_ROOT%\vcpkg.exe install sqlite3
|
||||||
|
- if defined VCPKG_DEFAULT_TRIPLET appveyor DownloadFile http://releases.llvm.org/4.0.0/LLVM-4.0.0-win64.exe
|
||||||
|
- if defined VCPKG_DEFAULT_TRIPLET LLVM-4.0.0-win64.exe /S
|
||||||
|
|
||||||
build: false
|
build: false
|
||||||
|
|
||||||
|
@ -13,15 +13,16 @@ categories = ["database", "external-ffi-bindings"]
|
|||||||
[features]
|
[features]
|
||||||
default = ["min_sqlite_version_3_6_8"]
|
default = ["min_sqlite_version_3_6_8"]
|
||||||
bundled = ["gcc"]
|
bundled = ["gcc"]
|
||||||
buildtime_bindgen = ["bindgen", "pkg-config"]
|
buildtime_bindgen = ["bindgen", "pkg-config", "vcpkg"]
|
||||||
min_sqlite_version_3_6_8 = ["pkg-config"]
|
min_sqlite_version_3_6_8 = ["pkg-config", "vcpkg"]
|
||||||
min_sqlite_version_3_6_11 = ["pkg-config"]
|
min_sqlite_version_3_6_11 = ["pkg-config", "vcpkg"]
|
||||||
min_sqlite_version_3_6_23 = ["pkg-config"]
|
min_sqlite_version_3_6_23 = ["pkg-config", "vcpkg"]
|
||||||
min_sqlite_version_3_7_3 = ["pkg-config"]
|
min_sqlite_version_3_7_3 = ["pkg-config", "vcpkg"]
|
||||||
min_sqlite_version_3_7_4 = ["pkg-config"]
|
min_sqlite_version_3_7_4 = ["pkg-config", "vcpkg"]
|
||||||
min_sqlite_version_3_7_16 = ["pkg-config"]
|
min_sqlite_version_3_7_16 = ["pkg-config", "vcpkg"]
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
bindgen = { version = "0.21", optional = true }
|
bindgen = { version = "0.21", optional = true }
|
||||||
pkg-config = { version = "0.3", optional = true }
|
pkg-config = { version = "0.3", optional = true }
|
||||||
gcc = { version = "0.3", optional = true }
|
gcc = { version = "0.3", optional = true }
|
||||||
|
vcpkg = { version = "0.2", optional = true }
|
||||||
|
@ -42,6 +42,9 @@ mod build {
|
|||||||
mod build {
|
mod build {
|
||||||
extern crate pkg_config;
|
extern crate pkg_config;
|
||||||
|
|
||||||
|
#[cfg(feature = "vcpkg")]
|
||||||
|
extern crate vcpkg;
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
pub enum HeaderLocation {
|
pub enum HeaderLocation {
|
||||||
@ -79,6 +82,10 @@ mod build {
|
|||||||
return HeaderLocation::FromEnvironment;
|
return HeaderLocation::FromEnvironment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(header) = try_vcpkg() {
|
||||||
|
return header;
|
||||||
|
}
|
||||||
|
|
||||||
// See if pkg-config can do everything for us.
|
// See if pkg-config can do everything for us.
|
||||||
match pkg_config::Config::new().print_system_libs(false).probe("sqlite3") {
|
match pkg_config::Config::new().print_system_libs(false).probe("sqlite3") {
|
||||||
Ok(mut lib) => {
|
Ok(mut lib) => {
|
||||||
@ -100,6 +107,23 @@ mod build {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "vcpkg")]
|
||||||
|
fn try_vcpkg() -> Option<HeaderLocation> {
|
||||||
|
// See if vcpkg can find it.
|
||||||
|
if let Ok(mut lib) = vcpkg::Config::new().probe("sqlite3") {
|
||||||
|
if let Some(mut header) = lib.include_paths.pop() {
|
||||||
|
header.push("sqlite3.h");
|
||||||
|
return Some(HeaderLocation::FromPath(header.to_string_lossy().into()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "vcpkg"))]
|
||||||
|
fn try_vcpkg() -> Option<HeaderLocation> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "buildtime_bindgen"))]
|
#[cfg(not(feature = "buildtime_bindgen"))]
|
||||||
mod bindings {
|
mod bindings {
|
||||||
use super::HeaderLocation;
|
use super::HeaderLocation;
|
||||||
|
Loading…
Reference in New Issue
Block a user