From 0d362591bfd066c9a411e597a6b46ff6dc0aa2be Mon Sep 17 00:00:00 2001 From: "Ryan@WorkStation" Date: Mon, 23 Jan 2023 14:44:27 -0500 Subject: [PATCH] added SOLARISDAQ.cpp --- .gitignore | 1 + .vscode/c_cpp_properties.json | 4 +++- Makefile | 20 +++++++++++++++++--- SOLARISDAQ.cpp | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 SOLARISDAQ.cpp diff --git a/.gitignore b/.gitignore index 3f61981..26d7c27 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ test test_indep +SOLARISDAQ *.o *.sol \ No newline at end of file diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index ca4ceed..e983e48 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -4,7 +4,9 @@ "name": "Linux", "includePath": [ "${workspaceFolder}/**", - "/opt/root/include/" + "/opt/root/include/", + "/usr/include/**", + "/usr/lib/**" ], "defines": [], "compilerPath": "/usr/bin/gcc", diff --git a/Makefile b/Makefile index 023d1d9..0e43455 100644 --- a/Makefile +++ b/Makefile @@ -2,17 +2,31 @@ CC = g++ COPTS = -fPIC -DLINUX -O2 -std=c++17 -lpthread CAENLIBS = -lCAEN_FELib ROOTLIBS = `root-config --cflags --glibs` +GTK4LIBS =`pkg-config --cflags --libs gtk4` +CURLLIBS = -lcurl -all: test test_indep ClassDigitizer2Gen.o influxdb.o +OBJS = ClassDigitizer2Gen.o influxdb.o + +ALL = SOLARISDAQ test test_indep + +############################################################### + +all: $(ALL) + +clean : + /bin/rm -f $(OBJS) $(ALL) + +SOLARISDAQ : SOLARISDAQ.cpp $(OBJS) + $(CC) $(COPTS) $(OBJS) -o SOLARISDAQ SOLARISDAQ.cpp $(GTK4LIBS) $(CAENLIBS) $(CURLLIBS) test_indep : test_indep.cpp $(CC) $(COPTS) -o test_indep test_indep.cpp $(CAENLIBS) test : test.cpp ClassDigitizer2Gen.o influxdb.o - $(CC) $(COPTS) ClassDigitizer2Gen.o influxdb.o -o test test.cpp $(CAENLIBS) -lcurl + $(CC) $(COPTS) $(OBJS) -o test test.cpp $(CAENLIBS) $(CURLLIBS) ClassDigitizer2Gen.o : ClassDigitizer2Gen.cpp ClassDigitizer2Gen.h Event.h $(CC) $(COPTS) -c ClassDigitizer2Gen.cpp $(CAENLIBS) influxdb.o : influxdb.cpp influxdb.h - $(CC) $(COPTS) -c influxdb.cpp -lcurl + $(CC) $(COPTS) -c influxdb.cpp $(CURLLIBS) diff --git a/SOLARISDAQ.cpp b/SOLARISDAQ.cpp new file mode 100644 index 0000000..dcae95e --- /dev/null +++ b/SOLARISDAQ.cpp @@ -0,0 +1,34 @@ +#include + +static void print_hello (GtkWidget *widget, gpointer data){ + g_print ("Hello World\n"); +} + +static void activate (GtkApplication *app, gpointer user_data){ + + GtkWidget * window = gtk_application_window_new(app); + gtk_window_set_title( GTK_WINDOW(window), "SOLARIS DAQ"); + gtk_window_set_default_size( GTK_WINDOW(window), 300, 200); // w, h + + GtkWidget * box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); + gtk_widget_set_halign(box, GTK_ALIGN_CENTER); + gtk_widget_set_valign(box, GTK_ALIGN_CENTER); + gtk_window_set_child( GTK_WINDOW(window), box); + + GtkWidget * button = gtk_button_new_with_label("Hello World"); + g_signal_connect( button, "clicked", G_CALLBACK(print_hello), NULL); + g_signal_connect_swapped( button, "clicked", G_CALLBACK(gtk_window_destroy), window); + gtk_box_append( GTK_BOX(box), button); + + gtk_widget_show(window); +} + +int main (int argc, char **argv){ + + GtkApplication * app = gtk_application_new("example.example", G_APPLICATION_FLAGS_NONE); + g_signal_connect( app, "activate", G_CALLBACK(activate), NULL); + int status = g_application_run( G_APPLICATION(app), argc, argv); + g_object_unref( app); + + return status; +}