mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-21 19:30:26 +08:00
Breaking change: Windows building processes. (#1017)
This commit is contained in:
parent
d1f4b9ca3c
commit
d6af4a7559
19
.github/workflows/build-qv2ray-cmake.yml
vendored
19
.github/workflows/build-qv2ray-cmake.yml
vendored
@ -107,20 +107,10 @@ jobs:
|
||||
shell: bash
|
||||
if: matrix.platform == 'windows-latest'
|
||||
run: |
|
||||
curl -o ./libs/grpc-${{ matrix.arch }}-windows.7z -L https://github.com/Qv2ray/Qv2ray-deps/releases/download/release/grpc-${{ matrix.arch }}-windows.7z
|
||||
curl -o ./libs/curl-${{ matrix.arch }}-windows.7z -L https://github.com/Qv2ray/Qv2ray-deps/releases/download/release/curl-${{ matrix.arch }}-windows.7z
|
||||
- name: Win-${{ matrix.arch }} - Build preparation - Extract Dependencies
|
||||
if: matrix.platform == 'windows-latest'
|
||||
uses: DuckSoft/extract-7z-action@v1.0
|
||||
with:
|
||||
pathSource: ./libs/grpc-${{ matrix.arch }}-windows.7z
|
||||
pathTarget: ./libs
|
||||
- name: Win-${{ matrix.arch }} - Build preparation - Extract Dependencies
|
||||
if: matrix.platform == 'windows-latest'
|
||||
uses: DuckSoft/extract-7z-action@v1.0
|
||||
with:
|
||||
pathSource: ./libs/curl-${{ matrix.arch }}-windows.7z
|
||||
pathTarget: ./libs
|
||||
cd ./libs
|
||||
export QV2RAY_LIBS=windows
|
||||
export QV2RAY_LIBS_ARCH=${{ matrix.arch }}
|
||||
./setup-libs.sh
|
||||
# ========================================================================================================= Generate MakeFile and Build
|
||||
|
||||
- uses: actions/setup-node@v1
|
||||
@ -154,6 +144,7 @@ jobs:
|
||||
cmake .. -GNinja -DCMAKE_INSTALL_PREFIX=./deployment -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
|
||||
cmake --build . --parallel $(nproc)
|
||||
cmake --install .
|
||||
cp -v ./*.pdb ./deployment || true
|
||||
# --------------------------------------------------------
|
||||
- name: Linux - ${{ matrix.qt_version }} - Generate Dependencies and Build
|
||||
if: matrix.platform == 'ubuntu-16.04'
|
||||
|
16
.github/workflows/nsis.yml
vendored
16
.github/workflows/nsis.yml
vendored
@ -83,18 +83,10 @@ jobs:
|
||||
- name: Win-${{ matrix.arch }} - ${{ matrix.qt_version }} - Build preparation - Download Dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
curl -o ./libs/grpc-${{ matrix.arch }}-windows.7z -L https://github.com/Qv2ray/Qv2ray-deps/releases/download/release/grpc-${{ matrix.arch }}-windows.7z
|
||||
curl -o ./libs/curl-${{ matrix.arch }}-windows.7z -L https://github.com/Qv2ray/Qv2ray-deps/releases/download/release/curl-${{ matrix.arch }}-windows.7z
|
||||
- name: Win-${{ matrix.arch }} - Build preparation - Extract Dependencies
|
||||
uses: DuckSoft/extract-7z-action@v1.0
|
||||
with:
|
||||
pathSource: ./libs/grpc-${{ matrix.arch }}-windows.7z
|
||||
pathTarget: ./libs
|
||||
- name: Win-${{ matrix.arch }} - Build preparation - Extract Dependencies
|
||||
uses: DuckSoft/extract-7z-action@v1.0
|
||||
with:
|
||||
pathSource: ./libs/curl-${{ matrix.arch }}-windows.7z
|
||||
pathTarget: ./libs
|
||||
cd libs
|
||||
export QV2RAY_LIBS=windows
|
||||
export QV2RAY_LIBS_ARCH=${{ matrix.arch }}
|
||||
./setup-libs.sh
|
||||
# ========================================================================================================= Generate MakeFile and Build
|
||||
- name: Win-${{ matrix.arch }} - ${{ matrix.qt_version }} - Generate Dependencies and Build
|
||||
shell: bash
|
||||
|
@ -41,7 +41,37 @@ if(ANDROID)
|
||||
set(ANDROID_PACKAGE_SOURCE ${CMAKE_SOURCE_DIR}/assets/android)
|
||||
set(QT_ANDROID_PACKAGE_SOURCE_DIR "\"android-package-source-directory\":\"${ANDROID_PACKAGE_SOURCE}\",")
|
||||
message("Configuring for Android, ABI: ${ANDROID_ABI}")
|
||||
include(cmake/platforms/android.cmake)
|
||||
if(NOT ANDROID_SDK)
|
||||
set(ANDROID_SDK $ENV{ANDROID_SDK_ROOT})
|
||||
endif()
|
||||
include(${ANDROID_SDK}/android_openssl/CMakeLists.txt)
|
||||
set(ANDROID_LIB_ARCH ${CMAKE_ANDROID_ARCH})
|
||||
if(${ANDROID_LIB_ARCH} STREQUAL "x86_64")
|
||||
set(ANDROID_LIB_ARCH "x64")
|
||||
endif()
|
||||
message("Android SDK: ${ANDROID_SDK}, ${CMAKE_ANDROID_ARCH}")
|
||||
set(QV2RAY_PLATFORM_LIBS_BIN_PATH_PREFIX ${CMAKE_SOURCE_DIR}/libs/tools)
|
||||
set(QV2RAY_PLATFORM_LIBS_PATH_PREFIX ${CMAKE_SOURCE_DIR}/libs/${ANDROID_LIB_ARCH}-android)
|
||||
include(cmake/platforms/prefixes.cmake)
|
||||
set(APK_PACKAGE_NAME "net.qv2ray.qv2ray")
|
||||
set(APK_PACKAGE_VERSION "v${QV2RAY_VERSION_STRING}")
|
||||
set(APK_DISPLAY_NAME "Qv2ray")
|
||||
set(APK_PACKAGE_VERSIONCODE 0)
|
||||
configure_file(${CMAKE_SOURCE_DIR}/assets/AndroidManifest.xml.in ${CMAKE_SOURCE_DIR}/assets/android/AndroidManifest.xml @ONLY)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
add_compile_options("/std:c++17")
|
||||
add_compile_options("/utf-8")
|
||||
add_definitions(-DUNICODE -D_UNICODE -DNOMINMAX)
|
||||
add_definitions(-D_WIN32_WINNT=0x600 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS)
|
||||
set(GUI_TYPE WIN32)
|
||||
if(CMAKE_CL_64)
|
||||
set(QV2RAY_PLATFORM_LIBS_PATH_PREFIX ${CMAKE_SOURCE_DIR}/libs/x64-windows/)
|
||||
else()
|
||||
set(QV2RAY_PLATFORM_LIBS_PATH_PREFIX ${CMAKE_SOURCE_DIR}/libs/x86-windows/)
|
||||
endif()
|
||||
include(cmake/platforms/prefixes.cmake)
|
||||
endif()
|
||||
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.17.0")
|
||||
@ -65,22 +95,6 @@ message("| Welcome to contribute! |")
|
||||
message("|-------------------------------------------------|")
|
||||
message(" ")
|
||||
|
||||
if(WIN32)
|
||||
add_compile_options("/std:c++17")
|
||||
add_compile_options("/utf-8")
|
||||
add_definitions(-DUNICODE -D_UNICODE -DNOMINMAX)
|
||||
add_definitions(-D_WIN32_WINNT=0x600 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS)
|
||||
set(GUI_TYPE WIN32)
|
||||
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
|
||||
if(CMAKE_CL_64)
|
||||
include(${CMAKE_SOURCE_DIR}/libs/windows-x64/scripts/buildsystems/vcpkg.cmake)
|
||||
else()
|
||||
include(${CMAKE_SOURCE_DIR}/libs/windows-x86/scripts/buildsystems/vcpkg.cmake)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# ==================================================================================
|
||||
# Qv2ray compile arguments
|
||||
# ==================================================================================
|
||||
|
@ -1,8 +1,7 @@
|
||||
if(ANDROID)
|
||||
set(CURL_LIBRARIES -lcurl -lssl -lcrypto -lz)
|
||||
elseif(WIN32)
|
||||
set(CURL_LIBRARIES libcurl libssl libcrypto zlib)
|
||||
endif()
|
||||
if(WIN32 OR ANDROID)
|
||||
find_package(CURL CONFIG REQUIRED)
|
||||
else()
|
||||
|
||||
find_package(CURL REQUIRED)
|
||||
endif()
|
||||
|
@ -1,56 +0,0 @@
|
||||
if(NOT ANDROID_SDK)
|
||||
set(ANDROID_SDK $ENV{ANDROID_SDK_ROOT})
|
||||
endif()
|
||||
|
||||
include(${ANDROID_SDK}/android_openssl/CMakeLists.txt)
|
||||
|
||||
set(ANDROID_LIB_ARCH ${CMAKE_ANDROID_ARCH})
|
||||
if(${ANDROID_LIB_ARCH} STREQUAL "x86_64")
|
||||
set(ANDROID_LIB_ARCH "x64")
|
||||
endif()
|
||||
|
||||
message("Android SDK: ${ANDROID_SDK}, ${CMAKE_ANDROID_ARCH}")
|
||||
|
||||
list(APPEND CMAKE_PROGRAM_PATH
|
||||
${CMAKE_SOURCE_DIR}/libs/tools/grpc
|
||||
${CMAKE_SOURCE_DIR}/libs/tools/protobuf
|
||||
${CMAKE_SOURCE_DIR}/libs/tools/openssl
|
||||
)
|
||||
|
||||
set(QV2RAY_ANDROID_ROOT ${CMAKE_SOURCE_DIR}/libs/${ANDROID_LIB_ARCH}-android)
|
||||
|
||||
if(CMAKE_BUILD_TYPE MATCHES "^[Dd][Ee][Bb][Uu][Gg]$" OR NOT DEFINED CMAKE_BUILD_TYPE) #Debug build: Put Debug paths before Release paths.
|
||||
list(APPEND CMAKE_PREFIX_PATH
|
||||
${QV2RAY_ANDROID_ROOT}/debug
|
||||
${QV2RAY_ANDROID_ROOT}
|
||||
)
|
||||
link_directories(
|
||||
${QV2RAY_ANDROID_ROOT}/debug/lib
|
||||
${QV2RAY_ANDROID_ROOT}/lib
|
||||
)
|
||||
list(APPEND CMAKE_FIND_ROOT_PATH
|
||||
${QV2RAY_ANDROID_ROOT}/debug
|
||||
${QV2RAY_ANDROID_ROOT}
|
||||
)
|
||||
else() #Release build: Put Release paths before Debug paths. Debug Paths are required so that CMake generates correct info in autogenerated target files.
|
||||
list(APPEND CMAKE_PREFIX_PATH
|
||||
${QV2RAY_ANDROID_ROOT}
|
||||
${QV2RAY_ANDROID_ROOT}/debug
|
||||
)
|
||||
link_directories(
|
||||
${QV2RAY_ANDROID_ROOT}/lib
|
||||
${QV2RAY_ANDROID_ROOT}/debug/lib
|
||||
)
|
||||
list(APPEND CMAKE_FIND_ROOT_PATH
|
||||
${QV2RAY_ANDROID_ROOT}
|
||||
${QV2RAY_ANDROID_ROOT}/debug
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
set(APK_PACKAGE_NAME "net.qv2ray.qv2ray")
|
||||
set(APK_PACKAGE_VERSION "v${QV2RAY_VERSION_STRING}")
|
||||
set(APK_DISPLAY_NAME "Qv2ray")
|
||||
set(APK_PACKAGE_VERSIONCODE 0)
|
||||
configure_file(${CMAKE_SOURCE_DIR}/assets/AndroidManifest.xml.in ${CMAKE_SOURCE_DIR}/assets/android/AndroidManifest.xml @ONLY)
|
||||
endif()
|
52
cmake/platforms/prefixes.cmake
Normal file
52
cmake/platforms/prefixes.cmake
Normal file
@ -0,0 +1,52 @@
|
||||
if(NOT QV2RAY_PLATFORM_LIBS_BIN_PATH_PREFIX)
|
||||
set(QV2RAY_PLATFORM_LIBS_BIN_PATH_PREFIX ${QV2RAY_PLATFORM_LIBS_PATH_PREFIX}/tools)
|
||||
endif()
|
||||
|
||||
|
||||
list(APPEND CMAKE_PROGRAM_PATH
|
||||
${QV2RAY_PLATFORM_LIBS_BIN_PATH_PREFIX}/grpc/
|
||||
${QV2RAY_PLATFORM_LIBS_BIN_PATH_PREFIX}/protobuf/
|
||||
${QV2RAY_PLATFORM_LIBS_BIN_PATH_PREFIX}/openssl/
|
||||
)
|
||||
|
||||
message("CMAKE_PROGRAM_PATH=${CMAKE_PROGRAM_PATH}")
|
||||
|
||||
# From vcpkg
|
||||
#If CMake does not have a mapping for MinSizeRel and RelWithDebInfo in imported targets
|
||||
#it will map those configuration to the first valid configuration in CMAKE_CONFIGURATION_TYPES or the targets IMPORTED_CONFIGURATIONS.
|
||||
#In most cases this is the debug configuration which is wrong.
|
||||
if(NOT DEFINED CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL)
|
||||
set(CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL "MinSizeRel;Release;")
|
||||
message(STATUS "CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL set to MinSizeRel;Release;")
|
||||
endif()
|
||||
if(NOT DEFINED CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO)
|
||||
set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO "RelWithDebInfo;Release;")
|
||||
message(STATUS "CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO set to RelWithDebInfo;Release;")
|
||||
endif()
|
||||
|
||||
if(CMAKE_BUILD_TYPE MATCHES "^[Dd][Ee][Bb][Uu][Gg]$" OR NOT DEFINED CMAKE_BUILD_TYPE)
|
||||
#Debug build: Put Debug paths before Release paths.
|
||||
list(APPEND CMAKE_PREFIX_PATH
|
||||
${QV2RAY_PLATFORM_LIBS_PATH_PREFIX}/debug
|
||||
${QV2RAY_PLATFORM_LIBS_PATH_PREFIX}
|
||||
)
|
||||
link_directories(
|
||||
${QV2RAY_PLATFORM_LIBS_PATH_PREFIX}/debug/lib
|
||||
${QV2RAY_PLATFORM_LIBS_PATH_PREFIX}/lib
|
||||
)
|
||||
list(APPEND CMAKE_FIND_ROOT_PATH
|
||||
${QV2RAY_PLATFORM_LIBS_PATH_PREFIX}/debug
|
||||
${QV2RAY_PLATFORM_LIBS_PATH_PREFIX}
|
||||
)
|
||||
else()
|
||||
#Release build: Put Release paths before Debug paths. Debug Paths are required so that CMake generates correct info in autogenerated target files.
|
||||
list(APPEND CMAKE_PREFIX_PATH
|
||||
${QV2RAY_PLATFORM_LIBS_PATH_PREFIX}
|
||||
)
|
||||
link_directories(
|
||||
${QV2RAY_PLATFORM_LIBS_PATH_PREFIX}/lib
|
||||
)
|
||||
list(APPEND CMAKE_FIND_ROOT_PATH
|
||||
${QV2RAY_PLATFORM_LIBS_PATH_PREFIX}
|
||||
)
|
||||
endif()
|
@ -20,6 +20,7 @@ do
|
||||
done
|
||||
|
||||
if [[ "$QV2RAY_LIBS" == "tools" ]]; then
|
||||
mkdir -p ../tools
|
||||
cp -rvf ./tools ../
|
||||
rm -rvf ./tools
|
||||
else
|
||||
|
@ -1 +1 @@
|
||||
5980
|
||||
5984
|
||||
|
Loading…
Reference in New Issue
Block a user