-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from fergusL/grpc-stuff
gRPC c++ driver/python server
- Loading branch information
Showing
32 changed files
with
9,275 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Makefile for libHuntsmanDome | ||
|
||
CXX = g++ | ||
CFLAGS = -fPIC -Wall -Wextra -O2 -g -DSB_LINUX_BUILD -I. -I./src/licensedinterfaces/\ | ||
-L/usr/local/lib -lprotobuf -pthread -lgrpc++ -pthread -I/usr/local/include | ||
|
||
CPPFLAGS = -fPIC -Wall -Wextra -O2 -g -DSB_LINUX_BUILD -I. -I./src/licensedinterfaces/ -I/usr/local/include\ | ||
-L/usr/local/lib -lprotobuf -pthread -lgrpc++ -pthread | ||
|
||
CXXFLAGS += -std=c++11 | ||
|
||
LDFLAGS = -shared -lstdc++ -L/usr/local/lib -lprotobuf -pthread -lgrpc++\ | ||
-Wl,--no-as-needed -lgrpc++_reflection -Wl,--as-needed -ldl | ||
|
||
|
||
RM = rm -f | ||
STRIP = strip | ||
TARGET_LIB = libHuntsmanDome.so | ||
|
||
SRCS = src/main.cpp src/x2dome.cpp src/hx2dome.grpc.pb.cpp src/hx2dome.pb.cpp | ||
OBJS = $(SRCS:.cpp=.o) | ||
|
||
.PHONY: all | ||
all: ${TARGET_LIB} | ||
|
||
$(TARGET_LIB): $(OBJS) | ||
$(CXX) $^ ${LDFLAGS} -o $@ | ||
$(STRIP) $@ >/dev/null 2>&1 || true | ||
|
||
$(SRCS:.cpp=.d):%.d:%.cpp | ||
$(CXX) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -MM $< >$@ | ||
|
||
|
||
.PHONY: clean | ||
clean: | ||
${RM} ${TARGET_LIB} ${OBJS} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
|
||
|
||
TheSkyX_Install=`/usr/bin/find ~/Library/Application\ Support/Software\ Bisque/ -name TheSkyXInstallPath.txt` | ||
echo "TheSkyX_Install = $TheSkyX_Install" | ||
|
||
if [ ! -f "$TheSkyX_Install" ]; then | ||
echo TheSkyXInstallPath.txt not found | ||
TheSkyX_Path=`/usr/bin/find ~/ -maxdepth 3 -name TheSkyX` | ||
if [ -d "$TheSkyX_Path" ]; then | ||
TheSkyX_Path="${TheSkyX_Path}/Contents" | ||
else | ||
echo TheSkyX application was not found. | ||
exit 1 | ||
fi | ||
else | ||
TheSkyX_Path=$(<"$TheSkyX_Install") | ||
fi | ||
|
||
echo "Installing to $TheSkyX_Path" | ||
|
||
|
||
if [ ! -d "$TheSkyX_Path" ]; then | ||
echo TheSkyX Install dir not exist | ||
exit 1 | ||
fi | ||
|
||
if [ -d "$TheSkyX_Path/Resources/Common/PlugIns64" ]; then | ||
PLUGINS_DIR="PlugIns64" | ||
else | ||
PLUGINS_DIR="PlugIns" | ||
fi | ||
|
||
cp "./domelist HuntsmanDome.txt" "$TheSkyX_Path/Resources/Common/Miscellaneous Files/" | ||
cp "./libHuntsmanDome.so" "$TheSkyX_Path/Resources/Common/$PLUGINS_DIR/DomePlugIns/" | ||
|
||
app_owner=`/usr/bin/stat -c "%u" "$TheSkyX_Path" | xargs id -n -u` | ||
if [ ! -z "$app_owner" ]; then | ||
chown $app_owner "$TheSkyX_Path/Resources/Common/Miscellaneous Files/domelist HuntsmanDome.txt" | ||
chown $app_owner "$TheSkyX_Path/Resources/Common/$PLUGINS_DIR/DomePlugIns/libHuntsmanDome.so" | ||
fi | ||
chmod 755 "$TheSkyX_Path/Resources/Common/$PLUGINS_DIR/DomePlugIns/libHuntsmanDome.so" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
//See hardwarelist.txt for details on this file format. | ||
//Version|Manufacturer|Model|Comment|MapsTo|PlugInDllName|X2Developer|Windows|Mac|Linux| | ||
1|Huntsman Telescope|Huntsman Telescope Dome Controller v1| | |libHuntsmanDome||0|0|1| | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
if [ "$1" == "clean" ]; then | ||
rm libhuntsmandome* | ||
rm src/*.grpc.pb.* | ||
rm src/*.pb.* | ||
rm *.o | ||
rm .qmake.stash | ||
else | ||
HDOME_PATH="$HOME/Documents/REPOS" | ||
PROTOS_PATH="$HDOME_PATH/huntsman-dome/domehunter/protos/src/" | ||
PROTO_PATH1="/usr/local/include/google/protobuf/" | ||
PROTO_PATH2="$HDOME_PATH/huntsman-dome/domehunter/protos/src/hx2dome.proto" | ||
GRPC_CPP_PLUGIN_PATH="$(which grpc_cpp_plugin)" | ||
|
||
echo -e "Generating GRPC C++ code\n" | ||
|
||
echo -e "protoc -I $PROTOS_PATH --cpp_out=. src/hx2dome.proto\n" | ||
protoc -I "$PROTOS_PATH" --cpp_out=. hx2dome.proto | ||
|
||
echo -e "protoc -I $PROTOS_PATH --grpc_out=. --proto_path=$PROTO_PATH1 $PROTO_PATH2 --plugin=protoc-gen-grpc=$GRPC_CPP_PLUGIN_PATH\n" | ||
protoc -I "$PROTOS_PATH" --grpc_out=. --proto_path="$PROTO_PATH1" "$PROTO_PATH2" --plugin=protoc-gen-grpc="$GRPC_CPP_PLUGIN_PATH" | ||
|
||
echo -e "Moving generated GRPC C++ code to src/\n" | ||
mv hx2dome.grpc.pb.cc src/hx2dome.grpc.pb.cpp | ||
mv hx2dome.pb.cc src/hx2dome.pb.cpp | ||
mv *.pb.h src/ | ||
|
||
#echo -e "Generating Makefile from project file.\n" | ||
#qmake | ||
|
||
#echo -e "Running Generated Makefile.\n" | ||
#make | ||
|
||
#echo -e "Cleaning out object files.\n" | ||
#rm *.o | ||
|
||
echo -e "Done.\n" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
if [ "$1" == "clean" ]; then | ||
rm src/*pb2_grpc.py | ||
rm src/*pb2.py | ||
else | ||
HDOME_PATH="$HOME/Documents/REPOS" | ||
PROTOS_PATH="$HDOME_PATH/huntsman-dome/domehunter/protos/src/" | ||
PROTO_PATH1="/usr/local/include/google/protobuf/" | ||
PROTO_PATH2="$HDOME_PATH/huntsman-dome/domehunter/protos/src/hx2dome.proto" | ||
|
||
echo -e "\nGenerating GRPC Python code\n" | ||
|
||
echo -e "python -m grpc_tools.protoc -I=$PROTOS_PATH --python_out=. --grpc_python_out=. --proto_path=$PROTO_PATH1 $PROTO_PATH2\n" | ||
|
||
python -m grpc_tools.protoc -I=$PROTOS_PATH --python_out=. --grpc_python_out=. --proto_path=$PROTO_PATH1 $PROTO_PATH2 | ||
|
||
echo -e "Moving generated GRPC Python code to src/\n" | ||
mv *pb2* src/ | ||
|
||
echo -e "Done.\n" | ||
fi |
Oops, something went wrong.