mirror of https://github.com/encounter/SDL.git
cmake: use CMAKE_CURRENT_BINARY_DIR instead of CMAKE_BINARY_DIR (#5834)
* Update install directory to match generated https://github.com/libsdl-org/SDL/blob/main/CMakeLists.txt#L3122 Sets `SDL2Config.cmake` to `CMAKE_BINARY_DIR`, whereas the install file tries to find it from a different location. * cmake: use CMAKE_CURRENT_BINARY_DIR instead of CMAKE_BINARY_DIR * ci: test SDL included as a cmake subproject Co-authored-by: Anonymous Maarten <anonymous.maarten@gmail.com>
This commit is contained in:
parent
6dcb2868b0
commit
bd49696133
|
@ -24,20 +24,34 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Configure CMake
|
- name: Create CMake project using SDL as a subproject
|
||||||
run: cmake -S . -B build `
|
shell: python
|
||||||
|
run: |
|
||||||
|
import os
|
||||||
|
import textwrap
|
||||||
|
srcdir = r"${{ github.workspace }}".replace("\\", "/")
|
||||||
|
builddir = f"{ srcdir }/build"
|
||||||
|
os.makedirs(builddir)
|
||||||
|
with open(f"{ builddir }/CMakeLists.txt", "w") as f:
|
||||||
|
f.write(textwrap.dedent(f"""\
|
||||||
|
cmake_minimum_required(VERSION 3.0)
|
||||||
|
project(sdl_user)
|
||||||
|
add_subdirectory("{ srcdir }" SDL)
|
||||||
|
"""))
|
||||||
|
- name: Configure (CMake)
|
||||||
|
run: cmake -S build -B build `
|
||||||
-DSDL_TESTS=ON `
|
-DSDL_TESTS=ON `
|
||||||
-DSDL_INSTALL_TESTS=ON `
|
-DSDL_INSTALL_TESTS=ON `
|
||||||
${{ matrix.platform.flags }} `
|
${{ matrix.platform.flags }} `
|
||||||
-DCMAKE_INSTALL_PREFIX=prefix
|
-DCMAKE_INSTALL_PREFIX=prefix
|
||||||
- name: Build CMake
|
- name: Build (CMake)
|
||||||
run: cmake --build build/ --config Release --parallel
|
run: cmake --build build/ --config Release --parallel
|
||||||
- name: Run build-time tests
|
- name: Run build-time tests
|
||||||
if: "! contains(matrix.platform.name, 'ARM')"
|
if: "! contains(matrix.platform.name, 'ARM')"
|
||||||
run: |
|
run: |
|
||||||
$env:SDL_TESTS_QUICK=1
|
$env:SDL_TESTS_QUICK=1
|
||||||
ctest -VV --test-dir build/ -C Release
|
ctest -VV --test-dir build/ -C Release
|
||||||
- name: Install CMake
|
- name: Install (CMake)
|
||||||
run: |
|
run: |
|
||||||
echo "SDL2_DIR=$Env:GITHUB_WORKSPACE/prefix" >> $Env:GITHUB_ENV
|
echo "SDL2_DIR=$Env:GITHUB_WORKSPACE/prefix" >> $Env:GITHUB_ENV
|
||||||
cmake --install build/
|
cmake --install build/
|
||||||
|
|
|
@ -3139,11 +3139,11 @@ if(NOT SDL2_DISABLE_INSTALL)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
include(CMakePackageConfigHelpers)
|
include(CMakePackageConfigHelpers)
|
||||||
configure_package_config_file(SDL2Config.cmake.in "${CMAKE_BINARY_DIR}/SDL2Config.cmake"
|
configure_package_config_file(SDL2Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/SDL2Config.cmake"
|
||||||
PATH_VARS CMAKE_INSTALL_PREFIX CMAKE_INSTALL_FULL_BINDIR CMAKE_INSTALL_FULL_INCLUDEDIR CMAKE_INSTALL_FULL_LIBDIR
|
PATH_VARS CMAKE_INSTALL_PREFIX CMAKE_INSTALL_FULL_BINDIR CMAKE_INSTALL_FULL_INCLUDEDIR CMAKE_INSTALL_FULL_LIBDIR
|
||||||
INSTALL_DESTINATION ${PKG_PREFIX}
|
INSTALL_DESTINATION ${PKG_PREFIX}
|
||||||
)
|
)
|
||||||
write_basic_package_version_file("${CMAKE_BINARY_DIR}/SDL2ConfigVersion.cmake"
|
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/SDL2ConfigVersion.cmake"
|
||||||
VERSION ${SDL_VERSION}
|
VERSION ${SDL_VERSION}
|
||||||
COMPATIBILITY AnyNewerVersion
|
COMPATIBILITY AnyNewerVersion
|
||||||
)
|
)
|
||||||
|
@ -3199,7 +3199,7 @@ if(NOT SDL2_DISABLE_INSTALL)
|
||||||
install(
|
install(
|
||||||
FILES
|
FILES
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/SDL2Config.cmake
|
${CMAKE_CURRENT_BINARY_DIR}/SDL2Config.cmake
|
||||||
${CMAKE_BINARY_DIR}/SDL2ConfigVersion.cmake
|
${CMAKE_CURRENT_BINARY_DIR}/SDL2ConfigVersion.cmake
|
||||||
DESTINATION ${PKG_PREFIX}
|
DESTINATION ${PKG_PREFIX}
|
||||||
COMPONENT Devel
|
COMPONENT Devel
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue