Skip to content

Commit

Permalink
build: don't add SDL3 subfolder to include path for external projects
Browse files Browse the repository at this point in the history
  • Loading branch information
madebr authored and slouken committed Nov 27, 2022
1 parent 2af4f74 commit 9f2ca87
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 20 deletions.
4 changes: 0 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3186,7 +3186,6 @@ if(NOT WINDOWS_STORE AND NOT SDL3_DISABLE_SDL3MAIN)
"$<BUILD_INTERFACE:${SDL3_BINARY_DIR}/include>"
"$<BUILD_INTERFACE:${SDL3_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL3>"
)
if (WIN32)
target_link_libraries(SDL3main PRIVATE shell32)
Expand Down Expand Up @@ -3272,7 +3271,6 @@ if(SDL_SHARED)
"$<BUILD_INTERFACE:${SDL3_BINARY_DIR}/include>"
"$<BUILD_INTERFACE:${SDL3_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL3>"
)
# This picks up all the compiler options and such we've accumulated up to here.
target_link_libraries(SDL3 PRIVATE $<BUILD_INTERFACE:sdl-build-options>)
Expand Down Expand Up @@ -3307,7 +3305,6 @@ if(SDL_STATIC)
"$<BUILD_INTERFACE:${SDL3_BINARY_DIR}/include>"
"$<BUILD_INTERFACE:${SDL3_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL3>"
)
# This picks up all the compiler options and such we've accumulated up to here.
target_link_libraries(SDL3-static PRIVATE $<BUILD_INTERFACE:sdl-build-options>)
Expand Down Expand Up @@ -3338,7 +3335,6 @@ if(SDL_TEST)
"$<BUILD_INTERFACE:${SDL3_BINARY_DIR}/include>"
"$<BUILD_INTERFACE:${SDL3_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/SDL3>"
)
target_link_libraries(SDL3_test PRIVATE ${EXTRA_TEST_LIBS})
endif()
Expand Down
4 changes: 2 additions & 2 deletions SDL3Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ endif()

set(SDL3_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@")
set(SDL3_EXEC_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@")
set(SDL3_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@/SDL3")
set(SDL3_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@;@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@/SDL3")
set(SDL3_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_FULL_INCLUDEDIR@")
set(SDL3_INCLUDE_DIRS "${SDL3_INCLUDE_DIR}")
set(SDL3_BINDIR "@PACKAGE_CMAKE_INSTALL_FULL_BINDIR@")
set(SDL3_LIBDIR "@PACKAGE_CMAKE_INSTALL_FULL_LIBDIR@")
set(SDL3_LIBRARIES SDL3::SDL3)
Expand Down
8 changes: 4 additions & 4 deletions VisualC/pkg-support/cmake/sdl3-config-version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
# SDL CMake version configuration file:
# This file is meant to be placed in a cmake subfolder of SDL3-devel-3.x.y-VC

if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../include/SDL_version.h")
message(AUTHOR_WARNING "Could not find SDL_version.h. This script is meant to be placed in the root of SDL3-devel-3.x.y-VC")
if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../include/SDL3/SDL_version.h")
message(AUTHOR_WARNING "Could not find SDL3/SDL_version.h. This script is meant to be placed in the root of SDL3-devel-3.x.y-VC")
return()
endif()

file(READ "${CMAKE_CURRENT_LIST_DIR}/../include/SDL_version.h" _sdl_version_h)
file(READ "${CMAKE_CURRENT_LIST_DIR}/../include/SDL3/SDL_version.h" _sdl_version_h)
string(REGEX MATCH "#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)" _sdl_major_re "${_sdl_version_h}")
set(_sdl_major "${CMAKE_MATCH_1}")
string(REGEX MATCH "#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)" _sdl_minor_re "${_sdl_version_h}")
Expand All @@ -18,7 +18,7 @@ set(_sdl_patch "${CMAKE_MATCH_1}")
if(_sdl_major_re AND _sdl_minor_re AND _sdl_patch_re)
set(PACKAGE_VERSION "${_sdl_major}.${_sdl_minor}.${_sdl_patch}")
else()
message(AUTHOR_WARNING "Could not extract version from SDL_version.h.")
message(AUTHOR_WARNING "Could not extract version from SDL3/SDL_version.h.")
return()
endif()

Expand Down
2 changes: 1 addition & 1 deletion cmake/test/main_cli.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define SDL_MAIN_HANDLED
#include "SDL.h"
#include <SDL3/SDL.h>
#include <stdio.h>

int main(int argc, char *argv[]) {
Expand Down
2 changes: 1 addition & 1 deletion cmake/test/main_gui.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "SDL.h"
#include <SDL3/SDL.h>
#include <stdio.h>

int main(int argc, char *argv[]) {
Expand Down
2 changes: 1 addition & 1 deletion cmake/test/main_lib.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "SDL.h"
#include <SDL3/SDL.h>
#include <stdio.h>

#include EXPORT_HEADER
Expand Down
6 changes: 3 additions & 3 deletions mingw/pkg-support/cmake/sdl3-config-version.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# SDL3 CMake version configuration file:
# This file is meant to be placed in a cmake subfolder of SDL3-devel-2.x.y-mingw
# This file is meant to be placed in a cmake subfolder of SDL3-devel-3.x.y-mingw

if(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(sdl3_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL3/sdl3-config-version.cmake")
set(sdl3_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL3/SDL3ConfigVersion.cmake")
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(sdl3_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL3/sdl3-config-version.cmake")
set(sdl3_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL3/SDL3ConfigVersion.cmake")
else()
set(PACKAGE_VERSION_UNSUITABLE TRUE)
return()
Expand Down
6 changes: 3 additions & 3 deletions mingw/pkg-support/cmake/sdl3-config.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# SDL3 CMake configuration file:
# This file is meant to be placed in a cmake subfolder of SDL3-devel-2.x.y-mingw
# This file is meant to be placed in a cmake subfolder of SDL3-devel-3.x.y-mingw

if(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(sdl3_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL3/sdl3-config.cmake")
set(sdl3_config_path "${CMAKE_CURRENT_LIST_DIR}/../i686-w64-mingw32/lib/cmake/SDL3/SDL3Config.cmake")
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(sdl3_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL3/sdl3-config.cmake")
set(sdl3_config_path "${CMAKE_CURRENT_LIST_DIR}/../x86_64-w64-mingw32/lib/cmake/SDL3/SDL3Config.cmake")
else()
set(SDL3_FOUND FALSE)
return()
Expand Down
2 changes: 1 addition & 1 deletion sdl3.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ Version: @SDL_VERSION@
Requires:
Conflicts:
Libs: -L${libdir} @SDL_RLD_FLAGS@ @SDL_LIBS@ @PKGCONFIG_LIBS_PRIV@ @SDL_STATIC_LIBS@
Cflags: -I${includedir} -I${includedir}/SDL3 @SDL_CFLAGS@
Cflags: -I${includedir} @SDL_CFLAGS@

0 comments on commit 9f2ca87

Please sign in to comment.