SDL_GetRevision broken
sezero opened this issue · 1 comments
We currently do a pass-through with SDL_GetRevision which is wrong:
it reports SDL3 version and revision: We need something specific to
sdl2-compat.
$ LD_LIBRARY_PATH=~/sdl3/lib ./testver
INFO: Compiled with SDL 2.0 or newer
INFO: Compiled version: 2.29.0 ()
INFO: Linked version: 2.90.0 (SDL-prerelease-3.0.0-2044-gb221b59)
Also note the empty revision string in Compiled version
case which
directly references SDL_REVISION
: It looks like it cannot find the
generated SDL_revision.h, i.e. it prioritizes top-level include/SDL2
instead of build-dir. CC: @madebr
@madebr: if I comment out the target_include_directories
line in
the test_program
macro, and swap all the PROJECT_SOURCE_DIR
and
PROJECT_BINARY_DIR
lines in rest of target_include_directories
then it picks generated SDL_revision.h (see inlined patch below):
The target_include_directories
in test_program
macro seems to
prepend the top-level include directory to existing ones.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5fa4387..dfa6e92 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -177,10 +177,10 @@ add_library(SDL2::SDL2 ALIAS SDL2)
target_link_libraries(SDL2 PRIVATE $<BUILD_INTERFACE:SDL3::Headers>)
target_include_directories(SDL2
INTERFACE
- "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
- "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/SDL2>"
"$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>"
"$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include/SDL2>"
+ "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
+ "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/SDL2>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL2>"
)
@@ -319,10 +319,10 @@ add_library(SDL2_test STATIC
add_library(SDL2::SDL2test ALIAS SDL2_test)
target_include_directories(SDL2_test
PUBLIC
- "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
- "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/SDL2>"
"$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>"
"$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include/SDL2>"
+ "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
+ "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/SDL2>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL2>"
)
@@ -347,7 +347,7 @@ if(SDL2COMPAT_TESTS)
macro(test_program _NAME _SRCS)
add_executable(${_NAME} ${_SRCS})
- target_include_directories(${_NAME} PRIVATE "include/SDL2")
+# target_include_directories(${_NAME} PRIVATE "include/SDL2")
target_link_libraries(${_NAME} PRIVATE SDL2::SDL2main SDL2::SDL2test SDL2::SDL2)
# Turn off MSVC's aggressive C runtime warnings for the old test programs.
if(MSVC)
@@ -501,10 +501,10 @@ if(SDL2COMPAT_STATICDEVEL AND SDL2COMPAT_DEVEL)
target_link_libraries(SDL2-static PRIVATE $<BUILD_INTERFACE:SDL3::Headers>)
target_include_directories(SDL2-static
INTERFACE
- "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
- "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/SDL2>"
"$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>"
"$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include/SDL2>"
+ "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
+ "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/SDL2>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL2>"
)