Skip to content

Commit b3cc0ac

Browse files
authored
Find GRPC & GRPC Linux Fixes (#101)
* 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.
1 parent df9c711 commit b3cc0ac

File tree

5 files changed

+77
-25
lines changed

5 files changed

+77
-25
lines changed

CMakeLists.txt

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
cmake_minimum_required(VERSION 3.11)
22

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

65
if (CMAKE_BUILD_TYPE MATCHES "Debug")
76
set(EXE "RadialGM-Debug")
@@ -181,15 +180,15 @@ endif()
181180

182181
message(STATUS "Initial build flags:")
183182
set(CompilerFlags
184-
CMAKE_C_FLAGS_DEBUG
185-
CMAKE_C_FLAGS_MINSIZEREL
186-
CMAKE_C_FLAGS_RELEASE
187-
CMAKE_C_FLAGS_RELWITHDEBINFO
188-
CMAKE_CXX_FLAGS_DEBUG
189-
CMAKE_CXX_FLAGS_MINSIZEREL
190-
CMAKE_CXX_FLAGS_RELEASE
191-
CMAKE_CXX_FLAGS_RELWITHDEBINFO
192-
)
183+
CMAKE_C_FLAGS_DEBUG
184+
CMAKE_C_FLAGS_MINSIZEREL
185+
CMAKE_C_FLAGS_RELEASE
186+
CMAKE_C_FLAGS_RELWITHDEBINFO
187+
CMAKE_CXX_FLAGS_DEBUG
188+
CMAKE_CXX_FLAGS_MINSIZEREL
189+
CMAKE_CXX_FLAGS_RELEASE
190+
CMAKE_CXX_FLAGS_RELWITHDEBINFO
191+
)
193192

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

216-
#Find gRPC
217-
if (MSVC) # Windows actually does something right for once
218-
find_package(gRPC CONFIG REQUIRED)
219-
target_link_libraries(${EXE} PRIVATE gRPC::gpr gRPC::grpc gRPC::grpc++)
220-
else() # https://tinyurl.com/arch-grpc-bug
221-
find_library(LIB_GRPC_UNSECURE NAMES grpc++_unsecure)
222-
find_library(LIB_GRPC NAMES grpc)
223-
find_library(LIB_GPR NAMES gpr)
224-
find_library(LIB_CARES NAMES cares)
225-
find_library(LIB_ADDRESS_SORTING NAMES address_sorting)
226-
target_link_libraries(${EXE} PRIVATE ${LIB_CARES} ${LIB_ADDRESS_SORTING} ${LIB_GPR} ${LIB_GRPC} ${LIB_GRPC_UNSECURE})
215+
if (RGM_ENABLE_GRPC_SERVER)
216+
#Find gRPC
217+
if (MSVC) # Windows actually does something right for once
218+
find_package(gRPC CONFIG REQUIRED)
219+
target_link_libraries(${EXE} PRIVATE gRPC::gpr gRPC::grpc gRPC::grpc++)
220+
else() # https://tinyurl.com/arch-grpc-bug
221+
find_library(LIB_GRPC_UNSECURE NAMES grpc++_unsecure)
222+
find_library(LIB_GPR NAMES gpr)
223+
find_library(LIB_CARES NAMES cares)
224+
find_library(LIB_ADDRESS_SORTING NAMES address_sorting)
225+
target_link_libraries(${EXE} PRIVATE ${LIB_CARES} ${LIB_ADDRESS_SORTING} ${LIB_GPR} ${LIB_GRPC_UNSECURE})
226+
endif()
227227
endif()
228228

229229
# Find Protobuf

MainWindow.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
#include "Components/Logger.h"
2121

2222
#include "Plugins/RGMPlugin.h"
23+
24+
#ifdef RGM_SERVER_ENABLED
2325
#include "Plugins/ServerPlugin.h"
26+
#endif
2427

2528
#include "gmk.h"
2629
#include "gmx.h"

Plugins/ServerPlugin.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ ServerPlugin::ServerPlugin(MainWindow& mainWindow) : RGMPlugin(mainWindow) {
272272
process->waitForStarted();
273273

274274
// construct the channel and connect to the server running in the process
275-
std::shared_ptr<Channel> channel = CreateChannel("localhost:37818", InsecureChannelCredentials());
275+
// Note: gRPC is too dumb to resolve localhost on linux
276+
std::shared_ptr<Channel> channel = CreateChannel("127.0.0.1:37818", InsecureChannelCredentials());
276277
compilerClient = new CompilerClient(channel, mainWindow);
277278
connect(compilerClient, &CompilerClient::CompileStatusChanged, this, &RGMPlugin::CompileStatusChanged);
278279
// hookup emake's output to our plugin's output signals so it redirects to the

Submodules/enigma-dev

Submodule enigma-dev updated 91 files

azure-pipelines.yml

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,17 +199,62 @@ jobs:
199199
sudo mount --bind ./root.x86_64/ ./root.x86_64/
200200
sudo cp -R $(Build.SourcesDirectory) ./root.x86_64/RGM
201201
cat << EOF | sudo ./root.x86_64/bin/arch-chroot ./root.x86_64/
202+
set -e
202203
echo 'Server = https://mirrors.kernel.org/archlinux/\$repo/os/\$arch' >> /etc/pacman.d/mirrorlist
203204
pacman-key --init
204205
pacman-key --populate archlinux
205-
pacman -Sy --noconfirm base base-devel git gcc cmake protobuf grpc yaml-cpp pugixml rapidjson boost qt5 qscintilla-qt5
206+
pacman -Sy --noconfirm base base-devel git gcc cmake protobuf yaml-cpp pugixml rapidjson boost qt5 qscintilla-qt5
206207
EOF
207208
displayName: 'Bootstrap Archlinux'
209+
210+
- bash: |
211+
set -e
212+
cd $(Build.BinariesDirectory)
213+
cat << EOF | sudo ./root.x86_64/bin/arch-chroot ./root.x86_64/
214+
set -e
215+
cd RGM
216+
mkdir build
217+
cd build
218+
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=MinSizeRel -DRGM_ENABLE_GRPC_SERVER=OFF ..
219+
make
220+
make install
221+
cd ..
222+
git clean -fx
223+
rm -rf build/
224+
EOF
225+
displayName: 'Release Build (No gRPC)'
226+
227+
- bash: |
228+
set -e
229+
cd $(Build.BinariesDirectory)
230+
cat << EOF | sudo ./root.x86_64/bin/arch-chroot ./root.x86_64/
231+
set -e
232+
cd RGM
233+
mkdir build
234+
cd build
235+
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DRGM_ENABLE_GRPC_SERVER=OFF ..
236+
make
237+
make install
238+
cd ..
239+
git clean -fx
240+
rm -rf build/
241+
EOF
242+
displayName: 'Debug Build (No gRPC)'
243+
244+
- bash: |
245+
set -e
246+
cd $(Build.BinariesDirectory)
247+
cat << EOF | sudo ./root.x86_64/bin/arch-chroot ./root.x86_64/
248+
set -e
249+
pacman -S --noconfirm grpc
250+
EOF
251+
displayName: 'Install gRPC'
208252
209253
- bash: |
210254
set -e
211255
cd $(Build.BinariesDirectory)
212256
cat << EOF | sudo ./root.x86_64/bin/arch-chroot ./root.x86_64/
257+
set -e
213258
cd RGM
214259
mkdir build
215260
cd build
@@ -218,13 +263,15 @@ jobs:
218263
make install
219264
cd ..
220265
git clean -fx
266+
rm -rf build/
221267
EOF
222268
displayName: 'Release Build'
223269
224270
- bash: |
225271
set -e
226272
cd $(Build.BinariesDirectory)
227273
cat << EOF | sudo ./root.x86_64/bin/arch-chroot ./root.x86_64/
274+
set -e
228275
cd RGM
229276
mkdir build
230277
cd build
@@ -233,6 +280,7 @@ jobs:
233280
make install
234281
cd ..
235282
git clean -fx
283+
rm -rf build/
236284
EOF
237285
displayName: 'Debug Build'
238286

0 commit comments

Comments
 (0)