From 5e5d86bc6d2b5ea26f05614f8eafd528e4117a70 Mon Sep 17 00:00:00 2001 From: hiker Date: Thu, 6 Apr 2017 23:59:01 +1000 Subject: [PATCH 01/11] On windows look for the 64-bit dependency package in dependencies-64bit. This allows installation compiling 32 and 64-bit windows versions from the same repo without switching dependencies. --- CMakeLists.txt | 29 ++++++++++++++++++----------- cmake/FindFreetype.cmake | 4 ++-- cmake/FindFribidi.cmake | 4 ++-- cmake/FindOggVorbis.cmake | 12 ++++++------ cmake/Toolchain-mingw-64bit.cmake | 2 +- cmake/Toolchain-mingw.cmake | 2 +- 6 files changed, 30 insertions(+), 23 deletions(-) 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 From 8a1d0bae34767839a6ffc6a2d65afecc39d2c35a Mon Sep 17 00:00:00 2001 From: hiker Date: Fri, 7 Apr 2017 00:41:08 +1000 Subject: [PATCH 02/11] Fixed some 64-bit related compiler warnings on VS. --- lib/bullet/src/LinearMath/btSerializer.h | 6 +++--- src/graphics/material.hpp | 2 +- src/graphics/render_info.hpp | 5 ++++- src/guiengine/abstract_state_manager.hpp | 5 ++++- src/network/network_string.hpp | 2 +- src/utils/ptr_vector.hpp | 2 +- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/bullet/src/LinearMath/btSerializer.h b/lib/bullet/src/LinearMath/btSerializer.h index 689449a73..0b2dc1087 100644 --- a/lib/bullet/src/LinearMath/btSerializer.h +++ b/lib/bullet/src/LinearMath/btSerializer.h @@ -213,7 +213,7 @@ protected: int *intPtr=0; short *shtPtr=0; -#ifdef __MINGW64__ +#if defined(__MINGW64__) || defined(_WIN64) char *cp = 0;int dataLen =0;intptr_t nr=0; #else char *cp = 0;int dataLen =0;long nr=0; @@ -251,7 +251,7 @@ protected: cp++; } { -#ifdef __MINGW64__ +#if defined(__MINGW64__) || defined(_WIN64) nr= (intptr_t)cp; #else nr= (long)cp; @@ -290,7 +290,7 @@ protected: } { -#ifdef __MINGW64__ +#if defined(__MINGW64__) || defined(_WIN64) nr= (intptr_t)cp; #else nr= (long)cp; diff --git a/src/graphics/material.hpp b/src/graphics/material.hpp index c8f52aa5b..7a873689e 100644 --- a/src/graphics/material.hpp +++ b/src/graphics/material.hpp @@ -317,7 +317,7 @@ public: { if (m_hue_settings.empty()) return 0.0f; - const unsigned int hue = m_random_hue.get(m_hue_settings.size()); + const unsigned int hue = m_random_hue.get((int)m_hue_settings.size()); assert(hue < m_hue_settings.size()); return m_hue_settings[hue]; } diff --git a/src/graphics/render_info.hpp b/src/graphics/render_info.hpp index fe669b091..4bd5f7f91 100644 --- a/src/graphics/render_info.hpp +++ b/src/graphics/render_info.hpp @@ -76,7 +76,10 @@ public: */ bool isStatic() const { return m_dynamic_hue.empty(); } // ------------------------------------------------------------------------ - unsigned int getNumberOfHue() const { return m_dynamic_hue.size(); } + unsigned int getNumberOfHue() const + { + return (unsigned int)m_dynamic_hue.size(); + } // getNumberOfHue // ------------------------------------------------------------------------ float getDynamicHue(unsigned int hue) const { diff --git a/src/guiengine/abstract_state_manager.hpp b/src/guiengine/abstract_state_manager.hpp index cd5d4d5e4..91a794def 100644 --- a/src/guiengine/abstract_state_manager.hpp +++ b/src/guiengine/abstract_state_manager.hpp @@ -170,7 +170,10 @@ namespace GUIEngine // -------------------------------------------------------------------- /** Returns the number of screens on the stack. Is used to decide * if exiting a screen would cause STK to end or not. */ - unsigned int getMenuStackSize() const { return m_menu_stack.size(); } + unsigned int getMenuStackSize() const + { + return (unsigned int)m_menu_stack.size(); + } }; // Class AbstractStateManager } // GUIEngine diff --git a/src/network/network_string.hpp b/src/network/network_string.hpp index 0c521107a..4e2239259 100644 --- a/src/network/network_string.hpp +++ b/src/network/network_string.hpp @@ -171,7 +171,7 @@ public: * difference to size() happens if the string to be sent was previously * read, and has m_current_offset != 0. Even in this case the whole * string must be sent. */ - unsigned int getTotalSize() const { return m_buffer.size(); } + unsigned int getTotalSize() const { return (unsigned int)m_buffer.size(); } // ------------------------------------------------------------------------ // All functions related to adding data to a network string /** Add 8 bit unsigned int. */ diff --git a/src/utils/ptr_vector.hpp b/src/utils/ptr_vector.hpp index 23347185b..53bba80e5 100644 --- a/src/utils/ptr_vector.hpp +++ b/src/utils/ptr_vector.hpp @@ -161,7 +161,7 @@ public: { TYPE * pointer = m_contents_vector[n]; delete pointer; - m_contents_vector[n] = (TYPE*)0xDEADBEEF; + m_contents_vector[n] = (TYPE*)(intptr_t)0xDEADBEEF; // When deleting, it's important that the same pointer cannot be // twice in the vector, resulting in a double delete From 14ec154f19c8b1db815d224468c8166e863c1bdf Mon Sep 17 00:00:00 2001 From: hiker Date: Fri, 7 Apr 2017 20:27:11 +1000 Subject: [PATCH 03/11] Try to fix linux build. --- src/utils/ptr_vector.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils/ptr_vector.hpp b/src/utils/ptr_vector.hpp index 53bba80e5..2485c9700 100644 --- a/src/utils/ptr_vector.hpp +++ b/src/utils/ptr_vector.hpp @@ -28,6 +28,7 @@ #include #include +#include #include "utils/aligned_array.hpp" From 668fdd3b49e7e12ea7272f830d5f546eeef26ee5 Mon Sep 17 00:00:00 2001 From: hiker Date: Fri, 7 Apr 2017 23:25:52 +1000 Subject: [PATCH 04/11] Fixed some 64-bit related compiler warnings. --- src/audio/sfx_manager.cpp | 2 +- src/config/saved_grand_prix.cpp | 2 +- src/config/user_config.cpp | 8 ++++---- src/font/face_ttf.hpp | 2 +- src/modes/soccer_world.hpp | 4 ++-- src/race/race_manager.cpp | 6 +++--- src/replay/replay_play.cpp | 2 +- src/replay/replay_play.hpp | 7 ++++--- src/tracks/graph.hpp | 2 +- 9 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/audio/sfx_manager.cpp b/src/audio/sfx_manager.cpp index 94e32b445..646528306 100644 --- a/src/audio/sfx_manager.cpp +++ b/src/audio/sfx_manager.cpp @@ -502,7 +502,7 @@ void SFXManager::loadSfx() delete root; // Now load them in parallel - const int max = m_all_sfx_types.size(); + const int max = (int)m_all_sfx_types.size(); SFXBuffer **array = new SFXBuffer *[max]; i = 0; diff --git a/src/config/saved_grand_prix.cpp b/src/config/saved_grand_prix.cpp index 5ee5b5371..7a2d5cbad 100644 --- a/src/config/saved_grand_prix.cpp +++ b/src/config/saved_grand_prix.cpp @@ -172,7 +172,7 @@ void SavedGrandPrix::loadKarts(std::vector & kart_list) else { // Get correct player - for(unsigned int x = kart_list.size()-m_player_karts; + for(unsigned int x = (unsigned int)kart_list.size()-m_player_karts; x < kart_list.size(); x++) { if(kart_list[x].m_local_player_id == m_karts[i].m_local_player_id) diff --git a/src/config/user_config.cpp b/src/config/user_config.cpp index 95f013d91..c4aa910ab 100644 --- a/src/config/user_config.cpp +++ b/src/config/user_config.cpp @@ -122,7 +122,7 @@ void GroupUserConfigParam::writeInner(std::ofstream& stream, int level) const { std::string tab(level * 4,' '); for(int i = 0; i < level; i++) tab =+ " "; - const int children_amount = m_attributes.size(); + const int children_amount = (int)m_attributes.size(); stream << " " << tab.c_str() << "<" << m_param_name.c_str() << "\n"; @@ -144,7 +144,7 @@ void GroupUserConfigParam::findYourDataInAChildOf(const XMLNode* node) return; } - const int attributes_amount = m_attributes.size(); + const int attributes_amount = (int)m_attributes.size(); for (int n=0; nfindYourDataInAnAttributeOf(child); @@ -246,7 +246,7 @@ ListUserConfigParam::ListUserConfigParam(const char* param_name, template void ListUserConfigParam::write(std::ofstream& stream) const { - const int elts_amount = m_elements.size(); + const int elts_amount = (int)m_elements.size(); // comment if(m_comment.size() > 0) stream << "