improve win32 dependencies git submodule handling

Use `git submodule update --remote --recursive` instead of `git
submodule update --init --recursive` so that the latest version of the
repo is always installed.

Run the command from cmake instead of throwing an error if the submodule
is not checked out. Only throw an error if the checkout failed or the
source tree is not a git checkout.

Don't add the `mingw-xaudio` include directory if using MSVC.

Remove the submodule check from src/wx/CMakeLists.txt, having it in the
main CMakeLists.txt is enough.
This commit is contained in:
Rafael Kitover 2017-09-19 06:11:41 -07:00
parent d3351a7575
commit 268c638456
3 changed files with 15 additions and 14 deletions

View File

@ -286,13 +286,22 @@ endif( ENABLE_NLS )
# Win32 deps submodule
IF(WIN32)
IF(NOT EXISTS "${CMAKE_SOURCE_DIR}/dependencies/mingw-xaudio/include" AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
MESSAGE(FATAL_ERROR "Please pull in git submodules, e.g.\nrun: git submodule update --init --recursive")
IF(NOT EXISTS "${CMAKE_SOURCE_DIR}/dependencies/mingw-xaudio/include")
set(git_checkout FALSE)
find_package(Git)
if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
set(git_checkout TRUE)
execute_process(COMMAND "${GIT_EXECUTABLE}" submodule update --remote --recursive RESULT_VARIABLE git_status)
endif()
if(NOT (git_checkout AND git_status EQUAL 0))
message(FATAL_ERROR "Please pull in git submodules, e.g.\nrun: git submodule update --remote --recursive")
endif()
ENDIF()
INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/dependencies/mingw-xaudio/include")
IF(MSVC)
IF(MINGW)
INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/dependencies/mingw-xaudio/include")
ELSEIF(MSVC)
SET(DEPS_MSVC "${CMAKE_SOURCE_DIR}/dependencies/msvc")
INCLUDE_DIRECTORIES("${DEPS_MSVC}") # for GL/glext.h and getopt.h
ENDIF()

View File

@ -240,7 +240,7 @@ check_cross() {
esac
# get the necessary win32 headers
check git submodule update --init --recursive
check git submodule update --remote --recursive
;;
m32)
if [ -z "$msys2" -a -z "$fedora" -a -z "$arch_linux" -a -z "$solus" ]; then

View File

@ -13,14 +13,6 @@ endif( WIN32 )
option( ENABLE_OPENAL "Enable OpenAL for the wxWidgets port" ON )
IF(WIN32 AND MINGW)
IF(NOT EXISTS "${CMAKE_SOURCE_DIR}/dependencies")
MESSAGE(FATAL_ERROR "Please run: git submodule update --init --recursive")
ENDIF()
INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/dependencies/mingw-xaudio/include")
ENDIF()
IF(APPLE)
ADD_DEFINITIONS(-DwxMAC_USE_CORE_GRAPHICS)
ENDIF(APPLE)