]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
build system modifications
authorRamakrishnan Muthukrishnan <ram@leastauthority.com>
Fri, 17 Feb 2023 09:39:58 +0000 (15:09 +0530)
committerRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Wed, 9 Aug 2023 13:34:44 +0000 (19:04 +0530)
Makefile
main.c

index f7c1163debbc43e5d0b8391d1d643a7f384c2328..46b63e4589c6a5ddd22533925d91ab27ba5f1005 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -174,7 +174,15 @@ ifeq ($(UNAME_S), Linux)
 RT_OPTION=-lrt
 endif
 
-LIBS=$(RT_OPTION) -lfftw3 -lm -lwdsp -lpthread $(AUDIO_LIBS) $(USBOZY_LIBS) $(GTKLIBS) $(GPIO_LIBS) $(MIDI_LIBS)
+ifeq ($(UNAME_S), Darwin)
+SYSLIBS=-framework IOKit
+endif
+
+RUST_LIB=-Lrust/target/debug -lhpsdr
+
+LIBS=  $(LDFLAGS) $(AUDIO_LIBS) $(USBOZY_LIBS) $(GTKLIBS) $(GPIO_LIBS) $(SOAPYSDRLIBS) $(STEMLAB_LIBS) \
+       $(MIDI_LIBS) $(RUST_LIB) -lwdsp -lpthread -lm $(SYSLIBS)
+
 INCLUDES=$(GTKINCLUDES)
 
 COMPILE=$(CC) $(CFLAGS) $(OPTIONS) $(INCLUDES)
@@ -260,7 +268,8 @@ encoder_menu.c \
 switch_menu.c \
 toolbar_menu.c
 
-
+RUST_SRC=\
+rust/lib.rs
 
 HEADERS= \
 agc.h \
@@ -419,7 +428,8 @@ toolbar_menu.o
 
 $(PROGRAM):  $(OBJS) $(AUDIO_OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) \
                $(LOCALCW_OBJS) $(PURESIGNAL_OBJS) \
-               $(MIDI_OBJS) $(SERVER_OBJS)
+               $(MIDI_OBJS) $(STEMLAB_OBJS) $(SERVER_OBJS) \
+               libhpsdr
        $(LINK) -o $(PROGRAM) $(OBJS) $(AUDIO_OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) \
                $(LOCALCW_OBJS) $(PURESIGNAL_OBJS) \
                $(MIDI_OBJS) $(SERVER_OBJS) $(LIBS)
@@ -497,8 +507,8 @@ controller2v2: clean $(PROGRAM)
 #
 #############################################################################
 
-hpsdrsim.o:    hpsdrsim.c hpsdrsim.h
-       $(CC) -c -O -DALSASOUND hpsdrsim.c
+hpsdrsim.o:     hpsdrsim.c  hpsdrsim.h
+       $(CC) -c -O hpsdrsim.c
 
 newhpsdrsim.o: newhpsdrsim.c hpsdrsim.h
        $(CC) -c -O newhpsdrsim.c
@@ -515,3 +525,42 @@ debian:
        cp release/pihpsdr/pihpsdr.desktop pkg/pihpsdr/usr/share/applications
        cd pkg; dpkg-deb --build pihpsdr
 
+libhpsdr:
+       cd rust && \
+       cargo build && \
+       cd ..
+#############################################################################
+#
+# This is for MacOS "app" creation ONLY
+#
+#       The piHPSDR working directory is
+#      $HOME -> Application Support -> piHPSDR
+#
+#       That is the directory where the WDSP wisdom file (created upon first
+#       start of piHPSDR) but also the radio settings and the midi.props file
+#       are stored.
+#
+#       No libraries are included in the app bundle, so it will only run
+#       on the computer where it was created, and on other computers which
+#       have all libraries (including WDSP) and possibly the SoapySDR support
+#       modules installed.
+#############################################################################
+
+.PHONY: app
+app:   $(OBJS) $(AUDIO_OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS)  $(SOAPYSDR_OBJS) \
+               $(LOCALCW_OBJS) $(PURESIGNAL_OBJS) \
+               $(MIDI_OBJS) $(STEMLAB_OBJS) $(SERVER_OBJS)
+       $(LINK) -headerpad_max_install_names -o $(PROGRAM) $(OBJS) $(AUDIO_OBJS) $(REMOTE_OBJS)  $(USBOZY_OBJS)  \
+               $(SOAPYSDR_OBJS) $(LOCALCW_OBJS) $(PURESIGNAL_OBJS) \
+               $(MIDI_OBJS) $(STEMLAB_OBJS) $(SERVER_OBJS) $(LIBS) $(LDFLAGS)
+       @rm -rf pihpsdr.app
+       @mkdir -p pihpsdr.app/Contents/MacOS
+       @mkdir -p pihpsdr.app/Contents/Frameworks
+       @mkdir -p pihpsdr.app/Contents/Resources
+       @cp pihpsdr pihpsdr.app/Contents/MacOS/pihpsdr
+       @cp MacOS/PkgInfo pihpsdr.app/Contents
+       @cp MacOS/Info.plist pihpsdr.app/Contents
+       @cp MacOS/hpsdr.icns pihpsdr.app/Contents/Resources/hpsdr.icns
+       @cp MacOS/hpsdr.png pihpsdr.app/Contents/Resources
+#############################################################################
+
diff --git a/main.c b/main.c
index b427f82c74ccba28be839e45a7d7bfbfeb024471..0d015e0a06f72514ff282e5aacd39bde3715f93b 100644 (file)
--- a/main.c
+++ b/main.c
@@ -67,6 +67,8 @@ gint display_width;
 gint display_height;
 gint full_screen = 1;
 
+extern size_t add(size_t left, size_t right);
+
 static GtkWidget *discovery_dialog;
 
 static GdkCursor *cursor_arrow;
@@ -343,7 +345,12 @@ int main(int argc, char **argv) {
 
   char name[1024];
 
-  sprintf(name, "com.verdure.sdr.pid%d", getpid());
+  printf("calling rust add fn: %d\n", add(40, 2));
+
+#ifdef __APPLE__
+  void MacOSstartup(char *path);
+  MacOSstartup(argv[0]);
+#endif
 
   // fprintf(stderr,"gtk_application_new: %s\n",name);