diff --git a/.github/workflows/build_windows_vcpkg.yml b/.github/workflows/build_windows_vcpkg.yml index 140cccdbb..e0fbf913b 100644 --- a/.github/workflows/build_windows_vcpkg.yml +++ b/.github/workflows/build_windows_vcpkg.yml @@ -16,11 +16,27 @@ jobs: name: Shared Library runs-on: windows-latest + env: + EVENT_CONTEXT: ${{ toJson(github.event) }} + steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set GIT_REF (PR) + run: | + echo $EVENT_CONTEXT + echo "${{ github.event.pull_request.head.repo.full_name }}" >> ${{ github.workspace }}/package/vcpkg/GIT_REPO + echo "${{ github.event.pull_request.head.sha }}" >> ${{ github.workspace }}/package/vcpkg/GIT_REF + if: github.event_name == 'pull_request' - - name: Set GIT_REF - run: echo "${{ github.sha }}" >> ${{ github.workspace }}/package/vcpkg/GIT_REF + - name: Set GIT_REF (Non-PR) + run: | + echo $EVENT_CONTEXT + echo "${{ github.event.repository.full_name }}" >> ${{ github.workspace }}/package/vcpkg/GIT_REPO + echo "${{ github.sha }}" >> ${{ github.workspace }}/package/vcpkg/GIT_REF + if: github.event_name != 'pull_request' - name: Install run: | @@ -34,8 +50,17 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set GIT_REF - run: echo "${{ github.sha }}" >> ${{ github.workspace }}/package/vcpkg/GIT_REF + - name: Set GIT_REF (PR) + run: | + echo "${{ github.event.pull_request.head.repo.full_name }}" >> ${{ github.workspace }}/package/vcpkg/GIT_REPO + echo "${{ github.event.pull_request.head.sha }}" >> ${{ github.workspace }}/package/vcpkg/GIT_REF + if: github.event_name == 'pull_request' + + - name: Set GIT_REF (Non-PR) + run: | + echo "${{ github.event.repository.full_name }}" >> ${{ github.workspace }}/package/vcpkg/GIT_REPO + echo "${{ github.sha }}" >> ${{ github.workspace }}/package/vcpkg/GIT_REF + if: github.event_name != 'pull_request' - name: Install run: | diff --git a/package/vcpkg/portfile.cmake b/package/vcpkg/portfile.cmake index 206dd1131..5386f05fc 100644 --- a/package/vcpkg/portfile.cmake +++ b/package/vcpkg/portfile.cmake @@ -1,8 +1,16 @@ find_program(GIT git) -# GitHub repository -set(GIT_URL "https://github.com/projectM-visualizer/projectm.git") +# Set GIT_REPO to the contents of GIT_REPO file or to default +if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/GIT_REPO) + file(READ ${CMAKE_CURRENT_LIST_DIR}/GIT_REPO GIT_REPO) + string(STRIP ${GIT_REPO} GIT_REPO) + set(GIT_URL "https://github.com/${GIT_REPO}.git") +else() + set(GIT_URL "https://github.com/projectM-visualizer/projectm.git") +endif() + +# Set GIT_REF to the contents of GIT_REF file, or to VERSION if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/GIT_REF) file(READ ${CMAKE_CURRENT_LIST_DIR}/GIT_REF GIT_REF) string(STRIP ${GIT_REF} GIT_REF) @@ -26,6 +34,14 @@ else() set(GIT_CLONE_COMMAND ${GIT} clone --depth 1 --branch master --recurse-submodules ${GIT_URL} ${SOURCE_PATH}) endif() +# DEBUGGING +message(STATUS "GIT_REPO: ${GIT_REPO}") +message(STATUS "GIT_URL: ${GIT_URL}") +message(STATUS "GIT_REF: ${GIT_REF}") +message(STATUS "PORT_NAME: ${PORT_NAME}") +message(STATUS "SOURCE_PATH: ${SOURCE_PATH}") +message(STATUS "GIT_CLONE_COMMAND: ${GIT_CLONE_COMMAND}") + # Pull source from GitHub with submodules if(EXISTS "${SOURCE_PATH}" AND NOT EXISTS "${SOURCE_PATH}/.git")