-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
181 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,37 @@ | ||
include(FetchContent) | ||
set(SDL2_DISABLE_SDL2MAIN TRUE CACHE INTERNAL "") | ||
set(SDL_SHARED FALSE CACHE INTERNAL "") | ||
set(SDL_STATIC TRUE CACHE INTERNAL "") | ||
set(SDL_TEST FALSE CACHE INTERNAL "") | ||
function(build_sdl2) | ||
include(FetchContent) | ||
set(SDL2_DISABLE_SDL2MAIN TRUE CACHE INTERNAL "") | ||
set(SDL_SHARED FALSE CACHE INTERNAL "") | ||
set(SDL_STATIC TRUE CACHE INTERNAL "") | ||
set(SDL_TEST FALSE CACHE INTERNAL "") | ||
|
||
set(SDL_ATOMIC TRUE CACHE INTERNAL "") | ||
set(SDL_AUDIO FALSE CACHE INTERNAL "") | ||
set(SDL_CPUINFO TRUE CACHE INTERNAL "") | ||
set(SDL_EVENTS TRUE CACHE INTERNAL "") | ||
set(SDL_FILE FALSE CACHE INTERNAL "") | ||
set(SDL_FILESYSTEM FALSE CACHE INTERNAL "") | ||
set(SDL_HAPTIC FALSE CACHE INTERNAL "") | ||
set(SDL_HIDAPI TRUE CACHE INTERNAL "") | ||
set(SDL_JOYSTICK TRUE CACHE INTERNAL "") | ||
set(SDL_LOADSO TRUE CACHE INTERNAL "") | ||
set(SDL_LOCALE TRUE CACHE INTERNAL "") | ||
set(SDL_MISC FALSE CACHE INTERNAL "") | ||
set(SDL_POWER FALSE CACHE INTERNAL "") | ||
set(SDL_RENDER FALSE CACHE INTERNAL "") | ||
set(SDL_SENSOR FALSE CACHE INTERNAL "") | ||
set(SDL_THREADS TRUE CACHE INTERNAL "") | ||
set(SDL_TIMERS FALSE CACHE INTERNAL "") | ||
set(SDL_VIDEO FALSE CACHE INTERNAL "") | ||
set(SDL_ATOMIC TRUE CACHE INTERNAL "") | ||
set(SDL_AUDIO FALSE CACHE INTERNAL "") | ||
set(SDL_CPUINFO TRUE CACHE INTERNAL "") | ||
set(SDL_EVENTS TRUE CACHE INTERNAL "") | ||
set(SDL_FILE FALSE CACHE INTERNAL "") | ||
set(SDL_FILESYSTEM FALSE CACHE INTERNAL "") | ||
set(SDL_HAPTIC FALSE CACHE INTERNAL "") | ||
set(SDL_HIDAPI TRUE CACHE INTERNAL "") | ||
set(SDL_JOYSTICK TRUE CACHE INTERNAL "") | ||
set(SDL_LOADSO TRUE CACHE INTERNAL "") | ||
set(SDL_LOCALE TRUE CACHE INTERNAL "") | ||
set(SDL_MISC FALSE CACHE INTERNAL "") | ||
set(SDL_POWER FALSE CACHE INTERNAL "") | ||
set(SDL_RENDER FALSE CACHE INTERNAL "") | ||
set(SDL_SENSOR FALSE CACHE INTERNAL "") | ||
set(SDL_THREADS TRUE CACHE INTERNAL "") | ||
set(SDL_TIMERS FALSE CACHE INTERNAL "") | ||
set(SDL_VIDEO FALSE CACHE INTERNAL "") | ||
|
||
FetchContent_Declare( | ||
SDL | ||
GIT_REPOSITORY https://github.com/libsdl-org/SDL.git | ||
GIT_TAG release-2.30.2 | ||
GIT_SHALLOW TRUE | ||
GIT_PROGRESS TRUE | ||
) | ||
FetchContent_MakeAvailable(SDL) | ||
set(SDL2_FOUND TRUE) | ||
FetchContent_Declare( | ||
SDL | ||
GIT_REPOSITORY https://github.com/libsdl-org/SDL.git | ||
GIT_TAG release-2.30.2 | ||
GIT_SHALLOW TRUE | ||
GIT_PROGRESS TRUE | ||
) | ||
FetchContent_MakeAvailable(SDL) | ||
|
||
set(SDL2_FOUND TRUE PARENT_SCOPE) | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,54 @@ | ||
find_package(Git) | ||
|
||
if(NOT GIT_FOUND OR NOT EXISTS "${PROJECT_SOURCE_DIR}/.git") | ||
return() | ||
if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git") | ||
option(GIT_SUBMODULE "Check submodules during build" ON) | ||
if(GIT_SUBMODULE) | ||
message(STATUS "Submodule update") | ||
execute_process( | ||
COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive | ||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" | ||
RESULT_VARIABLE GIT_SUBMODULE_RESULT | ||
OUTPUT_VARIABLE GIT_SUBMODULE_OUTPUT | ||
ERROR_VARIABLE GIT_SUBMODULE_ERROR | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
) | ||
if(NOT GIT_SUBMODULE_RESULT EQUAL 0) | ||
cmake_print_variables(GIT_SUBMODULE_RESULT GIT_SUBMODULE_OUTPUT GIT_SUBMODULE_ERROR) | ||
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMODULE_RESULT}, please checkout submodules") | ||
endif() | ||
endif() | ||
endif() | ||
|
||
# Update submodules as needed | ||
option(GIT_SUBMODULE "Check submodules during build" ON) | ||
if(NOT GIT_SUBMODULE) | ||
return() | ||
endif() | ||
include(CMakePrintHelpers) | ||
|
||
message(STATUS "Submodule update") | ||
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive | ||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" | ||
RESULT_VARIABLE GIT_SUBMODULE_RESULT) | ||
if(NOT GIT_SUBMODULE_RESULT EQUAL "0") | ||
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMODULE_RESULT}, please checkout submodules") | ||
endif() | ||
execute_process( | ||
COMMAND ${GIT_EXECUTABLE} describe --always --tags | ||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
OUTPUT_VARIABLE APP_VERSION_STR | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
) | ||
cmake_print_variables(APP_VERSION_STR) | ||
|
||
# Fetch the necessary git variables | ||
execute_process(COMMAND ${GIT_EXECUTABLE} describe --always --tags | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
OUTPUT_VARIABLE APP_VERSION_STR | ||
OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
execute_process( | ||
COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD | ||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
OUTPUT_VARIABLE GIT_BRANCH | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
) | ||
cmake_print_variables(GIT_BRANCH) | ||
|
||
execute_process(COMMAND ${GIT_EXECUTABLE} describe --abbrev=0 | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
OUTPUT_VARIABLE REL_VERSION | ||
OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
# execute_process( | ||
# COMMAND ${GIT_EXECUTABLE} describe --abbrev=0 | ||
# WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
# OUTPUT_VARIABLE REL_VERSION | ||
# OUTPUT_STRIP_TRAILING_WHITESPACE | ||
# ) | ||
# cmake_print_variables(REL_VERSION) | ||
|
||
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --format=%aI ${REL_VERSION} | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
OUTPUT_VARIABLE REL_DATE | ||
OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
# execute_process( | ||
# COMMAND ${GIT_EXECUTABLE} log -1 --format=%aI ${REL_VERSION} | ||
# WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
# OUTPUT_VARIABLE REL_DATE | ||
# OUTPUT_STRIP_TRAILING_WHITESPACE | ||
# ) | ||
# cmake_print_variables(REL_DATE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.