Skip to content

Commit

Permalink
Init rust lib
Browse files Browse the repository at this point in the history
Signed-off-by: Dusan Malusev <dusan@dusanmalusev.dev>
  • Loading branch information
CodeLieutenant committed Aug 6, 2023
1 parent a8a4ced commit b685080
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,9 @@ cassandra.log
/**/vendor/
/**/.idea/
/**/.idea/


# Added by cargo

/target
/Cargo.lock
10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "scylladb-php-driver"
version = "0.1.0"
edition = "2021"

[dependencies]


[build-dependencies]
cc = { version = "1.0", features = ["parallel"] }
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ COPY ./scripts /tmp/scripts

WORKDIR /tmp

RUN ./scripts/compile-php.sh -v $PHP_VERSION -o $HOME -s -d no -zts $PHP_ZTS \
RUN ./scripts/compile-php.sh -v $PHP_VERSION -o $HOME -d no -zts $PHP_ZTS \
&& $HOME/php/bin/php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& $HOME/php/bin/php composer-setup.php --install-dir=/bin --filename=composer \
&& $HOME/php/bin/php -r "unlink('composer-setup.php');" \
Expand Down
71 changes: 71 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
use std::fs::read_dir;

use cc::Build;

fn main() {
let mut build = Build::new();

build
.cpp(true)
.include("include")
.include("util/include")
.include("ZendCPP")
.include("ZendCPP/String")
.include(".")
.define("HAVE_DLFCN_H", Some("1"))
.define("HAVE_STDIO_H", Some("1"))
.define("HAVE_STDINT_H", Some("1"))
.define("HAVE_INTTYPES_H", Some("1"))
.define("HAVE_SYS_STAT_H", Some("1"))
.define("HAVE_SYS_TYPES_H", Some("1"))
.define("HAVE_STRING_H", Some("1"))
.define("HAVE_UNISTD_H", Some("1"))
.extra_warnings(true);

read_dir("src").unwrap().for_each(|entry| {
let entry = entry.unwrap();
let path = entry.path();

println!("{:?}", path);
let ext = path.extension().unwrap().to_str();

if ext == Some("cpp") || ext == Some("c") {
build.file(path);
}
});

read_dir("util/src").unwrap().for_each(|entry| {
let entry = entry.unwrap();
let path = entry.path();

let ext = path.extension().unwrap().to_str();

if ext == Some("cpp") || ext == Some("c") {
build.file(path);
}
});

read_dir("ZendCPP/String").unwrap().for_each(|entry| {
let entry = entry.unwrap();
let path = entry.path();

let ext = path.extension().unwrap().to_str();

if ext == Some("cpp") || ext == Some("c") {
build.file(path);
}
});

read_dir("ZendCPP").unwrap().for_each(|entry| {
let entry = entry.unwrap();
let path = entry.path();

let ext = path.extension().unwrap().to_str();

if ext == Some("cpp") || ext == Some("c") {
build.file(path);
}
});

build.compile("cassandra");
}
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

0 comments on commit b685080

Please sign in to comment.