added SOLARISDAQ.cpp

This commit is contained in:
Ryan Tang 2023-01-23 14:44:27 -05:00
parent 63333f2663
commit 0d362591bf
4 changed files with 55 additions and 4 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
test test
test_indep test_indep
SOLARISDAQ
*.o *.o
*.sol *.sol

View File

@ -4,7 +4,9 @@
"name": "Linux", "name": "Linux",
"includePath": [ "includePath": [
"${workspaceFolder}/**", "${workspaceFolder}/**",
"/opt/root/include/" "/opt/root/include/",
"/usr/include/**",
"/usr/lib/**"
], ],
"defines": [], "defines": [],
"compilerPath": "/usr/bin/gcc", "compilerPath": "/usr/bin/gcc",

View File

@ -2,17 +2,31 @@ CC = g++
COPTS = -fPIC -DLINUX -O2 -std=c++17 -lpthread COPTS = -fPIC -DLINUX -O2 -std=c++17 -lpthread
CAENLIBS = -lCAEN_FELib CAENLIBS = -lCAEN_FELib
ROOTLIBS = `root-config --cflags --glibs` 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 test_indep : test_indep.cpp
$(CC) $(COPTS) -o test_indep test_indep.cpp $(CAENLIBS) $(CC) $(COPTS) -o test_indep test_indep.cpp $(CAENLIBS)
test : test.cpp ClassDigitizer2Gen.o influxdb.o 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 ClassDigitizer2Gen.o : ClassDigitizer2Gen.cpp ClassDigitizer2Gen.h Event.h
$(CC) $(COPTS) -c ClassDigitizer2Gen.cpp $(CAENLIBS) $(CC) $(COPTS) -c ClassDigitizer2Gen.cpp $(CAENLIBS)
influxdb.o : influxdb.cpp influxdb.h influxdb.o : influxdb.cpp influxdb.h
$(CC) $(COPTS) -c influxdb.cpp -lcurl $(CC) $(COPTS) -c influxdb.cpp $(CURLLIBS)

34
SOLARISDAQ.cpp Normal file
View File

@ -0,0 +1,34 @@
#include <gtk/gtk.h>
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;
}