From 8771c776896871ea487d041489c07d0e9be3cc04 Mon Sep 17 00:00:00 2001 From: Deve Date: Thu, 1 Feb 2018 21:36:28 +0100 Subject: [PATCH] Allow to use dependencies for vs and mingw without changing the names every time. Now there are: - dependencies-vs - dependencies-vs-64bit - dependencies-mingw - dependencies-mingw64 And if it's not found, then fallback to: - dependencies - dependencies-64bit So that if you use only one compiler, then you can just still use "dependencies" or "dependencies-64bit". And I didn't restrict it to WIN32 only, because in theory it should be possible to put there openglrecorder for linux build. --- CMakeLists.txt | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b47027b58..cb5caa1ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,15 +11,8 @@ endif() set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake") include(CMakeDependentOption) -set(DEPENDENCIES "dependencies") -# In case of 64-bit windows, use a different path for dependencies -# so that both dependencies can be installed next to each other -if ( WIN32 AND (CMAKE_SIZEOF_VOID_P EQUAL 8 ) ) - set(DEPENDENCIES "dependencies-64bit") -endif() - include(BuildTypeSTKRelease) -if (NOT CMAKE_BUILD_TYPE) +if(NOT CMAKE_BUILD_TYPE) message(STATUS "No build type selected, default to STKRelease") set(CMAKE_BUILD_TYPE "STKRelease") endif() @@ -34,7 +27,7 @@ option(USE_SYSTEM_GLEW "Use system GLEW instead of the built-in version, when av CMAKE_DEPENDENT_OPTION(BUILD_RECORDER "Build opengl recorder" ON "NOT SERVER_ONLY;NOT USE_GLES2;NOT APPLE" OFF) -if ((UNIX AND NOT APPLE) AND NOT SERVER_ONLY) +if((UNIX AND NOT APPLE) AND NOT SERVER_ONLY) option(ENABLE_WAYLAND_DEVICE "Enable Wayland device for linux build" ON) option(USE_GLES2 "Use OpenGL ES2 renderer" OFF) endif() @@ -74,6 +67,32 @@ set(STK_INSTALL_BINARY_DIR "bin" CACHE set(STK_INSTALL_DATA_DIR "share/supertuxkart" CACHE STRING "Install data folder to this directory, absolute or relative to CMAKE_INSTALL_PREFIX") +# Define dependencies path +if(MSVC) + set(DEPENDENCIES "dependencies-vs") +elseif(MINGW) + set(DEPENDENCIES "dependencies-mingw") +else() + set(DEPENDENCIES "dependencies") +endif() + +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(DEPENDENCIES "${DEPENDENCIES}-64bit") +endif() + +if(WIN32) + if(NOT IS_DIRECTORY "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}") + set(DEPENDENCIES "dependencies") + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(DEPENDENCIES "${DEPENDENCIES}-64bit") + endif() + endif() + + if(NOT IS_DIRECTORY "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}") + message(FATAL_ERROR "Dependencies directory not found.") + endif() +endif() + # These variables enable MSVC to find libraries located in "dependencies" if(WIN32) set(ENV{PATH} "$ENV{PATH};${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/include")