This commit is contained in:
Guobang Bi 2020-03-08 14:08:54 +08:00
parent 79eb753d4b
commit 40879fe7a6
No known key found for this signature in database
GPG Key ID: D850BE43BE29325B
4 changed files with 23 additions and 11 deletions

View File

@ -88,12 +88,19 @@ jobs:
if: matrix.platform == 'windows-latest' if: matrix.platform == 'windows-latest'
run: | run: |
curl -o ./libs/Qv2ray-deps-grpc-${{ matrix.arch }}-windows.7z -L https://github.com/Qv2ray/Qv2ray-deps/releases/download/release/Qv2ray-deps-grpc-${{ matrix.arch }}-windows.7z curl -o ./libs/Qv2ray-deps-grpc-${{ matrix.arch }}-windows.7z -L https://github.com/Qv2ray/Qv2ray-deps/releases/download/release/Qv2ray-deps-grpc-${{ matrix.arch }}-windows.7z
- name: Win-${{ matrix.arch }} - Build preparation - Extract Dependencies curl -o ./libs/Qv2ray-deps-libiconv-${{ matrix.arch }}-windows.7z -L https://github.com/Qv2ray/Qv2ray-deps/releases/download/release/Qv2ray-deps-libiconv-${{ matrix.arch }}-windows.7z
- name: Win-${{ matrix.arch }} - gRPC- Build preparation - Extract Dependencies
if: matrix.platform == 'windows-latest' if: matrix.platform == 'windows-latest'
uses: DuckSoft/extract-7z-action@v1.0 uses: DuckSoft/extract-7z-action@v1.0
with: with:
pathSource: ./libs/Qv2ray-deps-grpc-${{ matrix.arch }}-windows.7z pathSource: ./libs/Qv2ray-deps-grpc-${{ matrix.arch }}-windows.7z
pathTarget: ./libs pathTarget: ./libs
- name: Win-${{ matrix.arch }} - Iconv- Build preparation - Extract Dependencies
if: matrix.platform == 'windows-latest'
uses: DuckSoft/extract-7z-action@v1.0
with:
pathSource: ./libs/Qv2ray-deps-libiconv-${{ matrix.arch }}-windows.7z
pathTarget: ./libs
# ========================================================================================================= Generate MakeFile and Build # ========================================================================================================= Generate MakeFile and Build
- name: macOS - ${{ matrix.qt_version }} - Generate Dependencies and Build - name: macOS - ${{ matrix.qt_version }} - Generate Dependencies and Build
shell: bash shell: bash

View File

@ -42,6 +42,7 @@ message(" ")
if(WIN32) if(WIN32)
add_compile_options("/std:c++17") add_compile_options("/std:c++17")
add_definitions(-D_HAS_STD_BYTE=0 -D_WIN32_WINNT=0x600 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS) add_definitions(-D_HAS_STD_BYTE=0 -D_WIN32_WINNT=0x600 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS)
include(cmake/iconv.cmake)
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE) if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
if(CMAKE_CL_64) if(CMAKE_CL_64)
include(${CMAKE_SOURCE_DIR}/libs/x64-windows/scripts/buildsystems/vcpkg.cmake) include(${CMAKE_SOURCE_DIR}/libs/x64-windows/scripts/buildsystems/vcpkg.cmake)
@ -58,20 +59,14 @@ include(cmake/qzxing.cmake)
include(cmake/protobuf.cmake) include(cmake/protobuf.cmake)
include(cmake/cpp-httplib.cmake) include(cmake/cpp-httplib.cmake)
include(cmake/backend.cmake) include(cmake/backend.cmake)
if(APPLE) if(APPLE)
find_package(Iconv REQUIRED) include(cmake/iconv.cmake)
set(MACOSX_FRAMEWORK set(MACOSX_FRAMEWORK
"-framework Carbon" "-framework Carbon"
"-framework Cocoa" "-framework Cocoa"
"-framework Security" "-framework Security"
) )
set(MACOSX_ICONV_LIBRARY
Iconv::Iconv
)
set(MACOSX_ICONV_INCLUDE_PATH
${Iconv_INCLUDE_DIR}
)
endif() endif()
if(DEFINED ENV{_QV2RAY_BUILD_INFO_}) if(DEFINED ENV{_QV2RAY_BUILD_INFO_})
@ -173,7 +168,7 @@ add_executable(${PROJECT_NAME}
target_link_libraries(${PROJECT_NAME} target_link_libraries(${PROJECT_NAME}
${QT_LIBRARY} ${QT_LIBRARY}
${MACOSX_FRAMEWORK} ${MACOSX_FRAMEWORK}
${MACOSX_ICONV_LIBRARY} ${ICONV_LIBRARY}
${QV2RAY_PROTOBUF_LIBRARY} ${QV2RAY_PROTOBUF_LIBRARY}
${QV2RAY_BACKEND_LIBRARIES} ${QV2RAY_BACKEND_LIBRARIES}
) )
@ -188,7 +183,7 @@ target_include_directories(${PROJECT_NAME} PRIVATE
${QZXING_INCLUDE_PATH} ${QZXING_INCLUDE_PATH}
${SINGLEAPPLICATION_DIR} ${SINGLEAPPLICATION_DIR}
${Protobuf_INCLUDE_DIRS} ${Protobuf_INCLUDE_DIRS}
${MACOSX_ICONV_INCLUDE_PATH} ${ICONV_INCLUDE_PATH}
${cpp-httplib_INCLUDE_DIRS} ${cpp-httplib_INCLUDE_DIRS}
) )

7
cmake/iconv.cmake Normal file
View File

@ -0,0 +1,7 @@
find_package(Iconv REQUIRED)
set(ICONV_LIBRARY
Iconv::Iconv
)
set(ICONV_INCLUDE_PATH
${Iconv_INCLUDE_DIR}
)

View File

@ -1,4 +1,7 @@
find_package(Protobuf REQUIRED) find_package(Protobuf REQUIRED)
if(MSVC)
set(Protobuf_USE_STATIC_LIBS ON)
endif()
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${CMAKE_SOURCE_DIR}/tools/v2ray_geosite.proto) protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${CMAKE_SOURCE_DIR}/tools/v2ray_geosite.proto)
set(QV2RAY_PROTOBUF_LIBRARY set(QV2RAY_PROTOBUF_LIBRARY
protobuf::libprotobuf protobuf::libprotobuf