Changed cross-compiled build behavior.

Removed the host compilation of glslangValidator when cross compiling as this had the potential to fail quite easily. This also required a dependency of host toolsets for cross compiled builds which wasn't desirable. For cross-compiled builds we now download the matching glslang binary release package (https://github.com/KhronosGroup/glslang/releases/download/) for the host platform and extract it into the correct place (SDK/bin). Only do this if a glslangValidator binary isn't already in the host bin directory meaning the step will only happen if a cross compiled build is the first build of the SDK on a particular host platform. Removed duplicated code for downloading external projects using a common function defined in cmake/Functions.cmake.
parent 095e0bf3
cmake_minimum_required(VERSION 3.3)
include(ExternalProject)
project(external_VulkanMemoryAllocator-download NONE)
# Setup the ExternalProject_Add call for VulkanMemoryAllocator
ExternalProject_Add(external_VulkanMemoryAllocator
PREFIX ${VulkanMemoryAllocator_PREFIX}
SOURCE_DIR ${VulkanMemoryAllocator_SRC_DIR}
UPDATE_COMMAND ""
URL ${VulkanMemoryAllocator_URL}
DOWNLOAD_DIR ${VulkanMemoryAllocator_DOWNLOAD_DIR}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
cmake_minimum_required(VERSION 3.3)
include(ExternalProject)
project(${external_project_name}-download NONE)
# Setup the ExternalProject_Add call
ExternalProject_Add(external_${external_project_name}
PREFIX ${external_project_cmake_files_dir}
SOURCE_DIR ${external_project_src_dir}
UPDATE_COMMAND ""
URL ${external_project_url}
DOWNLOAD_DIR ${external_project_download_dir}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
BUILD_BYPRODUCTS ${external_project_byproducts}
)
\ No newline at end of file
cmake_minimum_required(VERSION 3.3)
include(../../cmake/Common.cmake)
# Set current VulkanMemoryAllocator version
set(external_VulkanMemoryAllocator_VERSION "v2.2.0" CACHE INTERNAL "")
# Set VulkanMemoryAllocator prefix location
set(VulkanMemoryAllocator_PREFIX ${EXTERNAL_CMAKE_FILES_FOLDER}/external_VulkanMemoryAllocator CACHE INTERNAL "")
# Set the VulkanMemoryAllocator source directory
set(VulkanMemoryAllocator_SRC_DIR ${SDK_ROOT}/external/VulkanMemoryAllocator/src CACHE INTERNAL "")
# Set VulkanMemoryAllocator download directory - we use a downloads directory to allow us to maintain cleanliness
set(VulkanMemoryAllocator_DOWNLOAD_DIR ${SDK_ROOT}/external/downloads/VulkanMemoryAllocator_downloads CACHE INTERNAL "")
get_directory_property(HAS_PARENT PARENT_DIRECTORY)
if(NOT HAS_PARENT OR NOT USE_PREBUILT_DEPENDENCIES)
# Don't download if it is already present - this handles cases where internet connectivity may be limited but all packages are already available
if(EXISTS ${VulkanMemoryAllocator_DOWNLOAD_DIR}/${external_VulkanMemoryAllocator_VERSION}.tar.gz AND EXISTS ${VulkanMemoryAllocator_SRC_DIR}/src/vk_mem_alloc.h)
set(VulkanMemoryAllocator_URL "" CACHE INTERNAL "")
message("VulkanMemoryAllocator was found so will not be downloaded: ${VulkanMemoryAllocator_SRC_DIR}")
else()
set(VulkanMemoryAllocator_URL "https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/archive/${external_VulkanMemoryAllocator_VERSION}.tar.gz")
# Remove the existing VulkanMemoryAllocator downloads so that only the newest version of VulkanMemoryAllocator will be present
file(REMOVE_RECURSE ${VulkanMemoryAllocator_DOWNLOAD_DIR})
endif()
# VulkanMemoryAllocator
# See here for details: https://crascit.com/2015/07/25/cmake-gtest/
configure_file(external.cmake ${VulkanMemoryAllocator_PREFIX}/CMakeLists.txt)
execute_process(COMMAND "${CMAKE_COMMAND}" . WORKING_DIRECTORY "${VulkanMemoryAllocator_PREFIX}")
execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${VulkanMemoryAllocator_PREFIX}")
endif()
add_library(VulkanMemoryAllocator INTERFACE IMPORTED GLOBAL)
set_target_properties(VulkanMemoryAllocator PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${VulkanMemoryAllocator_SRC_DIR}/src)
cmake_minimum_required(VERSION 3.3)
include(../../cmake/Common.cmake)
# Set current VulkanMemoryAllocator version
set(external_VulkanMemoryAllocator_VERSION "v2.2.0" CACHE INTERNAL "")
# Set VulkanMemoryAllocator prefix location
set(VulkanMemoryAllocator_PREFIX ${EXTERNAL_CMAKE_FILES_FOLDER}/external_VulkanMemoryAllocator CACHE INTERNAL "")
# Set the VulkanMemoryAllocator source directory
set(VulkanMemoryAllocator_SRC_DIR ${SDK_ROOT}/external/VulkanMemoryAllocator/src CACHE INTERNAL "")
# Set VulkanMemoryAllocator download directory - we use a downloads directory to allow us to maintain cleanliness
set(VulkanMemoryAllocator_DOWNLOAD_DIR ${SDK_ROOT}/external/downloads/VulkanMemoryAllocator_downloads CACHE INTERNAL "")
get_directory_property(HAS_PARENT PARENT_DIRECTORY)
if(NOT HAS_PARENT OR NOT USE_PREBUILT_DEPENDENCIES)
# Don't download if it is already present - this handles cases where internet connectivity may be limited but all packages are already available
if(EXISTS ${VulkanMemoryAllocator_DOWNLOAD_DIR}/${external_VulkanMemoryAllocator_VERSION}.tar.gz AND EXISTS ${VulkanMemoryAllocator_SRC_DIR}/src/vk_mem_alloc.h)
set(VulkanMemoryAllocator_URL "" CACHE INTERNAL "")
message("VulkanMemoryAllocator was found so will not be downloaded: ${VulkanMemoryAllocator_SRC_DIR}")
else()
set(VulkanMemoryAllocator_URL "https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/archive/${external_VulkanMemoryAllocator_VERSION}.tar.gz")
# Remove the existing VulkanMemoryAllocator downloads so that only the newest version of VulkanMemoryAllocator will be present
file(REMOVE_RECURSE ${VulkanMemoryAllocator_DOWNLOAD_DIR})
message("VulkanMemoryAllocator was not found so will be downloaded: ${VulkanMemoryAllocator_URL}")
endif()
download_external_project("VulkanMemoryAllocator" "${VulkanMemoryAllocator_PREFIX}" "${VulkanMemoryAllocator_SRC_DIR}" "${VulkanMemoryAllocator_DOWNLOAD_DIR}" "${VulkanMemoryAllocator_URL}" "")
endif()
add_library(VulkanMemoryAllocator INTERFACE IMPORTED GLOBAL)
set_target_properties(VulkanMemoryAllocator PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${VulkanMemoryAllocator_SRC_DIR}/src)
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
externalNativeBuild {
cmake {
cppFlags "-fexceptions"
arguments "-DANDROID_STL=c++_static"
targets "glslang", "SPIRV", "OGLCompiler", "OSDependent"
}
}
ndk
{
abiFilters "$ANDROID_ABI".replace(" ", "").split(",")
}
}
externalNativeBuild {
cmake {
path "../CMakeLists.txt"
}
}
}
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
externalNativeBuild {
cmake {
cppFlags "-fexceptions"
arguments "-DANDROID_STL=c++_static"
targets "glslang", "SPIRV", "OGLCompiler", "OSDependent"
}
}
ndk
{
abiFilters "$ANDROID_ABI".replace(" ", "").split(",")
}
}
externalNativeBuild {
cmake {
path "../CMakeLists.txt"
}
}
}
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
\ No newline at end of file
cmake_minimum_required(VERSION 3.3)
include(ExternalProject)
project(external_glslang-download NONE)
# Setup the ExternalProject_Add call for glslang
ExternalProject_Add(external_glslang
PREFIX ${glslang_PREFIX}
SOURCE_DIR ${glslang_SRC_DIR}
UPDATE_COMMAND ""
URL ${glslang_URL}
DOWNLOAD_DIR ${glslang_DOWNLOAD_DIR}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
\ No newline at end of file
cmake_minimum_required(VERSION 3.3)
include(ExternalProject)
# Setup the ExternalProject_Add call for glslangValidator
ExternalProject_Add(external_glslangValidator
PREFIX ${glslangValidator_PREFIX}
SOURCE_DIR ${glslang_SRC_DIR}
UPDATE_COMMAND ""
URL ""
DOWNLOAD_DIR ""
TEST_COMMAND ""
BUILD_BYPRODUCTS
${glslangValidator_RELEASE_EXECUTABLE}
CONFIGURE_COMMAND
"${CMAKE_COMMAND}"
"-H${glslang_SRC_DIR}"
"-B${glslangValidator_PREFIX}"
"-DCMAKE_INSTALL_PREFIX=${EXTERNAL_RELEASE_BIN_FOLDER}"
"-DCMAKE_BUILD_TYPE=Release"
"-DBUILD_TESTING=OFF"
"-DENABLE_HLSL=OFF"
"-DENABLE_OPT=OFF"
"-DENABLE_AMD_EXTENSIONS=OFF"
"-DENABLE_NV_EXTENSIONS=OFF"
"-DENABLE_GLSLANG_BINARIES=ON"
BUILD_COMMAND
"${CMAKE_COMMAND}" --build ${glslangValidator_PREFIX} --config Release
INSTALL_COMMAND
"${CMAKE_COMMAND}" --build ${glslangValidator_PREFIX} --target install --config Release
cmake_minimum_required(VERSION 3.3)
include(ExternalProject)
project(external_glslangValidator-download NONE)
# Setup the ExternalProject_Add call for glslangValidator
ExternalProject_Add(external_glslangValidator
PREFIX ${glslangValidator_PREFIX}
SOURCE_DIR ${EXTERNAL_RELEASE_BIN_FOLDER}
UPDATE_COMMAND ""
URL ${glslangValidator_URL}
DOWNLOAD_DIR ${glslang_DOWNLOAD_DIR}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
\ No newline at end of file
cmake_minimum_required(VERSION 3.3)
include(../../cmake/Common.cmake)
# Set current pugixml version
set(external_pugixml_VERSION "v1.9" CACHE INTERNAL "")
# Set pugixml prefix location
set(pugixml_PREFIX ${EXTERNAL_CMAKE_FILES_FOLDER}/external_pugixml CACHE INTERNAL "")
# Set the pugixml source directory
set(pugixml_SRC_DIR ${SDK_ROOT}/external/pugixml/src CACHE INTERNAL "")
# Set pugixml download directory - we use a downloads directory to allow us to maintain cleanliness
set(pugixml_DOWNLOAD_DIR ${SDK_ROOT}/external/downloads/pugixml_downloads CACHE INTERNAL "")
get_directory_property(HAS_PARENT PARENT_DIRECTORY)
if(HAS_PARENT AND USE_PREBUILT_DEPENDENCIES)
add_library(pugixml STATIC IMPORTED GLOBAL)
set(pugixml_LIB ${EXTERNAL_LIB_CONFIG_FOLDER}/${CMAKE_STATIC_LIBRARY_PREFIX}pugixml${CMAKE_STATIC_LIBRARY_SUFFIX})
set_target_properties(pugixml PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${pugixml_SRC_DIR}/src"
IMPORTED_LOCATION ${pugixml_LIB})
else()
# Don't download if it is already present - this handles cases where internet connectivity may be limited but all packages are already available
if(EXISTS ${pugixml_DOWNLOAD_DIR}/${external_pugixml_VERSION}.tar.gz AND EXISTS ${pugixml_SRC_DIR}/CMakeLists.txt)
set(pugixml_URL "" CACHE INTERNAL "")
message("pugixml was found so will not be downloaded: ${pugixml_SRC_DIR}")
else()
set(pugixml_URL "https://github.com/zeux/pugixml/archive/${external_pugixml_VERSION}.tar.gz" CACHE INTERNAL "")
# Remove the existing pugixml downloads so that only the newest version of pugixml will be present
file(REMOVE_RECURSE ${pugixml_DOWNLOAD_DIR})
endif()
# pugixml
# See here for details: https://crascit.com/2015/07/25/cmake-gtest/
configure_file(external.cmake ${pugixml_PREFIX}/configure/CMakeLists.txt)
execute_process(COMMAND "${CMAKE_COMMAND}" . WORKING_DIRECTORY "${pugixml_PREFIX}/configure")
execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${pugixml_PREFIX}/configure")
add_subdirectory_if_not_already_included(pugixml "${pugixml_SRC_DIR}" "${pugixml_PREFIX}/build")
set_target_properties(pugixml PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${EXTERNAL_LIB_CONFIG_FOLDER}
LIBRARY_OUTPUT_DIRECTORY ${EXTERNAL_LIB_CONFIG_FOLDER})
endif()
cmake_minimum_required(VERSION 3.3)
include(../../cmake/Common.cmake)
# Set current pugixml version
set(external_pugixml_VERSION "v1.9" CACHE INTERNAL "")
# Set pugixml prefix location
set(pugixml_PREFIX ${EXTERNAL_CMAKE_FILES_FOLDER}/external_pugixml CACHE INTERNAL "")
# Set the pugixml source directory
set(pugixml_SRC_DIR ${SDK_ROOT}/external/pugixml/src CACHE INTERNAL "")
# Set pugixml download directory - we use a downloads directory to allow us to maintain cleanliness
set(pugixml_DOWNLOAD_DIR ${SDK_ROOT}/external/downloads/pugixml_downloads CACHE INTERNAL "")
get_directory_property(HAS_PARENT PARENT_DIRECTORY)
if(HAS_PARENT AND USE_PREBUILT_DEPENDENCIES)
add_library(pugixml STATIC IMPORTED GLOBAL)
set(pugixml_LIB ${EXTERNAL_LIB_CONFIG_FOLDER}/${CMAKE_STATIC_LIBRARY_PREFIX}pugixml${CMAKE_STATIC_LIBRARY_SUFFIX})
set_target_properties(pugixml PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${pugixml_SRC_DIR}/src"
IMPORTED_LOCATION ${pugixml_LIB})
else()
# Don't download if it is already present - this handles cases where internet connectivity may be limited but all packages are already available
if(EXISTS ${pugixml_DOWNLOAD_DIR}/${external_pugixml_VERSION}.tar.gz AND EXISTS ${pugixml_SRC_DIR}/CMakeLists.txt)
set(pugixml_URL "" CACHE INTERNAL "")
message("pugixml was found so will not be downloaded: ${pugixml_SRC_DIR}")
else()
set(pugixml_URL "https://github.com/zeux/pugixml/archive/${external_pugixml_VERSION}.tar.gz" CACHE INTERNAL "")
# Remove the existing pugixml downloads so that only the newest version of pugixml will be present
file(REMOVE_RECURSE ${pugixml_DOWNLOAD_DIR})
message("pugixml was not found so will be downloaded: ${pugixml_URL}")
endif()
download_external_project("pugixml" "${pugixml_PREFIX}" "${pugixml_SRC_DIR}" "${pugixml_DOWNLOAD_DIR}" "${pugixml_URL}" "")
if(EXISTS ${pugixml_SRC_DIR}/tests/)
# Remove the tests/ folder from pugixml. The use of filenames with unicode characters cause issues in various places. As we are not currently using pugixml tests we'll remove the tests/ directory.
file(REMOVE_RECURSE ${pugixml_SRC_DIR}/tests/)
endif()
add_subdirectory_if_not_already_included(pugixml "${pugixml_SRC_DIR}" "${pugixml_PREFIX}/build")
set_target_properties(pugixml PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${EXTERNAL_LIB_CONFIG_FOLDER}
LIBRARY_OUTPUT_DIRECTORY ${EXTERNAL_LIB_CONFIG_FOLDER})
endif()
cmake_minimum_required(VERSION 3.3)
include(ExternalProject)
project(external_pugixml-download NONE)
# Setup the ExternalProject_Add call for pugixml
ExternalProject_Add(external_pugixml
PREFIX ${pugixml_PREFIX}
SOURCE_DIR ${pugixml_SRC_DIR}
UPDATE_COMMAND ""
URL ${pugixml_URL}
DOWNLOAD_DIR ${pugixml_DOWNLOAD_DIR}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment