mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-02-20 19:02:37 +00:00
Added SRB2_CONFIG_USE_INTERNAL_LIBRARIES option (defaults to off right now), some WIP work on making it ...actually do what it says on the tin.
Basically, it manually sets *_FOUND, *_INCLUDE_DIRS and *_LIBRARIES instead of using find_package. Frankly I have no idea how well what I've done works currently though, not even sure if I've set the _LIBRARIES variables correctly. Again, it's WIP work, this can probably be fixed eventually I suppose.
This commit is contained in:
parent
3843533c24
commit
27acd8c3ac
2 changed files with 46 additions and 6 deletions
|
@ -227,6 +227,10 @@ set(SRB2_CONFIG_YASM OFF CACHE BOOL
|
|||
set(SRB2_CONFIG_STATIC_OPENGL OFF CACHE BOOL
|
||||
"Use statically linked OpenGL. NOT RECOMMENDED.")
|
||||
|
||||
### use internal libraries?
|
||||
set(SRB2_CONFIG_USE_INTERNAL_LIBRARIES OFF CACHE BOOL
|
||||
"Use SRB2's internal copies of required dependencies (SDL2, PNG, zlib, GME).")
|
||||
|
||||
if(${SRB2_CONFIG_HAVE_BLUA})
|
||||
add_definitions(-DHAVE_BLUA)
|
||||
set(SRB2_LUA_SOURCES
|
||||
|
@ -314,7 +318,13 @@ if(${SRB2_CONFIG_HAVE_BLUA})
|
|||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_HAVE_GME})
|
||||
find_package(GME)
|
||||
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
|
||||
set(GME_FOUND ON)
|
||||
set(GME_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/gme/include)
|
||||
set(GME_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/gme/ -lgme")
|
||||
else()
|
||||
find_package(GME)
|
||||
endif()
|
||||
if(${GME_FOUND})
|
||||
set(SRB2_HAVE_GME ON)
|
||||
add_definitions(-DHAVE_LIBGME)
|
||||
|
@ -324,7 +334,13 @@ if(${SRB2_CONFIG_HAVE_GME})
|
|||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_HAVE_ZLIB})
|
||||
find_package(ZLIB)
|
||||
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
|
||||
set(ZLIB_FOUND ON)
|
||||
set(ZLIB_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/zlib)
|
||||
set(ZLIB_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/zlib/win32 -lz32")
|
||||
else()
|
||||
find_package(ZLIB)
|
||||
endif()
|
||||
if(${ZLIB_FOUND})
|
||||
set(SRB2_HAVE_ZLIB ON)
|
||||
else()
|
||||
|
@ -334,7 +350,13 @@ endif()
|
|||
|
||||
if(${SRB2_CONFIG_HAVE_PNG} AND ${SRB2_CONFIG_HAVE_ZLIB})
|
||||
if (${ZLIB_FOUND})
|
||||
find_package(PNG)
|
||||
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
|
||||
set(PNG_FOUND ON)
|
||||
set(PNG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/libpng-src)
|
||||
set(PNG_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/libpng-src/projects -lpng32")
|
||||
else()
|
||||
find_package(PNG)
|
||||
endif()
|
||||
if(${PNG_FOUND})
|
||||
set(SRB2_HAVE_PNG ON)
|
||||
add_definitions(-DHAVE_PNG)
|
||||
|
|
|
@ -3,7 +3,13 @@
|
|||
set(SRB2_CONFIG_SDL2_USEMIXER ON CACHE BOOL "Use SDL2_mixer or regular sdl sound")
|
||||
|
||||
if(${SRB2_CONFIG_SDL2_USEMIXER})
|
||||
find_package(SDL2_mixer)
|
||||
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
|
||||
set(SDL2_MIXER_FOUND ON)
|
||||
set(SDL2_MIXER_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/i686-w64-mingw32/include/SDL2)
|
||||
set(SDL2_MIXER_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/i686-w64-mingw32/lib -lSDL2_mixer")
|
||||
else()
|
||||
find_package(SDL2_mixer)
|
||||
endif()
|
||||
if(${SDL2_MIXER_FOUND})
|
||||
set(SRB2_HAVE_MIXER ON)
|
||||
set(SRB2_SDL2_SOUNDIMPL mixer_sound.c)
|
||||
|
@ -42,7 +48,13 @@ set(SRB2_SDL2_HEADERS
|
|||
source_group("Interface Code" FILES ${SRB2_SDL2_SOURCES} ${SRB2_SDL2_HEADERS})
|
||||
|
||||
# Dependency
|
||||
find_package(SDL2)
|
||||
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
|
||||
set(SDL2_FOUND ON)
|
||||
set(SDL2_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/include/SDL2)
|
||||
set(SDL2_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/lib -lSDL2")
|
||||
else()
|
||||
find_package(SDL2)
|
||||
endif()
|
||||
|
||||
if(${SDL2_FOUND})
|
||||
set(SRB2_SDL2_TOTAL_SOURCES
|
||||
|
@ -185,7 +197,13 @@ if(${SDL2_FOUND})
|
|||
endif()
|
||||
|
||||
if(MSVC)
|
||||
find_package(SDL2_MAIN REQUIRED)
|
||||
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
|
||||
set(SDL2_MAIN_FOUND ON)
|
||||
set(SDL2_MAIN_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/include/SDL2)
|
||||
set(SDL2_MAIN_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/lib -lSDL2main")
|
||||
else()
|
||||
find_package(SDL2_MAIN REQUIRED)
|
||||
endif()
|
||||
target_link_libraries(SRB2SDL2 PRIVATE
|
||||
${SDL2_MAIN_LIBRARIES}
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue