Update LLVM MinGW toolchain and CMake scripts for ARM64 Windows support
This commit is contained in:
parent
92f6158ffd
commit
0e9d45665b
119
CMakeLists.txt
119
CMakeLists.txt
@ -4,12 +4,6 @@ cmake_minimum_required(VERSION 2.8.4)
|
||||
project(SuperTuxKart)
|
||||
set(PROJECT_VERSION "git")
|
||||
|
||||
if (MINGW AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
set(LLVM_MINGW TRUE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gcodeview")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -gcodeview")
|
||||
endif()
|
||||
|
||||
add_definitions( -DSUPERTUXKART_VERSION="${PROJECT_VERSION}" )
|
||||
|
||||
if(NOT (CMAKE_MAJOR_VERSION VERSION_LESS 3))
|
||||
@ -41,7 +35,7 @@ option(USE_SYSTEM_WIIUSE "Use system WiiUse instead of the built-in version, whe
|
||||
option(USE_SQLITE3 "Use sqlite to manage server stats and ban list." ON)
|
||||
|
||||
CMAKE_DEPENDENT_OPTION(USE_CRYPTO_OPENSSL "Use OpenSSL instead of MbedTLS for cryptography in STK." ON
|
||||
"NOT USE_SWITCH" OFF)
|
||||
"NOT USE_SWITCH;NOT WIN32" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(BUILD_RECORDER "Build opengl recorder" ON
|
||||
"NOT SERVER_ONLY;NOT APPLE;NOT USE_SWITCH" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(USE_SYSTEM_SQUISH "Use system Squish library instead of the built-in version, when available." ON
|
||||
@ -125,28 +119,22 @@ 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 OR LLVM_MINGW)
|
||||
set(DEPENDENCIES "dependencies-vs")
|
||||
elseif(MINGW)
|
||||
set(DEPENDENCIES "dependencies-mingw")
|
||||
else()
|
||||
set(DEPENDENCIES "dependencies")
|
||||
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" arch_lower)
|
||||
set(BUILD_ARCH "unknown")
|
||||
if (CMAKE_GENERATOR_PLATFORM)
|
||||
set(BUILD_ARCH "${CMAKE_GENERATOR_PLATFORM}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(DEPENDENCIES "${DEPENDENCIES}-64bit")
|
||||
if(arch_lower MATCHES "arm64" OR arch_lower MATCHES "aarch64" OR ${CMAKE_GENERATOR} MATCHES "(ARM64)" OR ${BUILD_ARCH} MATCHES "(ARM64)")
|
||||
set(DEPENDENCIES "dependencies-win-aarch64")
|
||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(DEPENDENCIES "dependencies-win-x86_64")
|
||||
else()
|
||||
set(DEPENDENCIES "dependencies-win-i686")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
ADD_DEFINITIONS(-DUNICODE)
|
||||
ADD_DEFINITIONS(-D_UNICODE)
|
||||
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()
|
||||
@ -454,10 +442,6 @@ if(MINGW AND CMAKE_BUILD_TYPE MATCHES Release)
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--subsystem,windows")
|
||||
endif()
|
||||
|
||||
if (LLVM_MINGW)
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-pdb=supertuxkart.pdb")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
# By default windows.h has macros defined for min and max that screw up everything
|
||||
add_definitions(-DNOMINMAX)
|
||||
@ -580,34 +564,25 @@ endif()
|
||||
# CURL and OpenSSL or MbedTLS
|
||||
# 1.0.1d for compatible AES GCM handling
|
||||
SET(OPENSSL_MINIMUM_VERSION "1.0.1d")
|
||||
if (MSVC OR LLVM_MINGW)
|
||||
|
||||
find_package(CURL REQUIRED)
|
||||
include_directories(${CURL_INCLUDE_DIRS})
|
||||
|
||||
find_path(MBEDTLS_INCLUDE_DIRS mbedtls/version.h)
|
||||
find_library(MBEDCRYPTO_LIBRARY NAMES mbedcrypto libmbedcrypto)
|
||||
|
||||
if (NOT MBEDCRYPTO_LIBRARY OR NOT MBEDTLS_INCLUDE_DIRS OR USE_CRYPTO_OPENSSL)
|
||||
set(USE_CRYPTO_OPENSSL ON)
|
||||
target_link_libraries(supertuxkart ${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib/libcurl.lib)
|
||||
target_link_libraries(supertuxkart ${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib/libeay32.lib)
|
||||
elseif(MINGW)
|
||||
set(USE_CRYPTO_OPENSSL ON)
|
||||
target_link_libraries(supertuxkart ${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib/libcurl.dll)
|
||||
target_link_libraries(supertuxkart ${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib/libeay32.dll)
|
||||
else()
|
||||
find_package(CURL REQUIRED)
|
||||
include_directories(${CURL_INCLUDE_DIRS})
|
||||
find_package(OpenSSL REQUIRED)
|
||||
|
||||
find_path(MBEDTLS_INCLUDE_DIRS mbedtls/version.h)
|
||||
find_library(MBEDCRYPTO_LIBRARY NAMES mbedcrypto libmbedcrypto)
|
||||
|
||||
if (NOT MBEDCRYPTO_LIBRARY OR NOT MBEDTLS_INCLUDE_DIRS OR USE_CRYPTO_OPENSSL)
|
||||
set(USE_CRYPTO_OPENSSL ON)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
|
||||
if(${OPENSSL_VERSION} VERSION_LESS ${OPENSSL_MINIMUM_VERSION} OR
|
||||
(${OPENSSL_VERSION} VERSION_EQUAL ${OPENSSL_MINIMUM_VERSION} AND ${OPENSSL_VERSION} STRLESS ${OPENSSL_MINIMUM_VERSION}))
|
||||
message(FATAL_ERROR "OpenSSL version found (${OPENSSL_VERSION}) is less then the minimum required (${OPENSSL_MINIMUM_VERSION}), aborting.")
|
||||
endif()
|
||||
include_directories(${OpenSSL_INCLUDE_DIRS})
|
||||
else()
|
||||
set(USE_CRYPTO_OPENSSL OFF)
|
||||
include_directories(${MBEDTLS_INCLUDE_DIRS})
|
||||
if(${OPENSSL_VERSION} VERSION_LESS ${OPENSSL_MINIMUM_VERSION} OR
|
||||
(${OPENSSL_VERSION} VERSION_EQUAL ${OPENSSL_MINIMUM_VERSION} AND ${OPENSSL_VERSION} STRLESS ${OPENSSL_MINIMUM_VERSION}))
|
||||
message(FATAL_ERROR "OpenSSL version found (${OPENSSL_VERSION}) is less then the minimum required (${OPENSSL_MINIMUM_VERSION}), aborting.")
|
||||
endif()
|
||||
include_directories(${OpenSSL_INCLUDE_DIRS})
|
||||
else()
|
||||
set(USE_CRYPTO_OPENSSL OFF)
|
||||
include_directories(${MBEDTLS_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
if (USE_CRYPTO_OPENSSL)
|
||||
@ -739,7 +714,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}/bin"
|
||||
$<TARGET_FILE_DIR:supertuxkart>)
|
||||
add_custom_target(stkshaders SOURCES ${STK_SHADERS})
|
||||
endif()
|
||||
@ -749,28 +724,17 @@ if(MINGW)
|
||||
if (NOT CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
target_link_libraries(supertuxkart -mwindows)
|
||||
endif()
|
||||
if (LLVM_MINGW)
|
||||
find_library(LIBCPP NAMES "libc++.dll" PATHS ${CMAKE_FIND_ROOT_PATH})
|
||||
if (LIBCPP)
|
||||
file(COPY ${LIBCPP} DESTINATION ${CMAKE_BINARY_DIR}/bin/)
|
||||
endif()
|
||||
find_library(LIBUNWIND NAMES "libunwind.dll" PATHS ${CMAKE_FIND_ROOT_PATH})
|
||||
if (LIBUNWIND)
|
||||
file(COPY ${LIBUNWIND} DESTINATION ${CMAKE_BINARY_DIR}/bin/)
|
||||
endif()
|
||||
else()
|
||||
find_library(LIBGCC NAMES "libgcc_s_dw2-1.dll" "libgcc_s_sjlj-1.dll" "libgcc_s_seh-1.dll" PATHS ${CMAKE_FIND_ROOT_PATH})
|
||||
if (LIBGCC)
|
||||
file(COPY ${LIBGCC} DESTINATION ${CMAKE_BINARY_DIR}/bin/)
|
||||
endif()
|
||||
find_library(LIBSTDCPP NAMES "libstdc++-6.dll" PATHS ${CMAKE_FIND_ROOT_PATH})
|
||||
if (LIBSTDCPP)
|
||||
file(COPY ${LIBSTDCPP} DESTINATION ${CMAKE_BINARY_DIR}/bin/)
|
||||
endif()
|
||||
find_library(LIBPTHREAD NAMES "winpthread-1.dll" "libwinpthread-1.dll" "pthreadGC2.dll" PATHS ${CMAKE_FIND_ROOT_PATH})
|
||||
if(LIBPTHREAD)
|
||||
file(COPY ${LIBPTHREAD} DESTINATION ${CMAKE_BINARY_DIR}/bin/)
|
||||
endif()
|
||||
find_library(LIBGCC NAMES "libgcc_s_dw2-1.dll" "libgcc_s_sjlj-1.dll" "libgcc_s_seh-1.dll" PATHS ${CMAKE_FIND_ROOT_PATH})
|
||||
if (LIBGCC)
|
||||
file(COPY ${LIBGCC} DESTINATION ${CMAKE_BINARY_DIR}/bin/)
|
||||
endif()
|
||||
find_library(LIBSTDCPP NAMES "libstdc++-6.dll" PATHS ${CMAKE_FIND_ROOT_PATH})
|
||||
if (LIBSTDCPP)
|
||||
file(COPY ${LIBSTDCPP} DESTINATION ${CMAKE_BINARY_DIR}/bin/)
|
||||
endif()
|
||||
find_library(LIBPTHREAD NAMES "winpthread-1.dll" "libwinpthread-1.dll" "pthreadGC2.dll" PATHS ${CMAKE_FIND_ROOT_PATH})
|
||||
if(LIBPTHREAD)
|
||||
file(COPY ${LIBPTHREAD} DESTINATION ${CMAKE_BINARY_DIR}/bin/)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -839,8 +803,3 @@ if(MINGW)
|
||||
install(DIRECTORY ${CMAKE_BINARY_DIR}/bin/ DESTINATION ${STK_INSTALL_BINARY_DIR}
|
||||
FILES_MATCHING PATTERN "*.dll")
|
||||
endif()
|
||||
|
||||
if (LLVM_MINGW)
|
||||
set(COPY_PDB_CMD cp ${CMAKE_BINARY_DIR}/supertuxkart.pdb ${CMAKE_BINARY_DIR}/bin)
|
||||
add_custom_command(TARGET supertuxkart POST_BUILD COMMAND ${COPY_PDB_CMD})
|
||||
endif()
|
||||
|
@ -10,7 +10,7 @@
|
||||
# Freetype library list
|
||||
|
||||
if(WIN32)
|
||||
find_path(FREETYPE_INCLUDE_DIRS NAMES freetype/freetype.h PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/include")
|
||||
find_path(FREETYPE_INCLUDE_DIRS NAMES freetype/freetype.h PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/include/freetype2")
|
||||
find_library(FREETYPE_LIBRARY NAMES freetype libfreetype PATHS "${PROJECT_SOURCE_DIR}/${DEPENDENCIES}/lib")
|
||||
set(FREETYPE_FOUND 1)
|
||||
set(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY})
|
||||
|
@ -1,20 +0,0 @@
|
||||
# Usage:
|
||||
# cmake .. -DLLVM_PREFIX=/path/to/llvm-mingw-prefix -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-llvm-mingw-64bit.cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||
|
||||
# the name of the target operating system
|
||||
SET(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
# which compilers to use for C and C++
|
||||
SET(CMAKE_C_COMPILER ${LLVM_PREFIX}/bin/x86_64-w64-mingw32-clang)
|
||||
SET(CMAKE_CXX_COMPILER ${LLVM_PREFIX}/bin/x86_64-w64-mingw32-clang++)
|
||||
SET(CMAKE_RC_COMPILER ${LLVM_PREFIX}/bin/x86_64-w64-mingw32-windres)
|
||||
|
||||
# here is the target environment located
|
||||
SET(CMAKE_FIND_ROOT_PATH ${LLVM_PREFIX}/generic-w64-mingw32 ${LLVM_PREFIX}/x86_64-w64-mingw32/bin ${PROJECT_SOURCE_DIR}/dependencies-vs-64bit)
|
||||
|
||||
# adjust the default behaviour of the FIND_XXX() commands:
|
||||
# search headers and libraries in the target environment, search
|
||||
# programs in the host environment
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ALWAYS)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
@ -1,16 +1,21 @@
|
||||
# Usage:
|
||||
# cmake .. -DLLVM_PREFIX=/path/to/llvm-mingw-prefix -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-llvm-mingw.cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||
# cmake .. -DLLVM_ARCH=aarch64 i686 or x86_64 -DLLVM_PREFIX=/path/to/llvm-mingw-prefix -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-llvm-mingw.cmake
|
||||
|
||||
# the name of the target operating system
|
||||
SET(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
# which compilers to use for C and C++
|
||||
SET(CMAKE_C_COMPILER ${LLVM_PREFIX}/bin/i686-w64-mingw32-clang)
|
||||
SET(CMAKE_CXX_COMPILER ${LLVM_PREFIX}/bin/i686-w64-mingw32-clang++)
|
||||
SET(CMAKE_RC_COMPILER ${LLVM_PREFIX}/bin/i686-w64-mingw32-windres)
|
||||
SET(CMAKE_C_COMPILER ${LLVM_PREFIX}/bin/${LLVM_ARCH}-w64-mingw32-clang)
|
||||
SET(CMAKE_CXX_COMPILER ${LLVM_PREFIX}/bin/${LLVM_ARCH}-w64-mingw32-clang++)
|
||||
SET(CMAKE_RC_COMPILER ${LLVM_PREFIX}/bin/${LLVM_ARCH}-w64-mingw32-windres)
|
||||
SET(CMAKE_SYSTEM_PROCESSOR ${LLVM_ARCH})
|
||||
SET(CMAKE_BUILD_TYPE RelWithDebInfo)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -Wl,-pdb=")
|
||||
SET(CMAKE_C_FLAGS -gcodeview)
|
||||
SET(CMAKE_CXX_FLAGS -gcodeview)
|
||||
|
||||
# here is the target environment located
|
||||
SET(CMAKE_FIND_ROOT_PATH ${LLVM_PREFIX}/generic-w64-mingw32 ${LLVM_PREFIX}/i686-w64-mingw32/bin ${PROJECT_SOURCE_DIR}/dependencies-vs)
|
||||
SET(CMAKE_FIND_ROOT_PATH ${LLVM_PREFIX}/generic-w64-mingw32 ${LLVM_PREFIX}/${LLVM_ARCH}-w64-mingw32/bin ${PROJECT_SOURCE_DIR}/dependencies-win-${LLVM_ARCH})
|
||||
|
||||
# adjust the default behaviour of the FIND_XXX() commands:
|
||||
# search headers and libraries in the target environment, search
|
||||
|
@ -103,7 +103,7 @@ set(ANGELSCRIPT_SOURCE
|
||||
../../source/as_variablescope.cpp
|
||||
)
|
||||
|
||||
if(MSVC AND CMAKE_CL_64)
|
||||
if(MSVC AND CMAKE_CL_64 AND NOT ${CMAKE_GENERATOR_PLATFORM} MATCHES "(ARM64)")
|
||||
enable_language(ASM_MASM)
|
||||
if(CMAKE_ASM_MASM_COMPILER_WORKS)
|
||||
set(ANGELSCRIPT_SOURCE ${ANGELSCRIPT_SOURCE} ../../source/as_callfunc_x64_msvc_asm.asm)
|
||||
@ -134,7 +134,7 @@ endif()
|
||||
add_definitions(-DANGELSCRIPT_EXPORT -D_LIB)
|
||||
|
||||
# Fix x64 issues on Linux
|
||||
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64" AND NOT APPLE)
|
||||
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64" AND NOT APPLE AND NOT WIN32)
|
||||
add_definitions(-fPIC)
|
||||
endif()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user