Skip to content

Commit

Permalink
Find GRPC & GRPC Linux Fixes (#101)
Browse files Browse the repository at this point in the history
* Update enigma-dev submodule with latest CMake fixes that actually search for GRPC.
* Default GRPC to on for all platforms.
* Macro guard GRPC server plugin header in main window.
* Manually enter "127.0.0.1" for now since Linux GRPC has broken DNS currently which cannot resolve "localhost" address.
* Add test to check that `-nogrpc` flag works.
  • Loading branch information
fundies authored Mar 15, 2020
1 parent df9c711 commit b3cc0ac
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 25 deletions.
44 changes: 22 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
cmake_minimum_required(VERSION 3.11)

include(CMakeDependentOption)
cmake_dependent_option(RGM_ENABLE_GRPC_SERVER "Enable the GRPC client plugin for compilation and code analysis." ON "WIN32" OFF)
option(RGM_ENABLE_GRPC_SERVER "Enable the GRPC client plugin for compilation and code analysis." ON)

if (CMAKE_BUILD_TYPE MATCHES "Debug")
set(EXE "RadialGM-Debug")
Expand Down Expand Up @@ -181,15 +180,15 @@ endif()

message(STATUS "Initial build flags:")
set(CompilerFlags
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
)
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
)

foreach(CompilerFlag ${CompilerFlags})
message(STATUS " '${CompilerFlag}': ${${CompilerFlag}}")
Expand All @@ -213,17 +212,18 @@ include_directories(${EXE} PRIVATE ${RAPIDJSON_INCLUDE_DIRS})
find_package(yaml-cpp CONFIG REQUIRED)
target_link_libraries(${EXE} PRIVATE yaml-cpp)

#Find gRPC
if (MSVC) # Windows actually does something right for once
find_package(gRPC CONFIG REQUIRED)
target_link_libraries(${EXE} PRIVATE gRPC::gpr gRPC::grpc gRPC::grpc++)
else() # https://tinyurl.com/arch-grpc-bug
find_library(LIB_GRPC_UNSECURE NAMES grpc++_unsecure)
find_library(LIB_GRPC NAMES grpc)
find_library(LIB_GPR NAMES gpr)
find_library(LIB_CARES NAMES cares)
find_library(LIB_ADDRESS_SORTING NAMES address_sorting)
target_link_libraries(${EXE} PRIVATE ${LIB_CARES} ${LIB_ADDRESS_SORTING} ${LIB_GPR} ${LIB_GRPC} ${LIB_GRPC_UNSECURE})
if (RGM_ENABLE_GRPC_SERVER)
#Find gRPC
if (MSVC) # Windows actually does something right for once
find_package(gRPC CONFIG REQUIRED)
target_link_libraries(${EXE} PRIVATE gRPC::gpr gRPC::grpc gRPC::grpc++)
else() # https://tinyurl.com/arch-grpc-bug
find_library(LIB_GRPC_UNSECURE NAMES grpc++_unsecure)
find_library(LIB_GPR NAMES gpr)
find_library(LIB_CARES NAMES cares)
find_library(LIB_ADDRESS_SORTING NAMES address_sorting)
target_link_libraries(${EXE} PRIVATE ${LIB_CARES} ${LIB_ADDRESS_SORTING} ${LIB_GPR} ${LIB_GRPC_UNSECURE})
endif()
endif()

# Find Protobuf
Expand Down
3 changes: 3 additions & 0 deletions MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
#include "Components/Logger.h"

#include "Plugins/RGMPlugin.h"

#ifdef RGM_SERVER_ENABLED
#include "Plugins/ServerPlugin.h"
#endif

#include "gmk.h"
#include "gmx.h"
Expand Down
3 changes: 2 additions & 1 deletion Plugins/ServerPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ ServerPlugin::ServerPlugin(MainWindow& mainWindow) : RGMPlugin(mainWindow) {
process->waitForStarted();

// construct the channel and connect to the server running in the process
std::shared_ptr<Channel> channel = CreateChannel("localhost:37818", InsecureChannelCredentials());
// Note: gRPC is too dumb to resolve localhost on linux
std::shared_ptr<Channel> channel = CreateChannel("127.0.0.1:37818", InsecureChannelCredentials());
compilerClient = new CompilerClient(channel, mainWindow);
connect(compilerClient, &CompilerClient::CompileStatusChanged, this, &RGMPlugin::CompileStatusChanged);
// hookup emake's output to our plugin's output signals so it redirects to the
Expand Down
2 changes: 1 addition & 1 deletion Submodules/enigma-dev
Submodule enigma-dev updated 91 files
+3 −3 CI/build_and_run_game.sh
+16 −3 CommandLine/emake/Main.cpp
+1 −1 CommandLine/emake/OptionsParser.cpp
+2 −4 CompilerSource/backend/ideprint.cpp
+1 −16 CompilerSource/main.cpp
+1 −1 Compilers/Linux/Android.ey
+1 −1 Compilers/Linux/AppleCross64.ey
+2 −2 Compilers/Linux/MinGW32.ey
+2 −2 Compilers/Linux/MinGW64.ey
+1 −1 Compilers/Linux/TestHarness.ey
+1 −1 Compilers/Linux/clang.ey
+1 −1 Compilers/Linux/clang32.ey
+1 −1 Compilers/Linux/gcc.ey
+1 −1 Compilers/Linux/gcc32.ey
+1 −1 Compilers/MacOSX/clang.ey
+1 −1 Compilers/MacOSX/gcc.ey
+1 −1 Compilers/Windows/gcc.ey
+3 −0 ENIGMAsystem/SHELL/Audio_Systems/DirectSound/DSsystem.h
+3 −0 ENIGMAsystem/SHELL/Audio_Systems/FMODAudio/FMOD_main.cpp
+2 −0 ENIGMAsystem/SHELL/Bridges/SDL-OpenGL/graphics_bridge.cpp
+3 −0 ENIGMAsystem/SHELL/Bridges/Win32-Direct3D11/graphics_bridge.cpp
+3 −0 ENIGMAsystem/SHELL/Bridges/Win32-Direct3D9/graphics_bridge.cpp
+5 −0 ENIGMAsystem/SHELL/Bridges/Win32-OpenGL/graphics_bridge.cpp
+3 −0 ENIGMAsystem/SHELL/Bridges/Win32/WINDOWShandle.h
+2 −8 ENIGMAsystem/SHELL/Bridges/xlib-OpenGL/graphics_bridge.cpp
+2 −2 ENIGMAsystem/SHELL/Graphics_Systems/Direct3D11/DX11d3d.cpp
+1 −2 ENIGMAsystem/SHELL/Graphics_Systems/Direct3D11/DX11surface.cpp
+4 −4 ENIGMAsystem/SHELL/Graphics_Systems/Direct3D11/DX11textures.cpp
+6 −6 ENIGMAsystem/SHELL/Graphics_Systems/Direct3D11/DX11vertex.cpp
+1 −1 ENIGMAsystem/SHELL/Graphics_Systems/Direct3D11/Makefile
+6 −6 ENIGMAsystem/SHELL/Graphics_Systems/Direct3D9/DX9surface.cpp
+2 −2 ENIGMAsystem/SHELL/Graphics_Systems/Direct3D9/DX9surface_impl.h
+8 −8 ENIGMAsystem/SHELL/Graphics_Systems/Direct3D9/DX9textures.cpp
+6 −6 ENIGMAsystem/SHELL/Graphics_Systems/Direct3D9/DX9vertex.cpp
+1 −1 ENIGMAsystem/SHELL/Graphics_Systems/General/GSmodel.cpp
+2 −3 ENIGMAsystem/SHELL/Graphics_Systems/General/GStextures.cpp
+4 −1 ENIGMAsystem/SHELL/Graphics_Systems/General/GStextures_impl.h
+1 −1 ENIGMAsystem/SHELL/Graphics_Systems/General/GStiles.cpp
+22 −23 ENIGMAsystem/SHELL/Graphics_Systems/General/GSvertex.cpp
+5 −3 ENIGMAsystem/SHELL/Graphics_Systems/General/GSvertex_impl.h
+2 −6 ENIGMAsystem/SHELL/Graphics_Systems/OpenGL-Common/d3d.cpp
+12 −8 ENIGMAsystem/SHELL/Graphics_Systems/OpenGL-Common/shader.cpp
+6 −1 ENIGMAsystem/SHELL/Graphics_Systems/OpenGL-Common/shader.h
+5 −4 ENIGMAsystem/SHELL/Graphics_Systems/OpenGL-Common/textures.cpp
+1 −0 ENIGMAsystem/SHELL/Graphics_Systems/OpenGL-Common/types.cpp
+4 −4 ENIGMAsystem/SHELL/Graphics_Systems/OpenGL-Common/vertex.cpp
+8 −2 ENIGMAsystem/SHELL/Graphics_Systems/OpenGL1/GLSLshader.h
+25 −17 ENIGMAsystem/SHELL/Graphics_Systems/OpenGL1/shader.cpp
+6 −6 ENIGMAsystem/SHELL/Graphics_Systems/OpenGL1/std.cpp
+6 −6 ENIGMAsystem/SHELL/Graphics_Systems/OpenGL1/vertex.cpp
+2 −1 ENIGMAsystem/SHELL/Makefile
+4 −1 ENIGMAsystem/SHELL/Platforms/General/PFthreads_impl.h
+3 −0 ENIGMAsystem/SHELL/Platforms/General/PFwindow.h
+37 −0 ENIGMAsystem/SHELL/Platforms/SDL/Icon.cpp
+24 −0 ENIGMAsystem/SHELL/Platforms/SDL/Icon.h
+25 −0 ENIGMAsystem/SHELL/Platforms/SDL/Window.cpp
+3 −0 ENIGMAsystem/SHELL/Platforms/Win32/WINDOWScallback.cpp
+3 −0 ENIGMAsystem/SHELL/Platforms/Win32/WINDOWSexternals.cpp
+3 −0 ENIGMAsystem/SHELL/Platforms/Win32/WINDOWSfilemanip.cpp
+49 −0 ENIGMAsystem/SHELL/Platforms/Win32/WINDOWSicon.cpp
+24 −0 ENIGMAsystem/SHELL/Platforms/Win32/WINDOWSicon.h
+3 −0 ENIGMAsystem/SHELL/Platforms/Win32/WINDOWSjoystick.cpp
+3 −0 ENIGMAsystem/SHELL/Platforms/Win32/WINDOWSmain.h
+3 −0 ENIGMAsystem/SHELL/Platforms/Win32/WINDOWSregistry.cpp
+3 −0 ENIGMAsystem/SHELL/Platforms/Win32/WINDOWSsystem.cpp
+29 −0 ENIGMAsystem/SHELL/Platforms/Win32/WINDOWSwindow.cpp
+3 −1 ENIGMAsystem/SHELL/Platforms/xlib/Makefile
+44 −0 ENIGMAsystem/SHELL/Platforms/xlib/XLIBicon.cpp
+24 −0 ENIGMAsystem/SHELL/Platforms/xlib/XLIBicon.h
+27 −0 ENIGMAsystem/SHELL/Platforms/xlib/XLIBwindow.cpp
+4 −1 ENIGMAsystem/SHELL/Universal_System/Extensions/DirectShow/DSvideo.cpp
+3 −0 ENIGMAsystem/SHELL/Universal_System/Extensions/FileDropper/FileDropper.cpp
+3 −0 ENIGMAsystem/SHELL/Universal_System/Extensions/IniFilesystem/WINDOWSinifs.cpp
+3 −0 ENIGMAsystem/SHELL/Universal_System/Extensions/MediaControlInterface/CDfunctions.cpp
+3 −0 ENIGMAsystem/SHELL/Universal_System/Extensions/WindowsTouch/WINDOWStouch.cpp
+3 −0 ENIGMAsystem/SHELL/Universal_System/Extensions/XInput/XIgamepad.cpp
+2 −0 ENIGMAsystem/SHELL/Universal_System/Resources/sprites_internal.h
+7 −5 ENIGMAsystem/SHELL/Universal_System/Resources/spritestruct.cpp
+3 −0 ENIGMAsystem/SHELL/Universal_System/estring.cpp
+29 −2 ENIGMAsystem/SHELL/Universal_System/image_formats.cpp
+2 −0 ENIGMAsystem/SHELL/Universal_System/image_formats.h
+2 −0 ENIGMAsystem/SHELL/Widget_Systems/None/nowidget_impl.cpp
+3 −0 ENIGMAsystem/SHELL/Widget_Systems/Win32/dialogs.cpp
+3 −0 ENIGMAsystem/SHELL/Widget_Systems/Win32/menus.cpp
+3 −0 ENIGMAsystem/SHELL/Widget_Systems/Win32/resources.rc
+3 −0 ENIGMAsystem/SHELL/Widget_Systems/Win32/widgets.cpp
+3 −0 ENIGMAsystem/SHELL/Widget_Systems/xlib/Makefile
+1 −1 Makefile
+0 −2 logs/.gitignore
+1 −1 share_logs.sh
+35 −29 shared/protos/CMakeLists.txt
50 changes: 49 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,62 @@ jobs:
sudo mount --bind ./root.x86_64/ ./root.x86_64/
sudo cp -R $(Build.SourcesDirectory) ./root.x86_64/RGM
cat << EOF | sudo ./root.x86_64/bin/arch-chroot ./root.x86_64/
set -e
echo 'Server = https://mirrors.kernel.org/archlinux/\$repo/os/\$arch' >> /etc/pacman.d/mirrorlist
pacman-key --init
pacman-key --populate archlinux
pacman -Sy --noconfirm base base-devel git gcc cmake protobuf grpc yaml-cpp pugixml rapidjson boost qt5 qscintilla-qt5
pacman -Sy --noconfirm base base-devel git gcc cmake protobuf yaml-cpp pugixml rapidjson boost qt5 qscintilla-qt5
EOF
displayName: 'Bootstrap Archlinux'
- bash: |
set -e
cd $(Build.BinariesDirectory)
cat << EOF | sudo ./root.x86_64/bin/arch-chroot ./root.x86_64/
set -e
cd RGM
mkdir build
cd build
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=MinSizeRel -DRGM_ENABLE_GRPC_SERVER=OFF ..
make
make install
cd ..
git clean -fx
rm -rf build/
EOF
displayName: 'Release Build (No gRPC)'
- bash: |
set -e
cd $(Build.BinariesDirectory)
cat << EOF | sudo ./root.x86_64/bin/arch-chroot ./root.x86_64/
set -e
cd RGM
mkdir build
cd build
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DRGM_ENABLE_GRPC_SERVER=OFF ..
make
make install
cd ..
git clean -fx
rm -rf build/
EOF
displayName: 'Debug Build (No gRPC)'
- bash: |
set -e
cd $(Build.BinariesDirectory)
cat << EOF | sudo ./root.x86_64/bin/arch-chroot ./root.x86_64/
set -e
pacman -S --noconfirm grpc
EOF
displayName: 'Install gRPC'
- bash: |
set -e
cd $(Build.BinariesDirectory)
cat << EOF | sudo ./root.x86_64/bin/arch-chroot ./root.x86_64/
set -e
cd RGM
mkdir build
cd build
Expand All @@ -218,13 +263,15 @@ jobs:
make install
cd ..
git clean -fx
rm -rf build/
EOF
displayName: 'Release Build'
- bash: |
set -e
cd $(Build.BinariesDirectory)
cat << EOF | sudo ./root.x86_64/bin/arch-chroot ./root.x86_64/
set -e
cd RGM
mkdir build
cd build
Expand All @@ -233,6 +280,7 @@ jobs:
make install
cd ..
git clean -fx
rm -rf build/
EOF
displayName: 'Debug Build'
Expand Down

0 comments on commit b3cc0ac

Please sign in to comment.