rename to servicepoint, new dir structure, WIP build.rs

This commit is contained in:
Vinzenz Schroeter 2024-05-25 11:16:37 +02:00
parent e9dc4b59d2
commit f2d98af532
61 changed files with 751 additions and 140 deletions

View file

@ -5,6 +5,6 @@ edition = "2021"
publish = false
[dependencies]
servicepoint2 = { path = "../../servicepoint2" }
servicepoint = { path = "../../crates/servicepoint" }
clap = { version = "4.5", features = ["derive"] }
env_logger = "0.11"

View file

@ -1,6 +1,6 @@
use clap::Parser;
use servicepoint2::{ByteGrid, Command, Connection, Grid, Origin};
use servicepoint::{ByteGrid, Command, Connection, Grid, Origin};
#[derive(Parser, Debug)]
struct Cli {

View file

@ -5,7 +5,7 @@ edition = "2021"
publish = false
[dependencies]
servicepoint2 = { path = "../../servicepoint2" }
servicepoint = { path = "../../crates/servicepoint" }
clap = { version = "4.5", features = ["derive"] }
env_logger = "0.11"

View file

@ -3,7 +3,7 @@ use std::thread;
use clap::Parser;
use rand::{distributions, Rng};
use servicepoint2::*;
use servicepoint::*;
#[derive(Parser, Debug)]
struct Cli {

View file

@ -0,0 +1,13 @@
[package]
name = "lang_c"
version = "0.1.0"
edition = "2021"
publish = false
[lib]
[build-dependencies]
cc = "1.0"
[dependencies]
servicepoint = { path = "../../crates/servicepoint" }

View file

@ -1,8 +1,8 @@
ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
OUT_DIR := ${ROOT_DIR}/out
SP2_DIR := ${ROOT_DIR}/../../servicepoint2
SP2_INCLUDE := ${ROOT_DIR}/../../servicepoint2-binding-c
SP2_DIR := ${ROOT_DIR}/../../servicepoint
SP2_INCLUDE := ${ROOT_DIR}/../../servicepoint-binding-c
SP2_TARGET_RELEASE := ${SP2_DIR}/target/release
.PHONY: build run clean
@ -19,4 +19,4 @@ clean:
${OUT_DIR}/lang_c: main.c
cd ${SP2_DIR} && cargo build --release --all-features
mkdir -p ${OUT_DIR}
gcc main.c -I ${SP2_INCLUDE} -L ${SP2_TARGET_RELEASE} -Wl,-Bstatic -lservicepoint2 -Wl,-Bdynamic -o ${OUT_DIR}/lang_c
gcc main.c -I ${SP2_INCLUDE} -L ${SP2_TARGET_RELEASE} -Wl,-Bstatic -lservicepoint -Wl,-Bdynamic -o ${OUT_DIR}/lang_c

8
examples/lang_c/build.rs Normal file
View file

@ -0,0 +1,8 @@
fn main() {
println!("cargo::rerun-if-changed=src/main.c");
cc::Build::new()
.file("src/main.c")
.compile("lang_c");
}

View file

View file

@ -1,5 +1,5 @@
#include <stdio.h>
#include "servicepoint2.h"
#include "servicepoint.h"
int main(void) {
sp2_Connection *connection = sp2_connection_open("localhost:2342");

View file

@ -1,5 +1,5 @@
using ServicePoint2;
using CompressionCode = ServicePoint2.BindGen.CompressionCode;
using ServicePoint;
using CompressionCode = ServicePoint.BindGen.CompressionCode;
using var connection = Connection.Open("127.0.0.1:2342");

View file

@ -9,7 +9,7 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\servicepoint2-binding-cs\src\ServicePoint2.csproj"/>
<ProjectReference Include="..\..\servicepoint-binding-cs\src\ServicePoint.csproj"/>
</ItemGroup>
</Project>

View file

@ -5,6 +5,6 @@ edition = "2021"
publish = false
[dependencies]
servicepoint2 = { path = "../../servicepoint2" }
servicepoint = { path = "../../crates/servicepoint" }
clap = { version = "4.5", features = ["derive"] }
env_logger = "0.11"
env_logger = "0.11"

View file

@ -2,7 +2,7 @@ use std::thread;
use clap::Parser;
use servicepoint2::*;
use servicepoint::*;
#[derive(Parser, Debug)]
struct Cli {

View file

@ -5,7 +5,7 @@ edition = "2021"
publish = false
[dependencies]
servicepoint2 = { path = "../../servicepoint2" }
servicepoint = { path = "../../crates/servicepoint" }
clap = { version = "4.5", features = ["derive"] }
env_logger = "0.11"

View file

@ -3,8 +3,8 @@ use std::time::Duration;
use clap::Parser;
use rand::Rng;
use servicepoint2::Command::{BitmapLinearWin, Brightness, CharBrightness};
use servicepoint2::*;
use servicepoint::Command::{BitmapLinearWin, Brightness, CharBrightness};
use servicepoint::*;
#[derive(Parser, Debug)]
struct Cli {

View file

@ -5,6 +5,6 @@ edition = "2021"
publish = false
[dependencies]
servicepoint2 = { path = "../../servicepoint2" }
servicepoint = { path = "../../crates/servicepoint" }
clap = { version = "4.5", features = ["derive"] }
env_logger = "0.11"

View file

@ -3,7 +3,7 @@ use std::time::Duration;
use clap::Parser;
use servicepoint2::*;
use servicepoint::*;
#[derive(Parser, Debug)]
struct Cli {