diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index 5bffd8f0..1a229c5d 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -138,7 +138,7 @@ jobs: run: | mkdir build cd build - qmake .. CONFIG+=no_increase_build_number PREFIX=/usr + qmake .. CONFIG+=no_increase_build_number PREFIX=/usr with_backend - name: Building Qv2ray run: | cd build diff --git a/Qv2ray.pro b/Qv2ray.pro index 55ce38ac..a5d575dd 100644 --- a/Qv2ray.pro +++ b/Qv2ray.pro @@ -153,22 +153,27 @@ message(" ") RC_ICONS += ./assets/icons/qv2ray.ico ICON = ./assets/icons/qv2ray.icns -# ------------------------------------------ Begin checking gRPC and protobuf headers. -!exists(libs/gen/v2ray_api_commands.grpc.pb.h) || !exists(libs/gen/v2ray_api_commands.grpc.pb.cc) || !exists(libs/gen/v2ray_api_commands.pb.h) || !exists(libs/gen/v2ray_api_commands.pb.cc) { - message(" ") - message("-----------------------------------------------") - message("Cannot continue: ") - message(" --> Qv2ray is not properly configured yet: ") - message(" gRPC and protobuf headers for v2ray API is missing.") - message(" --> Please run gen_grpc.sh gen_grpc.bat or deps_macOS.sh located in tools/") - message(" --> Or consider reading the build wiki: https://github.com/lhy0403/Qv2ray/wiki/Manually-Build-Qv2ray") - message("-----------------------------------------------") - message(" ") - warning("IF YOU THINK IT'S A MISTAKE, PLEASE OPEN AN ISSUE") - error("! ABORTING THE BUILD !") - message(" ") +contains( CONFIG, with_backend ) { + message("Compiling Qv2ray with custom backend") +} else { + # ------------------------------------------ Begin checking gRPC and protobuf headers. + !exists(libs/gen/v2ray_api_commands.grpc.pb.h) || !exists(libs/gen/v2ray_api_commands.grpc.pb.cc) || !exists(libs/gen/v2ray_api_commands.pb.h) || !exists(libs/gen/v2ray_api_commands.pb.cc) { + message(" ") + message("-----------------------------------------------") + message("Cannot continue: ") + message(" --> Qv2ray is not properly configured yet: ") + message(" gRPC and protobuf headers for v2ray API is missing.") + message(" --> Please run gen_grpc.sh gen_grpc.bat or deps_macOS.sh located in tools/") + message(" --> Or consider reading the build wiki: https://github.com/lhy0403/Qv2ray/wiki/Manually-Build-Qv2ray") + message("-----------------------------------------------") + message(" ") + warning("IF YOU THINK IT'S A MISTAKE, PLEASE OPEN AN ISSUE") + error("! ABORTING THE BUILD !") + message(" ") + } } + # ------------------------------------------ Begin to detect language files. message("Looking for language support.") QM_FILES_RESOURCE_PREFIX = "translations" @@ -245,9 +250,6 @@ macx { message(" --> Linking libgpr and libupb.") LIBS += -lgpr -lupb - - message(" --> Linking libqvb static library.") - LIBS += -L$$PWD/libs/ -lqvb-darwin } # Reuse unix for macx as well @@ -258,8 +260,6 @@ unix { message(" --> Linking against gRPC and protobuf library.") LIBS += -L/usr/local/lib -lgrpc++ -lprotobuf -lgrpc - message(" --> Linking libqvb static library.") - unix:!macx: LIBS += -L$$PWD/libs/ -lqvb-linux64 # macOS homebrew include path message(" --> Adding local include folder to search path") @@ -288,6 +288,21 @@ with_metainfo { INSTALLS += appdataXml } +with_backend { + message(" --> Unlinking gRPC and protobuf library.") + LIBS -= -lgrpc++ -lprotobuf -lgrpc + + linux-g++ { + message(" --> Linking libqvb static library.") + LIBS += -L$$PWD/libs/ -lqvb-linux64 + } + + macx-g++ { + message(" --> Linking libqvb static library.") + LIBS += -L$$PWD/libs/ -lqvb-darwin + } +} + message(" ") message("Done configuring Qv2ray project. Build output will be at:" $$OUT_PWD) message("Type `make` or `mingw32-make` to start building Qv2ray")