cmake restructure (#516)

* restructure cmakelists and get tinyxml from package manager

* why is 22.04 so old?

* looks like that worked

* don't do the tinyxml part

* whoops
This commit is contained in:
briaguya
2024-04-25 17:43:49 -04:00
committed by GitHub
parent 85f6de497f
commit 2b8cb6322c
5 changed files with 33 additions and 31 deletions
+6 -13
View File
@@ -15,19 +15,12 @@ endif()
include(cmake/Utils.cmake)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows" AND USE_AUTO_VCPKG)
include(cmake/automate-vcpkg.cmake)
if ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
set(VCPKG_TRIPLET x86-windows-static)
set(VCPKG_TARGET_TRIPLET x86-windows-static)
elseif ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
set(VCPKG_TRIPLET x64-windows-static)
set(VCPKG_TARGET_TRIPLET x64-windows-static)
endif()
vcpkg_bootstrap()
vcpkg_install_packages(zlib bzip2 sdl2 glew libzip nlohmann-json)
include(cmake/dependencies/common.cmake)
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
include(cmake/dependencies/android.cmake)
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
include(cmake/dependencies/windows.cmake)
endif()
add_subdirectory("extern")
+12
View File
@@ -0,0 +1,12 @@
find_package(SDL2 QUIET)
if (NOT ${SDL2_FOUND})
include(FetchContent)
FetchContent_Declare(
SDL2
GIT_REPOSITORY https://github.com/libsdl-org/SDL.git
GIT_TAG release-2.28.1
)
message("SDL2 not found. Downloading now...")
FetchContent_MakeAvailable(SDL2)
message("SDL2 downloaded to " ${FETCHCONTENT_BASE_DIR}/sdl2-src)
endif()
+1
View File
@@ -0,0 +1 @@
+14
View File
@@ -0,0 +1,14 @@
if (USE_AUTO_VCPKG)
include(cmake/automate-vcpkg.cmake)
if ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
set(VCPKG_TRIPLET x86-windows-static)
set(VCPKG_TARGET_TRIPLET x86-windows-static)
elseif ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
set(VCPKG_TRIPLET x64-windows-static)
set(VCPKG_TARGET_TRIPLET x64-windows-static)
endif()
vcpkg_bootstrap()
vcpkg_install_packages(zlib bzip2 sdl2 glew libzip nlohmann-json tinyxml2)
endif()
-18
View File
@@ -6,24 +6,6 @@ elseif (NOT CMAKE_SYSTEM_NAME STREQUAL "Android")
find_package(SDL2 REQUIRED)
endif()
################################################################################
# Find/download SDL2 for Android
################################################################################
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
find_package(SDL2 QUIET)
if (NOT ${SDL2_FOUND})
include(FetchContent)
FetchContent_Declare(
SDL2
GIT_REPOSITORY https://github.com/libsdl-org/SDL.git
GIT_TAG release-2.28.1
)
message("SDL2 not found. Downloading now...")
FetchContent_MakeAvailable(SDL2)
message("SDL2 downloaded to " ${FETCHCONTENT_BASE_DIR}/sdl2-src)
endif()
endif()
#=================== DrLibs ===================
set(DRLIBS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dr_libs)