diff --git a/CMakeLists.txt b/CMakeLists.txt index 991e61dac..153fcfb2f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,13 @@ 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) message(STATUS "No build type selected, default to STKRelease") @@ -66,9 +73,9 @@ set(STK_INSTALL_DATA_DIR "share/supertuxkart" CACHE # These variables enable MSVC to find libraries located in "dependencies" if(WIN32) - set(ENV{PATH} "$ENV{PATH};${PROJECT_SOURCE_DIR}/dependencies/include") - set(ENV{LIB} ${PROJECT_SOURCE_DIR}/dependencies/lib) - set(ENV{OPENALDIR} ${PROJECT_SOURCE_DIR}/dependencies) + set(ENV{PATH} "$ENV{PATH};${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/include") + set(ENV{LIB} ${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib) + set(ENV{OPENALDIR} ${PROJECT_SOURCE_DIR}/${DEPENDENCIES}) add_definitions(-D_IRR_STATIC_LIB_) add_definitions(-DNO_IRR_COMPILE_WITH_X11_) endif() @@ -145,14 +152,14 @@ else() endif() if(BUILD_RECORDER) - find_library(TURBOJPEG_LIBRARY NAMES turbojpeg libturbojpeg PATHS "${PROJECT_SOURCE_DIR}/dependencies/lib") + find_library(TURBOJPEG_LIBRARY NAMES turbojpeg libturbojpeg PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib") mark_as_advanced(TURBOJPEG_LIBRARY) if(UNIX) include(FindPkgConfig) pkg_check_modules(VPX vpx) else() - find_path(VPX_INCLUDEDIR NAMES vpx/vpx_codec.h PATHS "${PROJECT_SOURCE_DIR}/dependencies/include") - find_library(VPX_LIBRARIES NAMES libvpx PATHS "${PROJECT_SOURCE_DIR}/dependencies/lib") + find_path(VPX_INCLUDEDIR NAMES vpx/vpx_codec.h PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/include") + find_library(VPX_LIBRARIES NAMES libvpx PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib") endif() include_directories(${VPX_INCLUDEDIR}) if(BUILD_RECORDER_WITH_SOUND AND UNIX) @@ -380,7 +387,7 @@ else() elseif(MINGW) set(PTHREAD_NAMES "winpthread-1" "libwinpthread-1" "pthreadGC2") endif() - find_library(PTHREAD_LIBRARY NAMES pthread ${PTHREAD_NAMES} PATHS ${PROJECT_SOURCE_DIR}/dependencies/lib) + find_library(PTHREAD_LIBRARY NAMES pthread ${PTHREAD_NAMES} PATHS ${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib) mark_as_advanced(PTHREAD_LIBRARY) # Set data dir (absolute or relative to CMAKE_INSTALL_PREFIX) @@ -402,9 +409,9 @@ endif() # CURL if(MSVC) - target_link_libraries(supertuxkart ${PROJECT_SOURCE_DIR}/dependencies/lib/libcurl.lib) + target_link_libraries(supertuxkart ${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib/libcurl.lib) elseif(MINGW) - target_link_libraries(supertuxkart ${PROJECT_SOURCE_DIR}/dependencies/lib/libcurldll.a) + target_link_libraries(supertuxkart ${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib/libcurldll.a) else() find_package(CURL REQUIRED) include_directories(${CURL_INCLUDE_DIRS}) @@ -487,7 +494,7 @@ if(USE_WIIUSE) if(WIIUSE_BUILD) target_link_libraries(supertuxkart wiiuse) else() - target_link_libraries(supertuxkart ${PROJECT_SOURCE_DIR}/dependencies/lib/wiiuse.lib) + target_link_libraries(supertuxkart ${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib/wiiuse.lib) endif() else() target_link_libraries(supertuxkart wiiuse bluetooth) @@ -500,7 +507,7 @@ if(MSVC OR MINGW) target_link_libraries(supertuxkart iphlpapi.lib) add_custom_command(TARGET supertuxkart POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory - "${PROJECT_SOURCE_DIR}/dependencies/dll" + "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/dll" $) add_custom_target(stkshaders SOURCES ${STK_SHADERS}) endif() diff --git a/cmake/FindFreetype.cmake b/cmake/FindFreetype.cmake index 7d27a2102..3e15de92e 100644 --- a/cmake/FindFreetype.cmake +++ b/cmake/FindFreetype.cmake @@ -10,8 +10,8 @@ # Freetype library list if(WIN32) - find_path(FREETYPE_INCLUDE_DIRS NAMES freetype/freetype.h PATHS "${PROJECT_SOURCE_DIR}/dependencies/include") - find_library(FREETYPE_LIBRARY NAMES freetype PATHS "${PROJECT_SOURCE_DIR}/dependencies/lib") + find_path(FREETYPE_INCLUDE_DIRS NAMES freetype/freetype.h PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/include") + find_library(FREETYPE_LIBRARY NAMES freetype PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib") set(FREETYPE_FOUND 1) set(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY}) elseif(APPLE) diff --git a/cmake/FindFribidi.cmake b/cmake/FindFribidi.cmake index 5d772f041..c31f4bfe3 100644 --- a/cmake/FindFribidi.cmake +++ b/cmake/FindFribidi.cmake @@ -24,8 +24,8 @@ else() endif() if(NOT FRIBIDI_FOUND) - find_path(FRIBIDI_INCLUDE_DIR NAMES fribidi/fribidi.h PATHS /Library/Frameworks/fribidi.framework/Headers "${PROJECT_SOURCE_DIR}/dependencies/include") - find_library(FRIBIDI_LIBRARY NAMES fribidi PATHS /Library/Frameworks/fribidi.framework "${PROJECT_SOURCE_DIR}/dependencies/lib") + find_path(FRIBIDI_INCLUDE_DIR NAMES fribidi/fribidi.h PATHS /Library/Frameworks/fribidi.framework/Headers "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/include") + find_library(FRIBIDI_LIBRARY NAMES fribidi PATHS /Library/Frameworks/fribidi.framework "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib") include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Fribidi DEFAULT_MSG FRIBIDI_INCLUDE_DIR FRIBIDI_LIBRARY) diff --git a/cmake/FindOggVorbis.cmake b/cmake/FindOggVorbis.cmake index 387861c42..7f16d7e66 100644 --- a/cmake/FindOggVorbis.cmake +++ b/cmake/FindOggVorbis.cmake @@ -10,12 +10,12 @@ # OggVorbis library list -find_path(OGGVORBIS_OGG_INCLUDE_DIR NAMES ogg/ogg.h PATHS "${PROJECT_SOURCE_DIR}/dependencies/include") -find_path(OGGVORBIS_VORBIS_INCLUDE_DIR NAMES vorbis/vorbisfile.h PATHS "${PROJECT_SOURCE_DIR}/dependencies/include") -find_library(OGGVORBIS_OGG_LIBRARY NAMES ogg Ogg libogg PATHS "${PROJECT_SOURCE_DIR}/dependencies/lib") -find_library(OGGVORBIS_VORBIS_LIBRARY NAMES vorbis Vorbis libvorbis PATHS "${PROJECT_SOURCE_DIR}/dependencies/lib") -find_library(OGGVORBIS_VORBISFILE_LIBRARY NAMES vorbisfile libvorbisfile PATHS "${PROJECT_SOURCE_DIR}/dependencies/lib") -find_library(OGGVORBIS_VORBISENC_LIBRARY NAMES vorbisenc libvorbisenc PATHS "${PROJECT_SOURCE_DIR}/dependencies/lib") +find_path(OGGVORBIS_OGG_INCLUDE_DIR NAMES ogg/ogg.h PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/include") +find_path(OGGVORBIS_VORBIS_INCLUDE_DIR NAMES vorbis/vorbisfile.h PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/include") +find_library(OGGVORBIS_OGG_LIBRARY NAMES ogg Ogg libogg PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib") +find_library(OGGVORBIS_VORBIS_LIBRARY NAMES vorbis Vorbis libvorbis PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib") +find_library(OGGVORBIS_VORBISFILE_LIBRARY NAMES vorbisfile libvorbisfile PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib") +find_library(OGGVORBIS_VORBISENC_LIBRARY NAMES vorbisenc libvorbisenc PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib") if (APPLE) set(OGGVORBIS_OGG_INCLUDE_DIR "/Library/Frameworks/Ogg.framework/Headers/") diff --git a/cmake/Toolchain-mingw-64bit.cmake b/cmake/Toolchain-mingw-64bit.cmake index 048acad55..c9d8c86ac 100644 --- a/cmake/Toolchain-mingw-64bit.cmake +++ b/cmake/Toolchain-mingw-64bit.cmake @@ -10,7 +10,7 @@ SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++-posix) SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) # here is the target environment located -SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32 /usr/lib/gcc/x86_64-w64-mingw32/4.9-posix ${PROJECT_SOURCE_DIR}/dependencies) +SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32 /usr/lib/gcc/x86_64-w64-mingw32/4.9-posix ${PROJECT_SOURCE_DIR}/${DEPENDENCIES}) # adjust the default behaviour of the FIND_XXX() commands: # search headers and libraries in the target environment, search diff --git a/cmake/Toolchain-mingw.cmake b/cmake/Toolchain-mingw.cmake index 9d3337d56..680860747 100644 --- a/cmake/Toolchain-mingw.cmake +++ b/cmake/Toolchain-mingw.cmake @@ -10,7 +10,7 @@ SET(CMAKE_CXX_COMPILER i686-w64-mingw32-g++-posix) SET(CMAKE_RC_COMPILER i686-w64-mingw32-windres) # here is the target environment located -SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32 /usr/lib/gcc/i686-w64-mingw32/4.9-posix ${PROJECT_SOURCE_DIR}/dependencies) +SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32 /usr/lib/gcc/i686-w64-mingw32/4.9-posix ${PROJECT_SOURCE_DIR}/${DEPENDENCIES}) # adjust the default behaviour of the FIND_XXX() commands: # search headers and libraries in the target environment, search