From d7f5333c736e7d362e35fd48db5160128571d7d4 Mon Sep 17 00:00:00 2001 From: Deal Date: Sat, 24 Feb 2024 19:07:18 +0800 Subject: [PATCH] Fix linux build (#1715) * Update CMakeLists.txt * Update CMakeLists.txt * Update build.yml [skip ci] * Delete .github/workflows/pr.yml --- .github/workflows/build.yml | 6 ++ .github/workflows/pr.yml | 118 ----------------------------- thirdparty/CMakeLists.txt | 17 ++++- thirdparty/glfw/src/CMakeLists.txt | 2 +- 4 files changed, 20 insertions(+), 123 deletions(-) delete mode 100644 .github/workflows/pr.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 57f8c8d264..2aca94f55d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,6 +9,12 @@ on: - 'docs/**' - '.github/workflows/publish.yml' - 'tools/ci/make-pkg.ps1' + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + paths-ignore: + - '**.md' + - '**/*.md.in' + - 'docs/**' jobs: win32: diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml deleted file mode 100644 index d58c87967b..0000000000 --- a/.github/workflows/pr.yml +++ /dev/null @@ -1,118 +0,0 @@ -name: pull_request - -on: - pull_request: - types: [opened, synchronize, reopened, ready_for_review] - paths-ignore: - - '**.md' - - '**/*.md.in' - - 'docs/**' - -env: - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) - BUILD_TYPE: Release - PULL_REQUEST: yes - -jobs: - build-win32: - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: 'recursive' - - uses: ilammy/msvc-dev-cmd@v1.12.1 - with: - toolset: '14.37' - arch: ${{ env.BUILD_ARCH }} - - name: Build - shell: pwsh - run: .\build.ps1 -p win32 -a x64 - - build-winuwp: - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: 'recursive' - - uses: ilammy/msvc-dev-cmd@v1.12.1 - with: - toolset: '14.37' - arch: x64 - uwp: true - - name: Build - shell: pwsh - run: .\build.ps1 -p winuwp -a x64 -xb '--config', 'Debug' - - build-linux: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: 'recursive' - - name: Install deps - # Some projects don't allow in-source building, so create a separate build directory - # We'll use this as our working directory for all subsequent commands - run: | - AX_ROOT=`pwd` - echo -e "y" | pwsh $AX_ROOT/setup.ps1 - - name: Build - shell: pwsh - run: ./build.ps1 -p linux -a x64 - - build-android: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: 'recursive' - - name: Build - shell: pwsh - run: | - $AX_ROOT = $(Get-Location).Path - ./build.ps1 -p android -a arm64 - - uses: actions/upload-artifact@v3 - with: - name: android_artifact - path: | - templates/**/*.apk - tests/**/*.apk - - build-osx: - runs-on: macos-12 - steps: - - uses: actions/checkout@v4 - with: - submodules: 'recursive' - - name: Build - shell: pwsh - run: ./build.ps1 -p osx -a x64 - - build-ios: - name: build-ios - runs-on: macos-latest - env: - GH_OS_NAME: osx - BUILD_TARGET: ios - steps: - - uses: actions/checkout@v4 - with: - submodules: 'recursive' - - - name: Build - shell: pwsh - run: ./build.ps1 -p ios -a x64 - - build-tvos: - name: build-tvos - runs-on: macos-latest - env: - GH_OS_NAME: osx - BUILD_TARGET: tvos - steps: - - uses: actions/checkout@v4 - with: - submodules: 'recursive' - - - name: Build - shell: pwsh - run: ./build.ps1 -p tvos -a x64 diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index ef6abd93a7..0ba603acba 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -443,10 +443,19 @@ if(WINDOWS OR LINUX OR ANDROID OR WASM) endif() if((WINDOWS AND NOT WINRT) OR MACOSX OR LINUX) - ax_add_3rd(glfw OPTIONS - "GLFW_BUILD_DOCS OFF" - "GLFW_INSTALL OFF" - ) + if(NOT LINUX) + ax_add_3rd(glfw OPTIONS + "GLFW_BUILD_DOCS OFF" + "GLFW_INSTALL OFF" + ) + else() + ax_add_3rd(glfw OPTIONS + "GLFW_BUILD_X11 ON" + "GLFW_BUILD_WAYLAND OFF" + "GLFW_BUILD_DOCS OFF" + "GLFW_INSTALL OFF" + ) + endif() set_target_properties(glfw PROPERTIES OUTPUT_NAME glfw) if(NOT WINDOWS) target_link_libraries(thirdparty INTERFACE pthread) diff --git a/thirdparty/glfw/src/CMakeLists.txt b/thirdparty/glfw/src/CMakeLists.txt index 2c5671f36d..61bf56522d 100644 --- a/thirdparty/glfw/src/CMakeLists.txt +++ b/thirdparty/glfw/src/CMakeLists.txt @@ -177,7 +177,7 @@ if (GLFW_BUILD_WAYLAND) endif() endif() -if (GLFW_BUILD_X11) +if (GLFW_BUILD_X11_EXPLICIT) find_package(X11 REQUIRED) target_include_directories(glfw PRIVATE "${X11_X11_INCLUDE_PATH}")