Init
This commit is contained in:
18
externals/cmakemodules/ConfigureFileMT.cmake
vendored
Normal file
18
externals/cmakemodules/ConfigureFileMT.cmake
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
# A simple wrapper around configure_file to try to make it multi-thread safe with a file lock.
|
||||
FUNCTION(Configure_File_MT IN_TEMPLATE OUTPUT_FILENAME)
|
||||
|
||||
FILE(LOCK ${OUTPUT_FILENAME}.lock
|
||||
GUARD FUNCTION
|
||||
RESULT_VARIABLE LOCK_RESULT
|
||||
TIMEOUT 30)
|
||||
|
||||
IF (NOT LOCK_RESULT EQUAL 0)
|
||||
MESSAGE(WARNING "Failed to lock file ${OUTPUT_FILENAME} for output ERROR: ${LOCK_RESULT}")
|
||||
return()
|
||||
ENDIF()
|
||||
|
||||
CONFIGURE_FILE("${IN_TEMPLATE}" "${OUTPUT_FILENAME}" @ONLY)
|
||||
|
||||
FILE(LOCK ${OUTPUT_FILENAME}.lock RELEASE)
|
||||
|
||||
ENDFUNCTION()
|
||||
1918
externals/cmakemodules/FindCUDA.cmake
vendored
Normal file
1918
externals/cmakemodules/FindCUDA.cmake
vendored
Normal file
File diff suppressed because it is too large
Load Diff
106
externals/cmakemodules/FindCUDA/make2cmake.cmake
vendored
Normal file
106
externals/cmakemodules/FindCUDA/make2cmake.cmake
vendored
Normal file
@ -0,0 +1,106 @@
|
||||
# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
|
||||
# Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html
|
||||
#
|
||||
# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
|
||||
#
|
||||
# Copyright (c) 2007-2009
|
||||
# Scientific Computing and Imaging Institute, University of Utah
|
||||
#
|
||||
# This code is licensed under the MIT License. See the FindCUDA.cmake script
|
||||
# for the text of the license.
|
||||
|
||||
# The MIT License
|
||||
#
|
||||
# License for the specific language governing rights and limitations under
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
# to deal in the Software without restriction, including without limitation
|
||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
# and/or sell copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included
|
||||
# in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
# DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
#######################################################################
|
||||
# This converts a file written in makefile syntax into one that can be included
|
||||
# by CMake.
|
||||
|
||||
# Input variables
|
||||
#
|
||||
# verbose:BOOL=<> OFF: Be as quiet as possible (default)
|
||||
# ON : Extra output
|
||||
#
|
||||
# input_file:FILEPATH=<> Path to dependecy file in makefile format
|
||||
#
|
||||
# output_file:FILEPATH=<> Path to file with dependencies in CMake readable variable
|
||||
#
|
||||
|
||||
file(READ ${input_file} depend_text)
|
||||
|
||||
if (NOT "${depend_text}" STREQUAL "")
|
||||
|
||||
# message("FOUND DEPENDS")
|
||||
|
||||
string(REPLACE "\\ " " " depend_text ${depend_text})
|
||||
|
||||
# This works for the nvcc -M generated dependency files.
|
||||
string(REGEX REPLACE "^.* : " "" depend_text ${depend_text})
|
||||
string(REGEX REPLACE "[ \\\\]*\n" ";" depend_text ${depend_text})
|
||||
|
||||
set(dependency_list "")
|
||||
|
||||
foreach(file ${depend_text})
|
||||
|
||||
string(REGEX REPLACE "^ +" "" file ${file})
|
||||
|
||||
# OK, now if we had a UNC path, nvcc has a tendency to only output the first '/'
|
||||
# instead of '//'. Here we will test to see if the file exists, if it doesn't then
|
||||
# try to prepend another '/' to the path and test again. If it still fails remove the
|
||||
# path.
|
||||
|
||||
if(NOT EXISTS "${file}")
|
||||
if (EXISTS "/${file}")
|
||||
set(file "/${file}")
|
||||
else()
|
||||
if(verbose)
|
||||
message(WARNING " Removing non-existent dependency file: ${file}")
|
||||
endif()
|
||||
set(file "")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Make sure we check to see if we have a file, before asking if it is not a directory.
|
||||
# if(NOT IS_DIRECTORY "") will return TRUE.
|
||||
if(file AND NOT IS_DIRECTORY "${file}")
|
||||
# If softlinks start to matter, we should change this to REALPATH. For now we need
|
||||
# to flatten paths, because nvcc can generate stuff like /bin/../include instead of
|
||||
# just /include.
|
||||
get_filename_component(file_absolute "${file}" ABSOLUTE)
|
||||
list(APPEND dependency_list "${file_absolute}")
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
|
||||
else()
|
||||
# message("FOUND NO DEPENDS")
|
||||
endif()
|
||||
|
||||
# Remove the duplicate entries and sort them.
|
||||
list(REMOVE_DUPLICATES dependency_list)
|
||||
list(SORT dependency_list)
|
||||
|
||||
foreach(file ${dependency_list})
|
||||
string(APPEND cuda_nvcc_depend " \"${file}\"\n")
|
||||
endforeach()
|
||||
|
||||
file(WRITE ${output_file} "# Generated by: make2cmake.cmake\nSET(CUDA_NVCC_DEPEND\n ${cuda_nvcc_depend})\n\n")
|
||||
111
externals/cmakemodules/FindCUDA/parse_cubin.cmake
vendored
Normal file
111
externals/cmakemodules/FindCUDA/parse_cubin.cmake
vendored
Normal file
@ -0,0 +1,111 @@
|
||||
# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
|
||||
# Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html
|
||||
#
|
||||
# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
|
||||
#
|
||||
# Copyright (c) 2007-2009
|
||||
# Scientific Computing and Imaging Institute, University of Utah
|
||||
#
|
||||
# This code is licensed under the MIT License. See the FindCUDA.cmake script
|
||||
# for the text of the license.
|
||||
|
||||
# The MIT License
|
||||
#
|
||||
# License for the specific language governing rights and limitations under
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
# to deal in the Software without restriction, including without limitation
|
||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
# and/or sell copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included
|
||||
# in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
# DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
#######################################################################
|
||||
# Parses a .cubin file produced by nvcc and reports statistics about the file.
|
||||
|
||||
|
||||
file(READ ${input_file} file_text)
|
||||
|
||||
if (NOT "${file_text}" STREQUAL "")
|
||||
|
||||
string(REPLACE ";" "\\;" file_text ${file_text})
|
||||
string(REPLACE "\ncode" ";code" file_text ${file_text})
|
||||
|
||||
list(LENGTH file_text len)
|
||||
|
||||
foreach(line ${file_text})
|
||||
|
||||
# Only look at "code { }" blocks.
|
||||
if(line MATCHES "^code")
|
||||
|
||||
# Break into individual lines.
|
||||
string(REGEX REPLACE "\n" ";" line ${line})
|
||||
|
||||
foreach(entry ${line})
|
||||
|
||||
# Extract kernel names.
|
||||
if (${entry} MATCHES "[^g]name = ([^ ]+)")
|
||||
set(entry "${CMAKE_MATCH_1}")
|
||||
|
||||
# Check to see if the kernel name starts with "_"
|
||||
set(skip FALSE)
|
||||
# if (${entry} MATCHES "^_")
|
||||
# Skip the rest of this block.
|
||||
# message("Skipping ${entry}")
|
||||
# set(skip TRUE)
|
||||
# else ()
|
||||
message("Kernel: ${entry}")
|
||||
# endif ()
|
||||
|
||||
endif()
|
||||
|
||||
# Skip the rest of the block if necessary
|
||||
if(NOT skip)
|
||||
|
||||
# Registers
|
||||
if (${entry} MATCHES "reg([ ]+)=([ ]+)([^ ]+)")
|
||||
set(entry "${CMAKE_MATCH_3}")
|
||||
message("Registers: ${entry}")
|
||||
endif()
|
||||
|
||||
# Local memory
|
||||
if (${entry} MATCHES "lmem([ ]+)=([ ]+)([^ ]+)")
|
||||
set(entry "${CMAKE_MATCH_3}")
|
||||
message("Local: ${entry}")
|
||||
endif()
|
||||
|
||||
# Shared memory
|
||||
if (${entry} MATCHES "smem([ ]+)=([ ]+)([^ ]+)")
|
||||
set(entry "${CMAKE_MATCH_3}")
|
||||
message("Shared: ${entry}")
|
||||
endif()
|
||||
|
||||
if (${entry} MATCHES "^}")
|
||||
message("")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
endforeach()
|
||||
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
|
||||
else()
|
||||
# message("FOUND NO DEPENDS")
|
||||
endif()
|
||||
|
||||
|
||||
306
externals/cmakemodules/FindCUDA/run_nvcc.cmake
vendored
Normal file
306
externals/cmakemodules/FindCUDA/run_nvcc.cmake
vendored
Normal file
@ -0,0 +1,306 @@
|
||||
# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
|
||||
#
|
||||
# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
|
||||
#
|
||||
# This code is licensed under the MIT License. See the FindCUDA.cmake script
|
||||
# for the text of the license.
|
||||
|
||||
# The MIT License
|
||||
#
|
||||
# License for the specific language governing rights and limitations under
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
# to deal in the Software without restriction, including without limitation
|
||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
# and/or sell copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included
|
||||
# in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
# DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
##########################################################################
|
||||
# This file runs the nvcc commands to produce the desired output file along with
|
||||
# the dependency file needed by CMake to compute dependencies. In addition the
|
||||
# file checks the output of each command and if the command fails it deletes the
|
||||
# output files.
|
||||
|
||||
# Input variables
|
||||
#
|
||||
# verbose:BOOL=<> OFF: Be as quiet as possible (default)
|
||||
# ON : Describe each step
|
||||
#
|
||||
# build_configuration:STRING=<> Typically one of Debug, MinSizeRel, Release, or
|
||||
# RelWithDebInfo, but it should match one of the
|
||||
# entries in CUDA_HOST_FLAGS. This is the build
|
||||
# configuration used when compiling the code. If
|
||||
# blank or unspecified Debug is assumed as this is
|
||||
# what CMake does.
|
||||
#
|
||||
# generated_file:STRING=<> File to generate. This argument must be passed in.
|
||||
#
|
||||
# generated_cubin_file:STRING=<> File to generate. This argument must be passed
|
||||
# in if build_cubin is true.
|
||||
|
||||
if(NOT generated_file)
|
||||
message(FATAL_ERROR "You must specify generated_file on the command line")
|
||||
endif()
|
||||
|
||||
# Set these up as variables to make reading the generated file easier
|
||||
set(CMAKE_COMMAND "@CMAKE_COMMAND@") # path
|
||||
set(source_file "@source_file@") # path
|
||||
set(NVCC_generated_dependency_file "@NVCC_generated_dependency_file@") # path
|
||||
set(cmake_dependency_file "@cmake_dependency_file@") # path
|
||||
set(CUDA_make2cmake "@CUDA_make2cmake@") # path
|
||||
set(CUDA_parse_cubin "@CUDA_parse_cubin@") # path
|
||||
set(build_cubin @build_cubin@) # bool
|
||||
set(CUDA_HOST_COMPILER "@CUDA_HOST_COMPILER@") # path
|
||||
# We won't actually use these variables for now, but we need to set this, in
|
||||
# order to force this file to be run again if it changes.
|
||||
set(generated_file_path "@generated_file_path@") # path
|
||||
set(generated_file_internal "@generated_file@") # path
|
||||
set(generated_cubin_file_internal "@generated_cubin_file@") # path
|
||||
|
||||
set(CUDA_NVCC_EXECUTABLE "@CUDA_NVCC_EXECUTABLE@") # path
|
||||
set(CUDA_NVCC_FLAGS @CUDA_NVCC_FLAGS@ ;; @CUDA_WRAP_OPTION_NVCC_FLAGS@) # list
|
||||
@CUDA_NVCC_FLAGS_CONFIG@
|
||||
set(nvcc_flags @nvcc_flags@) # list
|
||||
set(CUDA_NVCC_INCLUDE_DIRS "@CUDA_NVCC_INCLUDE_DIRS@") # list (needs to be in quotes to handle spaces properly).
|
||||
set(CUDA_NVCC_COMPILE_DEFINITIONS "@CUDA_NVCC_COMPILE_DEFINITIONS@") # list (needs to be in quotes to handle spaces properly).
|
||||
set(format_flag "@format_flag@") # string
|
||||
set(cuda_language_flag @cuda_language_flag@) # list
|
||||
|
||||
# Clean up list of include directories and add -I flags
|
||||
list(REMOVE_DUPLICATES CUDA_NVCC_INCLUDE_DIRS)
|
||||
set(CUDA_NVCC_INCLUDE_ARGS)
|
||||
foreach(dir ${CUDA_NVCC_INCLUDE_DIRS})
|
||||
# Extra quotes are added around each flag to help nvcc parse out flags with spaces.
|
||||
list(APPEND CUDA_NVCC_INCLUDE_ARGS "-I${dir}")
|
||||
endforeach()
|
||||
|
||||
# Clean up list of compile definitions, add -D flags, and append to nvcc_flags
|
||||
list(REMOVE_DUPLICATES CUDA_NVCC_COMPILE_DEFINITIONS)
|
||||
foreach(def ${CUDA_NVCC_COMPILE_DEFINITIONS})
|
||||
list(APPEND nvcc_flags "-D${def}")
|
||||
endforeach()
|
||||
|
||||
if(build_cubin AND NOT generated_cubin_file)
|
||||
message(FATAL_ERROR "You must specify generated_cubin_file on the command line")
|
||||
endif()
|
||||
|
||||
# This is the list of host compilation flags. It C or CXX should already have
|
||||
# been chosen by FindCUDA.cmake.
|
||||
@CUDA_HOST_FLAGS@
|
||||
|
||||
# Take the compiler flags and package them up to be sent to the compiler via -Xcompiler
|
||||
set(nvcc_host_compiler_flags "")
|
||||
# If we weren't given a build_configuration, use Debug.
|
||||
if(NOT build_configuration)
|
||||
set(build_configuration Debug)
|
||||
endif()
|
||||
string(TOUPPER "${build_configuration}" build_configuration)
|
||||
#message("CUDA_NVCC_HOST_COMPILER_FLAGS = ${CUDA_NVCC_HOST_COMPILER_FLAGS}")
|
||||
foreach(flag ${CMAKE_HOST_FLAGS} ${CMAKE_HOST_FLAGS_${build_configuration}})
|
||||
# Extra quotes are added around each flag to help nvcc parse out flags with spaces.
|
||||
string(APPEND nvcc_host_compiler_flags ",\"${flag}\"")
|
||||
endforeach()
|
||||
if (nvcc_host_compiler_flags)
|
||||
set(nvcc_host_compiler_flags "-Xcompiler" ${nvcc_host_compiler_flags})
|
||||
endif()
|
||||
#message("nvcc_host_compiler_flags = \"${nvcc_host_compiler_flags}\"")
|
||||
# Add the build specific configuration flags
|
||||
list(APPEND CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS_${build_configuration}})
|
||||
|
||||
# Any -ccbin existing in CUDA_NVCC_FLAGS gets highest priority
|
||||
list( FIND CUDA_NVCC_FLAGS "-ccbin" ccbin_found0 )
|
||||
list( FIND CUDA_NVCC_FLAGS "--compiler-bindir" ccbin_found1 )
|
||||
if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER )
|
||||
if (CUDA_HOST_COMPILER STREQUAL "$(VCInstallDir)bin" AND DEFINED CCBIN)
|
||||
set(CCBIN -ccbin "${CCBIN}")
|
||||
else()
|
||||
set(CCBIN -ccbin "${CUDA_HOST_COMPILER}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# cuda_execute_process - Executes a command with optional command echo and status message.
|
||||
#
|
||||
# status - Status message to print if verbose is true
|
||||
# command - COMMAND argument from the usual execute_process argument structure
|
||||
# ARGN - Remaining arguments are the command with arguments
|
||||
#
|
||||
# CUDA_result - return value from running the command
|
||||
#
|
||||
# Make this a macro instead of a function, so that things like RESULT_VARIABLE
|
||||
# and other return variables are present after executing the process.
|
||||
macro(cuda_execute_process status command)
|
||||
set(_command ${command})
|
||||
if(NOT "x${_command}" STREQUAL "xCOMMAND")
|
||||
message(FATAL_ERROR "Malformed call to cuda_execute_process. Missing COMMAND as second argument. (command = ${command})")
|
||||
endif()
|
||||
if(verbose)
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}" -E echo -- ${status})
|
||||
# Now we need to build up our command string. We are accounting for quotes
|
||||
# and spaces, anything else is left up to the user to fix if they want to
|
||||
# copy and paste a runnable command line.
|
||||
set(cuda_execute_process_string)
|
||||
foreach(arg ${ARGN})
|
||||
# If there are quotes, excape them, so they come through.
|
||||
string(REPLACE "\"" "\\\"" arg ${arg})
|
||||
# Args with spaces need quotes around them to get them to be parsed as a single argument.
|
||||
if(arg MATCHES " ")
|
||||
list(APPEND cuda_execute_process_string "\"${arg}\"")
|
||||
else()
|
||||
list(APPEND cuda_execute_process_string ${arg})
|
||||
endif()
|
||||
endforeach()
|
||||
# Echo the command
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E echo ${cuda_execute_process_string})
|
||||
endif()
|
||||
# Run the command
|
||||
execute_process(COMMAND ${ARGN} RESULT_VARIABLE CUDA_result )
|
||||
endmacro()
|
||||
|
||||
# Delete the target file
|
||||
cuda_execute_process(
|
||||
"Removing ${generated_file}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E remove "${generated_file}"
|
||||
)
|
||||
|
||||
# For CUDA 2.3 and below, -G -M doesn't work, so remove the -G flag
|
||||
# for dependency generation and hope for the best.
|
||||
set(depends_CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}")
|
||||
set(CUDA_VERSION @CUDA_VERSION@)
|
||||
if(CUDA_VERSION VERSION_LESS "3.0")
|
||||
cmake_policy(PUSH)
|
||||
# CMake policy 0007 NEW states that empty list elements are not
|
||||
# ignored. I'm just setting it to avoid the warning that's printed.
|
||||
cmake_policy(SET CMP0007 NEW)
|
||||
# Note that this will remove all occurances of -G.
|
||||
list(REMOVE_ITEM depends_CUDA_NVCC_FLAGS "-G")
|
||||
cmake_policy(POP)
|
||||
endif()
|
||||
|
||||
# nvcc doesn't define __CUDACC__ for some reason when generating dependency files. This
|
||||
# can cause incorrect dependencies when #including files based on this macro which is
|
||||
# defined in the generating passes of nvcc invokation. We will go ahead and manually
|
||||
# define this for now until a future version fixes this bug.
|
||||
set(CUDACC_DEFINE -D__CUDACC__)
|
||||
|
||||
# Generate the dependency file
|
||||
cuda_execute_process(
|
||||
"Generating dependency file: ${NVCC_generated_dependency_file}"
|
||||
COMMAND "${CUDA_NVCC_EXECUTABLE}"
|
||||
-M
|
||||
${CUDACC_DEFINE}
|
||||
"${source_file}"
|
||||
-o "${NVCC_generated_dependency_file}"
|
||||
${CCBIN}
|
||||
${nvcc_flags}
|
||||
${nvcc_host_compiler_flags}
|
||||
${depends_CUDA_NVCC_FLAGS}
|
||||
-DNVCC
|
||||
${CUDA_NVCC_INCLUDE_ARGS}
|
||||
)
|
||||
|
||||
if(CUDA_result)
|
||||
message(FATAL_ERROR "Error generating ${generated_file}")
|
||||
endif()
|
||||
|
||||
# Generate the cmake readable dependency file to a temp file. Don't put the
|
||||
# quotes just around the filenames for the input_file and output_file variables.
|
||||
# CMake will pass the quotes through and not be able to find the file.
|
||||
cuda_execute_process(
|
||||
"Generating temporary cmake readable file: ${cmake_dependency_file}.tmp"
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
-D "input_file:FILEPATH=${NVCC_generated_dependency_file}"
|
||||
-D "output_file:FILEPATH=${cmake_dependency_file}.tmp"
|
||||
-D "verbose=${verbose}"
|
||||
-P "${CUDA_make2cmake}"
|
||||
)
|
||||
|
||||
if(CUDA_result)
|
||||
message(FATAL_ERROR "Error generating ${generated_file}")
|
||||
endif()
|
||||
|
||||
# Copy the file if it is different
|
||||
cuda_execute_process(
|
||||
"Copy if different ${cmake_dependency_file}.tmp to ${cmake_dependency_file}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${cmake_dependency_file}.tmp" "${cmake_dependency_file}"
|
||||
)
|
||||
|
||||
if(CUDA_result)
|
||||
message(FATAL_ERROR "Error generating ${generated_file}")
|
||||
endif()
|
||||
|
||||
# Delete the temporary file
|
||||
cuda_execute_process(
|
||||
"Removing ${cmake_dependency_file}.tmp and ${NVCC_generated_dependency_file}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E remove "${cmake_dependency_file}.tmp" "${NVCC_generated_dependency_file}"
|
||||
)
|
||||
|
||||
if(CUDA_result)
|
||||
message(FATAL_ERROR "Error generating ${generated_file}")
|
||||
endif()
|
||||
|
||||
# Generate the code
|
||||
cuda_execute_process(
|
||||
"Generating ${generated_file}"
|
||||
COMMAND "${CUDA_NVCC_EXECUTABLE}"
|
||||
"${source_file}"
|
||||
${cuda_language_flag}
|
||||
${format_flag} -o "${generated_file}"
|
||||
${CCBIN}
|
||||
${nvcc_flags}
|
||||
${nvcc_host_compiler_flags}
|
||||
${CUDA_NVCC_FLAGS}
|
||||
-DNVCC
|
||||
${CUDA_NVCC_INCLUDE_ARGS}
|
||||
)
|
||||
|
||||
if(CUDA_result)
|
||||
# Since nvcc can sometimes leave half done files make sure that we delete the output file.
|
||||
cuda_execute_process(
|
||||
"Removing ${generated_file}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E remove "${generated_file}"
|
||||
)
|
||||
message(FATAL_ERROR "Error generating file ${generated_file}")
|
||||
else()
|
||||
if(verbose)
|
||||
message("Generated ${generated_file} successfully.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Cubin resource report commands.
|
||||
if( build_cubin )
|
||||
# Run with -cubin to produce resource usage report.
|
||||
cuda_execute_process(
|
||||
"Generating ${generated_cubin_file}"
|
||||
COMMAND "${CUDA_NVCC_EXECUTABLE}"
|
||||
"${source_file}"
|
||||
${CUDA_NVCC_FLAGS}
|
||||
${nvcc_flags}
|
||||
${CCBIN}
|
||||
${nvcc_host_compiler_flags}
|
||||
-DNVCC
|
||||
-cubin
|
||||
-o "${generated_cubin_file}"
|
||||
${CUDA_NVCC_INCLUDE_ARGS}
|
||||
)
|
||||
|
||||
# Execute the parser script.
|
||||
cuda_execute_process(
|
||||
"Executing the parser script"
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
-D "input_file:STRING=${generated_cubin_file}"
|
||||
-P "${CUDA_parse_cubin}"
|
||||
)
|
||||
|
||||
endif()
|
||||
195
externals/cmakemodules/FindCUDA/select_compute_arch.cmake
vendored
Normal file
195
externals/cmakemodules/FindCUDA/select_compute_arch.cmake
vendored
Normal file
@ -0,0 +1,195 @@
|
||||
# Synopsis:
|
||||
# CUDA_SELECT_NVCC_ARCH_FLAGS(out_variable [target_CUDA_architectures])
|
||||
# -- Selects GPU arch flags for nvcc based on target_CUDA_architectures
|
||||
# target_CUDA_architectures : Auto | Common | All | LIST(ARCH_AND_PTX ...)
|
||||
# - "Auto" detects local machine GPU compute arch at runtime.
|
||||
# - "Common" and "All" cover common and entire subsets of architectures
|
||||
# ARCH_AND_PTX : NAME | NUM.NUM | NUM.NUM(NUM.NUM) | NUM.NUM+PTX
|
||||
# NAME: Fermi Kepler Maxwell Kepler+Tegra Kepler+Tesla Maxwell+Tegra Pascal
|
||||
# NUM: Any number. Only those pairs are currently accepted by NVCC though:
|
||||
# 2.0 2.1 3.0 3.2 3.5 3.7 5.0 5.2 5.3 6.0 6.2
|
||||
# Returns LIST of flags to be added to CUDA_NVCC_FLAGS in ${out_variable}
|
||||
# Additionally, sets ${out_variable}_readable to the resulting numeric list
|
||||
# Example:
|
||||
# CUDA_SELECT_NVCC_ARCH_FLAGS(ARCH_FLAGS 3.0 3.5+PTX 5.2(5.0) Maxwell)
|
||||
# LIST(APPEND CUDA_NVCC_FLAGS ${ARCH_FLAGS})
|
||||
#
|
||||
# More info on CUDA architectures: https://en.wikipedia.org/wiki/CUDA
|
||||
#
|
||||
|
||||
# This list will be used for CUDA_ARCH_NAME = All option
|
||||
set(CUDA_KNOWN_GPU_ARCHITECTURES "Fermi" "Kepler" "Maxwell")
|
||||
|
||||
# This list will be used for CUDA_ARCH_NAME = Common option (enabled by default)
|
||||
set(CUDA_COMMON_GPU_ARCHITECTURES "3.0" "3.5" "5.0")
|
||||
|
||||
if (CUDA_VERSION VERSION_GREATER "6.5")
|
||||
list(APPEND CUDA_KNOWN_GPU_ARCHITECTURES "Kepler+Tegra" "Kepler+Tesla" "Maxwell+Tegra")
|
||||
list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "5.2")
|
||||
endif ()
|
||||
|
||||
if (CUDA_VERSION VERSION_GREATER "7.5")
|
||||
list(APPEND CUDA_KNOWN_GPU_ARCHITECTURES "Pascal")
|
||||
list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "6.0" "6.1" "6.1+PTX")
|
||||
else()
|
||||
list(APPEND CUDA_COMMON_GPU_ARCHITECTURES "5.2+PTX")
|
||||
endif ()
|
||||
|
||||
|
||||
|
||||
################################################################################################
|
||||
# A function for automatic detection of GPUs installed (if autodetection is enabled)
|
||||
# Usage:
|
||||
# CUDA_DETECT_INSTALLED_GPUS(OUT_VARIABLE)
|
||||
#
|
||||
function(CUDA_DETECT_INSTALLED_GPUS OUT_VARIABLE)
|
||||
if(NOT CUDA_GPU_DETECT_OUTPUT)
|
||||
set(cufile ${PROJECT_BINARY_DIR}/detect_cuda_archs.cu)
|
||||
|
||||
file(WRITE ${cufile} ""
|
||||
"#include <cstdio>\n"
|
||||
"int main()\n"
|
||||
"{\n"
|
||||
" int count = 0;\n"
|
||||
" if (cudaSuccess != cudaGetDeviceCount(&count)) return -1;\n"
|
||||
" if (count == 0) return -1;\n"
|
||||
" for (int device = 0; device < count; ++device)\n"
|
||||
" {\n"
|
||||
" cudaDeviceProp prop;\n"
|
||||
" if (cudaSuccess == cudaGetDeviceProperties(&prop, device))\n"
|
||||
" std::printf(\"%d.%d \", prop.major, prop.minor);\n"
|
||||
" }\n"
|
||||
" return 0;\n"
|
||||
"}\n")
|
||||
|
||||
execute_process(COMMAND "${CUDA_NVCC_EXECUTABLE}" "--run" "${cufile}"
|
||||
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/CMakeFiles/"
|
||||
RESULT_VARIABLE nvcc_res OUTPUT_VARIABLE nvcc_out
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if(nvcc_res EQUAL 0)
|
||||
string(REPLACE "2.1" "2.1(2.0)" nvcc_out "${nvcc_out}")
|
||||
set(CUDA_GPU_DETECT_OUTPUT ${nvcc_out} CACHE INTERNAL "Returned GPU architetures from detect_gpus tool" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT CUDA_GPU_DETECT_OUTPUT)
|
||||
message(STATUS "Automatic GPU detection failed. Building for common architectures.")
|
||||
set(${OUT_VARIABLE} ${CUDA_COMMON_GPU_ARCHITECTURES} PARENT_SCOPE)
|
||||
else()
|
||||
set(${OUT_VARIABLE} ${CUDA_GPU_DETECT_OUTPUT} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
################################################################################################
|
||||
# Function for selecting GPU arch flags for nvcc based on CUDA architectures from parameter list
|
||||
# Usage:
|
||||
# SELECT_NVCC_ARCH_FLAGS(out_variable [list of CUDA compute archs])
|
||||
function(CUDA_SELECT_NVCC_ARCH_FLAGS out_variable)
|
||||
set(CUDA_ARCH_LIST "${ARGN}")
|
||||
|
||||
if("X${CUDA_ARCH_LIST}" STREQUAL "X" )
|
||||
set(CUDA_ARCH_LIST "Auto")
|
||||
endif()
|
||||
|
||||
set(cuda_arch_bin)
|
||||
set(cuda_arch_ptx)
|
||||
|
||||
if("${CUDA_ARCH_LIST}" STREQUAL "All")
|
||||
set(CUDA_ARCH_LIST ${CUDA_KNOWN_GPU_ARCHITECTURES})
|
||||
elseif("${CUDA_ARCH_LIST}" STREQUAL "Common")
|
||||
set(CUDA_ARCH_LIST ${CUDA_COMMON_GPU_ARCHITECTURES})
|
||||
elseif("${CUDA_ARCH_LIST}" STREQUAL "Auto")
|
||||
CUDA_DETECT_INSTALLED_GPUS(CUDA_ARCH_LIST)
|
||||
message(STATUS "Autodetected CUDA architecture(s): ${CUDA_ARCH_LIST}")
|
||||
endif()
|
||||
|
||||
# Now process the list and look for names
|
||||
string(REGEX REPLACE "[ \t]+" ";" CUDA_ARCH_LIST "${CUDA_ARCH_LIST}")
|
||||
list(REMOVE_DUPLICATES CUDA_ARCH_LIST)
|
||||
foreach(arch_name ${CUDA_ARCH_LIST})
|
||||
set(arch_bin)
|
||||
set(add_ptx FALSE)
|
||||
# Check to see if we are compiling PTX
|
||||
if(arch_name MATCHES "(.*)\\+PTX$")
|
||||
set(add_ptx TRUE)
|
||||
set(arch_name ${CMAKE_MATCH_1})
|
||||
endif()
|
||||
if(arch_name MATCHES "^([0-9]\\.[0-9](\\([0-9]\\.[0-9]\\))?)$")
|
||||
set(arch_bin ${CMAKE_MATCH_1})
|
||||
set(arch_ptx ${arch_bin})
|
||||
else()
|
||||
# Look for it in our list of known architectures
|
||||
if(${arch_name} STREQUAL "Fermi")
|
||||
set(arch_bin 2.0 "2.1(2.0)")
|
||||
elseif(${arch_name} STREQUAL "Kepler+Tegra")
|
||||
set(arch_bin 3.2)
|
||||
elseif(${arch_name} STREQUAL "Kepler+Tesla")
|
||||
set(arch_bin 3.7)
|
||||
elseif(${arch_name} STREQUAL "Kepler")
|
||||
set(arch_bin 3.0 3.5)
|
||||
set(arch_ptx 3.5)
|
||||
elseif(${arch_name} STREQUAL "Maxwell+Tegra")
|
||||
set(arch_bin 5.3)
|
||||
elseif(${arch_name} STREQUAL "Maxwell")
|
||||
set(arch_bin 5.0 5.2)
|
||||
set(arch_ptx 5.2)
|
||||
elseif(${arch_name} STREQUAL "Pascal")
|
||||
set(arch_bin 6.0 6.1)
|
||||
set(arch_ptx 6.1)
|
||||
else()
|
||||
message(SEND_ERROR "Unknown CUDA Architecture Name ${arch_name} in CUDA_SELECT_NVCC_ARCH_FLAGS")
|
||||
endif()
|
||||
endif()
|
||||
if(NOT arch_bin)
|
||||
message(SEND_ERROR "arch_bin wasn't set for some reason")
|
||||
endif()
|
||||
list(APPEND cuda_arch_bin ${arch_bin})
|
||||
if(add_ptx)
|
||||
if (NOT arch_ptx)
|
||||
set(arch_ptx ${arch_bin})
|
||||
endif()
|
||||
list(APPEND cuda_arch_ptx ${arch_ptx})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# remove dots and convert to lists
|
||||
string(REGEX REPLACE "\\." "" cuda_arch_bin "${cuda_arch_bin}")
|
||||
string(REGEX REPLACE "\\." "" cuda_arch_ptx "${cuda_arch_ptx}")
|
||||
string(REGEX MATCHALL "[0-9()]+" cuda_arch_bin "${cuda_arch_bin}")
|
||||
string(REGEX MATCHALL "[0-9]+" cuda_arch_ptx "${cuda_arch_ptx}")
|
||||
|
||||
if(cuda_arch_bin)
|
||||
list(REMOVE_DUPLICATES cuda_arch_bin)
|
||||
endif()
|
||||
if(cuda_arch_ptx)
|
||||
list(REMOVE_DUPLICATES cuda_arch_ptx)
|
||||
endif()
|
||||
|
||||
set(nvcc_flags "")
|
||||
set(nvcc_archs_readable "")
|
||||
|
||||
# Tell NVCC to add binaries for the specified GPUs
|
||||
foreach(arch ${cuda_arch_bin})
|
||||
if(arch MATCHES "([0-9]+)\\(([0-9]+)\\)")
|
||||
# User explicitly specified ARCH for the concrete CODE
|
||||
list(APPEND nvcc_flags -gencode arch=compute_${CMAKE_MATCH_2},code=sm_${CMAKE_MATCH_1})
|
||||
list(APPEND nvcc_archs_readable sm_${CMAKE_MATCH_1})
|
||||
else()
|
||||
# User didn't explicitly specify ARCH for the concrete CODE, we assume ARCH=CODE
|
||||
list(APPEND nvcc_flags -gencode arch=compute_${arch},code=sm_${arch})
|
||||
list(APPEND nvcc_archs_readable sm_${arch})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Tell NVCC to add PTX intermediate code for the specified architectures
|
||||
foreach(arch ${cuda_arch_ptx})
|
||||
list(APPEND nvcc_flags -gencode arch=compute_${arch},code=compute_${arch})
|
||||
list(APPEND nvcc_archs_readable compute_${arch})
|
||||
endforeach()
|
||||
|
||||
string(REPLACE ";" " " nvcc_archs_readable "${nvcc_archs_readable}")
|
||||
set(${out_variable} ${nvcc_flags} PARENT_SCOPE)
|
||||
set(${out_variable}_readable ${nvcc_archs_readable} PARENT_SCOPE)
|
||||
endfunction()
|
||||
63
externals/cmakemodules/FindnvToolsExt.cmake
vendored
Normal file
63
externals/cmakemodules/FindnvToolsExt.cmake
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
# - Try to find nvToolsExt
|
||||
# Once done this will define
|
||||
# NVTOOLSEXT_FOUND - System has nvToolsExt
|
||||
# NVTOOLSEXT_INCLUDE_DIRS - The nvToolsExt include directories
|
||||
# NVTOOLSEXT_LIB - The lib needed to use nvToolsExt
|
||||
# NVTOOLSEXT_DLL - The dll needed to use nvToolsExt
|
||||
# NVTOOLSEXT_DEFINITIONS - Compiler switches required for using nvToolsExt
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
|
||||
#TODO: Proper version support
|
||||
FIND_PATH( NVTOOLSEXTSDK_PATH include/nvToolsExt.h
|
||||
# PATHS
|
||||
# ${GW_DEPS_ROOT}/nvToolsExt/${nvToolsExt_FIND_VERSION}
|
||||
# ${GW_DEPS_ROOT}/Externals/nvToolsExt/1
|
||||
# ${GW_DEPS_ROOT}/sw/physx/externals/nvToolsExt/1
|
||||
)
|
||||
|
||||
SET(NVTOOLSEXT_INCLUDE_DIRS
|
||||
${NVTOOLSEXTSDK_PATH}/include
|
||||
)
|
||||
|
||||
if (CMAKE_CL_64)
|
||||
SET(NVTOOLSEXT_ARCH_FOLDER "x64")
|
||||
SET(NVTOOLSEXT_ARCH_FILE "64")
|
||||
else()
|
||||
SET(NVTOOLSEXT_ARCH_FOLDER "Win32")
|
||||
SET(NVTOOLSEXT_ARCH_FILE "32")
|
||||
endif()
|
||||
|
||||
IF(TARGET_BUILD_PLATFORM STREQUAL "windows")
|
||||
# NOTE: Doesn't make sense for all platforms - ARM
|
||||
if (CMAKE_CL_64)
|
||||
SET(NVTOOLSEXT_ARCH_FOLDER "x64")
|
||||
SET(NVTOOLSEXT_ARCH_FILE "64")
|
||||
else()
|
||||
SET(NVTOOLSEXT_ARCH_FOLDER "Win32")
|
||||
SET(NVTOOLSEXT_ARCH_FILE "32")
|
||||
endif()
|
||||
|
||||
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
|
||||
|
||||
|
||||
FIND_LIBRARY( NVTOOLSEXT_LIB
|
||||
NAMES nvToolsExt${NVTOOLSEXT_ARCH_FILE}_1
|
||||
PATHS
|
||||
${NVTOOLSEXTSDK_PATH}/lib/${NVTOOLSEXT_ARCH_FOLDER}
|
||||
)
|
||||
|
||||
find_library( NVTOOLSEXT_DLL
|
||||
NAMES nvToolsExt${NVTOOLSEXT_ARCH_FILE}_1
|
||||
PATHS
|
||||
${NVTOOLSEXTSDK_PATH}/bin/${NVTOOLSEXT_ARCH_FOLDER}
|
||||
)
|
||||
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(nvToolsExt DEFAULT_MSG NVTOOLSEXT_LIB NVTOOLSEXT_DLL NVTOOLSEXT_INCLUDE_DIRS)
|
||||
ELSE()
|
||||
# Exclude the libraries for non-windows platforms
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(nvToolsExt DEFAULT_MSG NVTOOLSEXT_INCLUDE_DIRS)
|
||||
ENDIF()
|
||||
|
||||
mark_as_advanced(NVTOOLSEXT_INCLUDE_DIRS NVTOOLSEXT_DLL NVTOOLSEXT_LIB)
|
||||
132
externals/cmakemodules/GetCompilerAndPlatform.cmake
vendored
Normal file
132
externals/cmakemodules/GetCompilerAndPlatform.cmake
vendored
Normal file
@ -0,0 +1,132 @@
|
||||
FUNCTION(CompilerDumpVersion _OUTPUT_VERSION)
|
||||
|
||||
EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
|
||||
ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
|
||||
OUTPUT_VARIABLE COMPILER_VERSION
|
||||
)
|
||||
STRING(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2"
|
||||
COMPILER_VERSION ${COMPILER_VERSION})
|
||||
|
||||
SET(${_OUTPUT_VERSION} ${COMPILER_VERSION})
|
||||
ENDFUNCTION()
|
||||
|
||||
FUNCTION(GetCompiler _ret)
|
||||
SET(COMPILER_SUFFIX "UNKNOWN")
|
||||
|
||||
IF(CMAKE_CXX_COMPILER_ID STREQUAL "Intel"
|
||||
OR CMAKE_CXX_COMPILER MATCHES "icl"
|
||||
OR CMAKE_CXX_COMPILER MATCHES "icpc")
|
||||
IF(WIN32)
|
||||
SET (COMPILER_SUFFIX "iw")
|
||||
ELSE()
|
||||
SET (COMPILER_SUFFIX "il")
|
||||
ENDIF()
|
||||
ELSEIF (GHSMULTI)
|
||||
SET(COMPILER_SUFFIX "ghs")
|
||||
ELSEIF (MSVC_VERSION GREATER_EQUAL 1920)
|
||||
SET(COMPILER_SUFFIX "vc142")
|
||||
ELSEIF (MSVC_VERSION GREATER_EQUAL 1910)
|
||||
SET(COMPILER_SUFFIX "vc141")
|
||||
ELSEIF (MSVC14)
|
||||
SET(COMPILER_SUFFIX "vc140")
|
||||
ELSEIF (MSVC12)
|
||||
SET(COMPILER_SUFFIX "vc120")
|
||||
ELSEIF (MSVC11)
|
||||
SET(COMPILER_SUFFIX "vc110")
|
||||
ELSEIF (MSVC10)
|
||||
SET(COMPILER_SUFFIX "vc100")
|
||||
ELSEIF (MSVC90)
|
||||
SET(COMPILER_SUFFIX "vc90")
|
||||
ELSEIF (MSVC80)
|
||||
SET(COMPILER_SUFFIX "vc80")
|
||||
ELSEIF (MSVC71)
|
||||
SET(COMPILER_SUFFIX "vc71")
|
||||
ELSEIF (MSVC70) # Good luck!
|
||||
SET(COMPILER_SUFFIX "vc7") # yes, this is correct
|
||||
ELSEIF (MSVC60) # Good luck!
|
||||
SET(COMPILER_SUFFIX "vc6") # yes, this is correct
|
||||
ELSEIF (BORLAND)
|
||||
SET(COMPILER_SUFFIX "bcb")
|
||||
ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
|
||||
SET(COMPILER_SUFFIX "sw")
|
||||
ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "XL")
|
||||
SET(COMPILER_SUFFIX "xlc")
|
||||
ELSEIF (MINGW)
|
||||
CompilerDumpVersion(_COMPILER_VERSION)
|
||||
SET(COMPILER_SUFFIX "mgw${_COMPILER_VERSION}")
|
||||
ELSEIF (UNIX)
|
||||
IF (CMAKE_COMPILER_IS_GNUCXX)
|
||||
CompilerDumpVersion(_COMPILER_VERSION)
|
||||
IF(APPLE)
|
||||
# on Mac OS X/Darwin is "xgcc".
|
||||
SET(COMPILER_SUFFIX "xgcc${_COMPILER_VERSION}")
|
||||
ELSE()
|
||||
SET(COMPILER_SUFFIX "gcc${_COMPILER_VERSION}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ELSEIF (XBOXONE_MSVC_VERSION EQUAL 140)
|
||||
SET(COMPILER_SUFFIX "vc140")
|
||||
ELSEIF (XBOXONE_MSVC_VERSION EQUAL 141)
|
||||
SET(COMPILER_SUFFIX "vc141")
|
||||
ELSEIF (XBOXSERIESX_MSVC_VERSION EQUAL 141)
|
||||
SET(COMPILER_SUFFIX "vc141")
|
||||
ELSE()
|
||||
# add clang!
|
||||
SET(COMPILER_SUFFIX "")
|
||||
ENDIF()
|
||||
|
||||
SET(${_ret} ${COMPILER_SUFFIX} PARENT_SCOPE)
|
||||
ENDFUNCTION()
|
||||
|
||||
FUNCTION(GetStaticCRTString _ret)
|
||||
IF(NOT TARGET_BUILD_PLATFORM STREQUAL "windows")
|
||||
return()
|
||||
ENDIF()
|
||||
|
||||
IF (NV_USE_STATIC_WINCRT)
|
||||
SET(CRT_STRING "mt")
|
||||
ELSE()
|
||||
SET(CRT_STRING "md")
|
||||
ENDIF()
|
||||
|
||||
SET(${_ret} ${CRT_STRING} PARENT_SCOPE)
|
||||
ENDFUNCTION()
|
||||
|
||||
FUNCTION (GetPlatformBinName PLATFORM_BIN_NAME LIBPATH_SUFFIX)
|
||||
SET(RETVAL "UNKNOWN")
|
||||
|
||||
GetCompiler(COMPILER)
|
||||
|
||||
IF(TARGET_BUILD_PLATFORM STREQUAL "windows")
|
||||
GetStaticCRTString(CRT_STRING)
|
||||
SET(RETVAL "win.x86_${LIBPATH_SUFFIX}.${COMPILER}.${CRT_STRING}")
|
||||
ELSEIF(TARGET_BUILD_PLATFORM STREQUAL "uwp")
|
||||
SET(RETVAL "uwp.${PX_OUTPUT_ARCH}_${LIBPATH_SUFFIX}.${COMPILER}")
|
||||
ELSEIF(TARGET_BUILD_PLATFORM STREQUAL "mac")
|
||||
SET(RETVAL "mac.x86_${LIBPATH_SUFFIX}")
|
||||
ELSEIF(TARGET_BUILD_PLATFORM STREQUAL "ios")
|
||||
SET(RETVAL "ios.arm_${LIBPATH_SUFFIX}")
|
||||
ELSEIF(TARGET_BUILD_PLATFORM STREQUAL "ps4")
|
||||
SET(RETVAL "ps4")
|
||||
ELSEIF(TARGET_BUILD_PLATFORM STREQUAL "xboxone")
|
||||
SET(RETVAL "xboxone.${COMPILER}")
|
||||
ELSEIF(TARGET_BUILD_PLATFORM STREQUAL "xboxseriesx")
|
||||
SET(RETVAL "xboxseriesx.${COMPILER}")
|
||||
ELSEIF(TARGET_BUILD_PLATFORM STREQUAL "switch")
|
||||
IF (${CMAKE_GENERATOR_PLATFORM} STREQUAL "NX32")
|
||||
SET(RETVAL "switch32")
|
||||
ELSEIF (${CMAKE_GENERATOR_PLATFORM} STREQUAL "NX64")
|
||||
SET(RETVAL "switch64")
|
||||
ENDIF()
|
||||
ELSEIF(TARGET_BUILD_PLATFORM STREQUAL "android")
|
||||
SET(RETVAL "android.${ANDROID_ABI}.fp-soft")
|
||||
ELSEIF(TARGET_BUILD_PLATFORM STREQUAL "linux")
|
||||
IF(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
|
||||
SET(RETVAL "linux.clang")
|
||||
ELSEIF(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
|
||||
SET(RETVAL "linux.aarch64")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
SET(${PLATFORM_BIN_NAME} ${RETVAL} PARENT_SCOPE)
|
||||
ENDFUNCTION()
|
||||
230
externals/cmakemodules/NvidiaBuildOptions.cmake
vendored
Normal file
230
externals/cmakemodules/NvidiaBuildOptions.cmake
vendored
Normal file
@ -0,0 +1,230 @@
|
||||
# Define the options up front
|
||||
|
||||
OPTION(NV_APPEND_CONFIG_NAME "Append config (DEBUG, CHECKED, PROFILE or '' for release) to outputted binaries." OFF)
|
||||
OPTION(NV_USE_GAMEWORKS_OUTPUT_DIRS "Use new GameWorks folder structure for binary output." ON)
|
||||
OPTION(NV_USE_STATIC_WINCRT "Use the statically linked windows CRT" OFF)
|
||||
OPTION(NV_USE_DEBUG_WINCRT "Use the debug version of the CRT" OFF)
|
||||
OPTION(NV_FORCE_64BIT_SUFFIX "Force a 64 bit suffix for platforms that don't register properly." OFF)
|
||||
OPTION(NV_FORCE_32BIT_SUFFIX "Force a 32 bit suffix for platforms that don't register properly." OFF)
|
||||
|
||||
INCLUDE(SetOutputPaths)
|
||||
|
||||
|
||||
IF(NV_USE_GAMEWORKS_OUTPUT_DIRS)
|
||||
|
||||
IF(NV_FORCE_32BIT_SUFFIX AND NV_FORCE_64BIT_SUFFIX)
|
||||
MESSAGE(FATAL_ERROR "Cannot specify both NV_FORCE_64BIT_SUFFIX and NV_FORCE_32BIT_SUFFIX. Choose one.")
|
||||
ENDIF()
|
||||
|
||||
IF(SUPPRESS_SUFFIX)
|
||||
MESSAGE("Suppressing binary suffixes.")
|
||||
SET(LIBPATH_SUFFIX "NONE")
|
||||
# Set default exe suffix. Unset on platforms that don't need it. Include underscore since it's optional
|
||||
SET(EXE_SUFFIX "")
|
||||
ELSEIF(NV_FORCE_32BIT_SUFFIX)
|
||||
MESSAGE("Forcing binary suffixes to 32 bit.")
|
||||
SET(LIBPATH_SUFFIX "32")
|
||||
# Set default exe suffix. Unset on platforms that don't need it. Include underscore since it's optional
|
||||
SET(EXE_SUFFIX "_32")
|
||||
ELSEIF(NV_FORCE_64BIT_SUFFIX)
|
||||
MESSAGE("Forcing binary suffixes to 64 bit.")
|
||||
SET(LIBPATH_SUFFIX "64")
|
||||
# Set default exe suffix. Unset on platforms that don't need it. Include underscore since it's optional
|
||||
SET(EXE_SUFFIX "_64")
|
||||
ELSE()
|
||||
# New bitness suffix
|
||||
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
SET(LIBPATH_SUFFIX "64")
|
||||
# Set default exe suffix. Unset on platforms that don't need it. Include underscore since it's optional
|
||||
SET(EXE_SUFFIX "_64")
|
||||
ELSE()
|
||||
SET(LIBPATH_SUFFIX "32")
|
||||
# Set default exe suffix. Unset on platforms that don't need it. Include underscore since it's optional
|
||||
SET(EXE_SUFFIX "_32")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF (NOT DEFINED PX_OUTPUT_LIB_DIR)
|
||||
MESSAGE(FATAL_ERROR "When using the GameWorks output structure you must specify PX_OUTPUT_LIB_DIR as the base")
|
||||
ENDIF()
|
||||
|
||||
IF (NOT DEFINED PX_OUTPUT_BIN_DIR)
|
||||
MESSAGE(FATAL_ERROR "When using the GameWorks output structure you must specify PX_OUTPUT_BIN_DIR as the base")
|
||||
ENDIF()
|
||||
|
||||
# Set the WINCRT_DEBUG and WINCRT_NDEBUG variables for use in project compile settings
|
||||
# Really only relevant to windows
|
||||
|
||||
SET(DISABLE_ITERATOR_DEBUGGING "/D \"_HAS_ITERATOR_DEBUGGING=0\" /D \"_ITERATOR_DEBUG_LEVEL=0\"")
|
||||
SET(DISABLE_ITERATOR_DEBUGGING_CUDA "-D_HAS_ITERATOR_DEBUGGING=0 -D_ITERATOR_DEBUG_LEVEL=0")
|
||||
SET(CRT_DEBUG_FLAG "/D \"_DEBUG\"")
|
||||
SET(CRT_NDEBUG_FLAG "/D \"NDEBUG\"")
|
||||
|
||||
# Need a different format for CUDA
|
||||
SET(CUDA_DEBUG_FLAG "-DNDEBUG ${DISABLE_ITERATOR_DEBUGGING_CUDA}")
|
||||
SET(CUDA_NDEBUG_FLAG "-DNDEBUG")
|
||||
|
||||
SET(CUDA_CRT_COMPILE_OPTIONS_NDEBUG "")
|
||||
SET(CUDA_CRT_COMPILE_OPTIONS_DEBUG "")
|
||||
|
||||
|
||||
IF(NV_USE_STATIC_WINCRT)
|
||||
SET(WINCRT_NDEBUG "/MT ${DISABLE_ITERATOR_DEBUGGING} ${CRT_NDEBUG_FLAG}" CACHE INTERNAL "Windows CRT build setting")
|
||||
SET(CUDA_CRT_COMPILE_OPTIONS_NDEBUG "/MT")
|
||||
|
||||
IF (NV_USE_DEBUG_WINCRT)
|
||||
SET(CUDA_DEBUG_FLAG "-D_DEBUG")
|
||||
SET(WINCRT_DEBUG "/MTd ${CRT_DEBUG_FLAG}" CACHE INTERNAL "Windows CRT build setting")
|
||||
SET(CUDA_CRT_COMPILE_OPTIONS_DEBUG "/MTd")
|
||||
ELSE()
|
||||
SET(WINCRT_DEBUG "/MT ${DISABLE_ITERATOR_DEBUGGING} ${CRT_NDEBUG_FLAG}" CACHE INTERNAL "Windows CRT build setting")
|
||||
SET(CUDA_CRT_COMPILE_OPTIONS_DEBUG "/MT")
|
||||
ENDIF()
|
||||
ELSE()
|
||||
SET(WINCRT_NDEBUG "/MD ${DISABLE_ITERATOR_DEBUGGING} ${CRT_NDEBUG_FLAG}")
|
||||
SET(CUDA_CRT_COMPILE_OPTIONS_NDEBUG "/MD")
|
||||
|
||||
IF(NV_USE_DEBUG_WINCRT)
|
||||
SET(CUDA_DEBUG_FLAG "-D_DEBUG")
|
||||
SET(WINCRT_DEBUG "/MDd ${CRT_DEBUG_FLAG}" CACHE INTERNAL "Windows CRT build setting")
|
||||
SET(CUDA_CRT_COMPILE_OPTIONS_DEBUG "/MDd")
|
||||
ELSE()
|
||||
SET(WINCRT_DEBUG "/MD ${DISABLE_ITERATOR_DEBUGGING} ${CRT_NDEBUG_FLAG}" CACHE INTERNAL "Windows CRT build setting")
|
||||
SET(CUDA_CRT_COMPILE_OPTIONS_DEBUG "/MD")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
INCLUDE(GetCompilerAndPlatform)
|
||||
|
||||
GetPlatformBinName(PLATFORM_BIN_NAME ${LIBPATH_SUFFIX})
|
||||
|
||||
|
||||
SET(PX_ROOT_LIB_DIR "bin/${PLATFORM_BIN_NAME}" CACHE INTERNAL "Relative root of the lib output directory")
|
||||
SET(PX_ROOT_EXE_DIR "bin/${PLATFORM_BIN_NAME}" CACHE INTERNAL "Relative root dir of the exe output directory")
|
||||
|
||||
IF (NOT DEFINED PX_OUTPUT_ARCH) # platforms with fixed arch like ps4 dont need to have arch defined
|
||||
SET(EXE_SUFFIX "")
|
||||
ENDIF()
|
||||
|
||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${PX_OUTPUT_LIB_DIR}/${PX_ROOT_LIB_DIR}/debug" )
|
||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_PROFILE "${PX_OUTPUT_LIB_DIR}/${PX_ROOT_LIB_DIR}/profile" )
|
||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_CHECKED "${PX_OUTPUT_LIB_DIR}/${PX_ROOT_LIB_DIR}/checked" )
|
||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${PX_OUTPUT_LIB_DIR}/${PX_ROOT_LIB_DIR}/release" )
|
||||
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${PX_OUTPUT_LIB_DIR}/${PX_ROOT_LIB_DIR}/debug" )
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_PROFILE "${PX_OUTPUT_LIB_DIR}/${PX_ROOT_LIB_DIR}/profile" )
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_CHECKED "${PX_OUTPUT_LIB_DIR}/${PX_ROOT_LIB_DIR}/checked" )
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${PX_OUTPUT_LIB_DIR}/${PX_ROOT_LIB_DIR}/release" )
|
||||
|
||||
# Set the RUNTIME output directories - this is executables, etc.
|
||||
# Override our normal PX_ROOT_EXE_DIR for Android
|
||||
IF(TARGET_BUILD_PLATFORM STREQUAL "Android")
|
||||
SET(PX_ROOT_EXE_DIR "bin/${COMPILER_AND_PLATFORM}/${ANDROID_ABI}/${CM_ANDROID_FP}" CACHE INTERNAL "Relative root dir of the exe output directory")
|
||||
ENDIF()
|
||||
|
||||
# RFC 108, we're doing EXEs as the special case since there will be presumable be less of those.
|
||||
SET(PX_EXE_OUTPUT_DIRECTORY_DEBUG "${PX_OUTPUT_BIN_DIR}/${PX_ROOT_EXE_DIR}/debug" CACHE INTERNAL "Directory to put debug exes in")
|
||||
SET(PX_EXE_OUTPUT_DIRECTORY_PROFILE "${PX_OUTPUT_BIN_DIR}/${PX_ROOT_EXE_DIR}/profile" CACHE INTERNAL "Directory to put profile exes in")
|
||||
SET(PX_EXE_OUTPUT_DIRECTORY_CHECKED "${PX_OUTPUT_BIN_DIR}/${PX_ROOT_EXE_DIR}/checked" CACHE INTERNAL "Directory to put checked exes in")
|
||||
SET(PX_EXE_OUTPUT_DIRECTORY_RELEASE "${PX_OUTPUT_BIN_DIR}/${PX_ROOT_EXE_DIR}/release" CACHE INTERNAL "Directory to put release exes in")
|
||||
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG} )
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_PROFILE ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY_PROFILE} )
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_CHECKED ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY_CHECKED} )
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE} )
|
||||
|
||||
|
||||
ELSE()
|
||||
# old bitness suffix
|
||||
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
SET(LIBPATH_SUFFIX "x64")
|
||||
ELSE()
|
||||
SET(LIBPATH_SUFFIX "x86")
|
||||
ENDIF()
|
||||
|
||||
SET(DISABLE_ITERATOR_DEBUGGING "/D \"_HAS_ITERATOR_DEBUGGING=0\" /D \"_ITERATOR_DEBUG_LEVEL=0\"")
|
||||
SET(DISABLE_ITERATOR_DEBUGGING_CUDA "-D_HAS_ITERATOR_DEBUGGING=0 -D_ITERATOR_DEBUG_LEVEL=0")
|
||||
SET(CRT_DEBUG_FLAG "/D \"_DEBUG\"")
|
||||
SET(CRT_NDEBUG_FLAG "/D \"NDEBUG\"")
|
||||
|
||||
# Need a different format for CUDA
|
||||
SET(CUDA_DEBUG_FLAG "-DNDEBUG ${DISABLE_ITERATOR_DEBUGGING_CUDA}")
|
||||
SET(CUDA_NDEBUG_FLAG "-DNDEBUG")
|
||||
|
||||
SET(CUDA_CRT_COMPILE_OPTIONS_NDEBUG "")
|
||||
SET(CUDA_CRT_COMPILE_OPTIONS_DEBUG "")
|
||||
|
||||
IF(NV_USE_STATIC_WINCRT)
|
||||
SET(WINCRT_NDEBUG "/MT ${DISABLE_ITERATOR_DEBUGGING} ${CRT_NDEBUG_FLAG}" CACHE INTERNAL "Windows CRT build setting")
|
||||
SET(CUDA_CRT_COMPILE_OPTIONS_NDEBUG "/MT")
|
||||
|
||||
IF (NV_USE_DEBUG_WINCRT)
|
||||
SET(CUDA_DEBUG_FLAG "-D_DEBUG")
|
||||
SET(WINCRT_DEBUG "/MTd ${CRT_DEBUG_FLAG}" CACHE INTERNAL "Windows CRT build setting")
|
||||
SET(CUDA_CRT_COMPILE_OPTIONS_DEBUG "/MTd")
|
||||
ELSE()
|
||||
SET(WINCRT_DEBUG "/MT ${DISABLE_ITERATOR_DEBUGGING} ${CRT_NDEBUG_FLAG}" CACHE INTERNAL "Windows CRT build setting")
|
||||
SET(CUDA_CRT_COMPILE_OPTIONS_DEBUG "/MT")
|
||||
ENDIF()
|
||||
ELSE()
|
||||
SET(WINCRT_NDEBUG "/MD ${DISABLE_ITERATOR_DEBUGGING} ${CRT_NDEBUG_FLAG}")
|
||||
SET(CUDA_CRT_COMPILE_OPTIONS_NDEBUG "/MD")
|
||||
|
||||
IF(NV_USE_DEBUG_WINCRT)
|
||||
SET(CUDA_DEBUG_FLAG "-D_DEBUG")
|
||||
SET(WINCRT_DEBUG "/MDd ${CRT_DEBUG_FLAG}" CACHE INTERNAL "Windows CRT build setting")
|
||||
SET(CUDA_CRT_COMPILE_OPTIONS_DEBUG "/MDd")
|
||||
ELSE()
|
||||
SET(WINCRT_DEBUG "/MD ${DISABLE_ITERATOR_DEBUGGING} ${CRT_NDEBUG_FLAG}" CACHE INTERNAL "Windows CRT build setting")
|
||||
SET(CUDA_CRT_COMPILE_OPTIONS_DEBUG "/MD")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(DEFINED PX_OUTPUT_EXE_DIR)
|
||||
SetExeOutputPath(${PX_OUTPUT_EXE_DIR})
|
||||
ENDIF()
|
||||
IF(DEFINED PX_OUTPUT_DLL_DIR)
|
||||
SetDllOutputPath(${PX_OUTPUT_DLL_DIR})
|
||||
ENDIF()
|
||||
IF(DEFINED PX_OUTPUT_LIB_DIR)
|
||||
SetLibOutputPath(${PX_OUTPUT_LIB_DIR})
|
||||
ENDIF()
|
||||
# All EXE/DLL/LIB output will be overwritten if PX_OUTPUT_ALL_DIR is defined
|
||||
IF(DEFINED PX_OUTPUT_ALL_DIR)
|
||||
SetSingleOutputPath(${PX_OUTPUT_ALL_DIR})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NV_APPEND_CONFIG_NAME)
|
||||
SET(CMAKE_DEBUG_POSTFIX "DEBUG_${LIBPATH_SUFFIX}")
|
||||
SET(CMAKE_PROFILE_POSTFIX "PROFILE_${LIBPATH_SUFFIX}")
|
||||
SET(CMAKE_CHECKED_POSTFIX "CHECKED_${LIBPATH_SUFFIX}")
|
||||
SET(CMAKE_RELEASE_POSTFIX "_${LIBPATH_SUFFIX}")
|
||||
ELSE()
|
||||
IF (DEFINED PX_OUTPUT_ARCH) # platforms with fixed arch like ps4 dont need to have arch defined, then dont add bitness
|
||||
SET(CMAKE_DEBUG_POSTFIX "_${LIBPATH_SUFFIX}")
|
||||
SET(CMAKE_PROFILE_POSTFIX "_${LIBPATH_SUFFIX}")
|
||||
SET(CMAKE_CHECKED_POSTFIX "_${LIBPATH_SUFFIX}")
|
||||
SET(CMAKE_RELEASE_POSTFIX "_${LIBPATH_SUFFIX}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Can no longer just use LIBPATH_SUFFIX since it depends on build type
|
||||
IF(CMAKE_CL_64)
|
||||
SET(RESOURCE_LIBPATH_SUFFIX "x64")
|
||||
ELSE(CMAKE_CL_64)
|
||||
SET(RESOURCE_LIBPATH_SUFFIX "x86")
|
||||
ENDIF(CMAKE_CL_64)
|
||||
|
||||
|
||||
# removes characters from the version string and leaves just numbers
|
||||
FUNCTION(StripPackmanVersion IN_VERSION _OUTPUT_VERSION)
|
||||
|
||||
STRING(REGEX REPLACE "([^0-9.])" ""
|
||||
OUT_V ${IN_VERSION})
|
||||
|
||||
STRING(REPLACE ".." "."
|
||||
OUT_V2 ${OUT_V})
|
||||
|
||||
SET(${_OUTPUT_VERSION} ${OUT_V2} PARENT_SCOPE)
|
||||
ENDFUNCTION(StripPackmanVersion)
|
||||
95
externals/cmakemodules/SetOutputPaths.cmake
vendored
Normal file
95
externals/cmakemodules/SetOutputPaths.cmake
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
FUNCTION(SetOutputPaths
|
||||
OUTPUT_EXE_DIR
|
||||
OUTPUT_DLL_DIR
|
||||
OUTPUT_LIB_DIR)
|
||||
|
||||
SET(EXE_DIR ${OUTPUT_EXE_DIR})
|
||||
SET(DLL_DIR ${OUTPUT_DLL_DIR})
|
||||
SET(LIB_DIR ${OUTPUT_LIB_DIR})
|
||||
|
||||
# Override the default output directories for all configurations.
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${EXE_DIR} PARENT_SCOPE)
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${DLL_DIR} PARENT_SCOPE)
|
||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${LIB_DIR} PARENT_SCOPE)
|
||||
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_CHECKED ${EXE_DIR} PARENT_SCOPE)
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_CHECKED ${DLL_DIR} PARENT_SCOPE)
|
||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_CHECKED ${LIB_DIR} PARENT_SCOPE)
|
||||
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_PROFILE ${EXE_DIR} PARENT_SCOPE)
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_PROFILE ${DLL_DIR} PARENT_SCOPE)
|
||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_PROFILE ${LIB_DIR} PARENT_SCOPE)
|
||||
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${EXE_DIR} PARENT_SCOPE)
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${DLL_DIR} PARENT_SCOPE)
|
||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${LIB_DIR} PARENT_SCOPE)
|
||||
|
||||
SET(CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY ${LIB_DIR})
|
||||
|
||||
ENDFUNCTION(SetOutputPaths)
|
||||
|
||||
FUNCTION(SetExeOutputPath OUTPUT_EXE_DIR)
|
||||
|
||||
SET(EXE_DIR ${OUTPUT_EXE_DIR})
|
||||
|
||||
# Override the default output directories for all configurations.
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${EXE_DIR} PARENT_SCOPE)
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_CHECKED ${EXE_DIR} PARENT_SCOPE)
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_PROFILE ${EXE_DIR} PARENT_SCOPE)
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${EXE_DIR} PARENT_SCOPE)
|
||||
|
||||
ENDFUNCTION(SetExeOutputPath)
|
||||
|
||||
FUNCTION(SetDllOutputPath OUTPUT_DLL_DIR)
|
||||
|
||||
SET(DLL_DIR ${OUTPUT_DLL_DIR})
|
||||
|
||||
# Override the default output directories for all configurations.
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${DLL_DIR}/${ARGV1} PARENT_SCOPE)
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_PROFILE ${DLL_DIR}/${ARGV2} PARENT_SCOPE)
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_CHECKED ${DLL_DIR}/${ARGV3} PARENT_SCOPE)
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${DLL_DIR}/${ARGV4} PARENT_SCOPE)
|
||||
|
||||
ENDFUNCTION(SetDllOutputPath)
|
||||
|
||||
FUNCTION(SetLibOutputPath OUTPUT_LIB_DIR)
|
||||
|
||||
SET(LIB_DIR ${OUTPUT_LIB_DIR})
|
||||
|
||||
# Override the default output directories for all configurations.
|
||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${LIB_DIR}/${ARGV1} PARENT_SCOPE)
|
||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_PROFILE ${LIB_DIR}/${ARGV2} PARENT_SCOPE)
|
||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_CHECKED ${LIB_DIR}/${ARGV3} PARENT_SCOPE)
|
||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${LIB_DIR}/${ARGV4} PARENT_SCOPE)
|
||||
|
||||
SET(CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY ${LIB_DIR})
|
||||
|
||||
ENDFUNCTION(SetLibOutputPath)
|
||||
|
||||
FUNCTION(SetSingleOutputPath OUTPUT_ALL_DIR)
|
||||
|
||||
SET(EXE_DIR ${OUTPUT_ALL_DIR})
|
||||
SET(DLL_DIR ${OUTPUT_ALL_DIR})
|
||||
SET(LIB_DIR ${OUTPUT_ALL_DIR})
|
||||
|
||||
# Override the default output directories for all configurations.
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${EXE_DIR} PARENT_SCOPE)
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${DLL_DIR} PARENT_SCOPE)
|
||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${LIB_DIR} PARENT_SCOPE)
|
||||
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_CHECKED ${EXE_DIR} PARENT_SCOPE)
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_CHECKED ${DLL_DIR} PARENT_SCOPE)
|
||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_CHECKED ${LIB_DIR} PARENT_SCOPE)
|
||||
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_PROFILE ${EXE_DIR} PARENT_SCOPE)
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_PROFILE ${DLL_DIR} PARENT_SCOPE)
|
||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_PROFILE ${LIB_DIR} PARENT_SCOPE)
|
||||
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${EXE_DIR} PARENT_SCOPE)
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${DLL_DIR} PARENT_SCOPE)
|
||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${LIB_DIR} PARENT_SCOPE)
|
||||
|
||||
SET(CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY ${LIB_DIR})
|
||||
|
||||
ENDFUNCTION(SetSingleOutputPath)
|
||||
|
||||
17
externals/cmakemodules/android/AndroidCMake.tps
vendored
Normal file
17
externals/cmakemodules/android/AndroidCMake.tps
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TpsData xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<Name />
|
||||
<Location>/Engine/Source/Runtime/Navmesh/RecastDemo/Bin/DroidSans.ttf</Location>
|
||||
<Function />
|
||||
<Justification />
|
||||
<Platforms />
|
||||
<Products />
|
||||
<Eula />
|
||||
<RedistributeTo />
|
||||
<Redistribute>false</Redistribute>
|
||||
<IsSourceAvailable>false</IsSourceAvailable>
|
||||
<Notification>
|
||||
Redirect: ../../../../HarfBuzz/harfbuzz-1.2.4/BuildForUE/Android/AndroidCMake.tps
|
||||
</Notification>
|
||||
<LicenseFolder />
|
||||
</TpsData>
|
||||
96
externals/cmakemodules/android/AndroidNdkGdb.cmake
vendored
Normal file
96
externals/cmakemodules/android/AndroidNdkGdb.cmake
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
# Copyright (c) 2014, Pavel Rojtberg
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Usage:
|
||||
# 1. place AndroidNdkGdb.cmake somewhere inside ${CMAKE_MODULE_PATH}
|
||||
# 2. inside your project add
|
||||
#
|
||||
# include(AndroidNdkGdb)
|
||||
# android_ndk_gdb_enable()
|
||||
# # for each target
|
||||
# add_library(MyLibrary ...)
|
||||
# android_ndk_gdb_debuggable(MyLibrary)
|
||||
|
||||
|
||||
# add gdbserver and general gdb configuration to project
|
||||
# also create a mininal NDK skeleton so ndk-gdb finds the paths
|
||||
#
|
||||
# the optional parameter defines the path to the android project.
|
||||
# uses PROJECT_SOURCE_DIR by default.
|
||||
macro(android_ndk_gdb_enable)
|
||||
if(ANDROID)
|
||||
# create custom target that depends on the real target so it gets executed afterwards
|
||||
add_custom_target(NDK_GDB ALL)
|
||||
|
||||
if(${ARGC})
|
||||
set(ANDROID_PROJECT_DIR ${ARGV0})
|
||||
else()
|
||||
set(ANDROID_PROJECT_DIR ${PROJECT_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
set(NDK_GDB_SOLIB_PATH ${ANDROID_PROJECT_DIR}/obj/local/${ANDROID_NDK_ABI_NAME}/)
|
||||
file(MAKE_DIRECTORY ${NDK_GDB_SOLIB_PATH})
|
||||
|
||||
# 1. generate essential Android Makefiles
|
||||
file(MAKE_DIRECTORY ${ANDROID_PROJECT_DIR}/jni)
|
||||
if(NOT EXISTS ${ANDROID_PROJECT_DIR}/jni/Android.mk)
|
||||
file(WRITE ${ANDROID_PROJECT_DIR}/jni/Android.mk "APP_ABI := ${ANDROID_NDK_ABI_NAME}\n")
|
||||
endif()
|
||||
if(NOT EXISTS ${ANDROID_PROJECT_DIR}/jni/Application.mk)
|
||||
file(WRITE ${ANDROID_PROJECT_DIR}/jni/Application.mk "APP_ABI := ${ANDROID_NDK_ABI_NAME}\n")
|
||||
endif()
|
||||
|
||||
# 2. generate gdb.setup
|
||||
get_directory_property(PROJECT_INCLUDES DIRECTORY ${PROJECT_SOURCE_DIR} INCLUDE_DIRECTORIES)
|
||||
string(REGEX REPLACE ";" " " PROJECT_INCLUDES "${PROJECT_INCLUDES}")
|
||||
file(WRITE ${LIBRARY_OUTPUT_PATH}/gdb.setup "set solib-search-path ${NDK_GDB_SOLIB_PATH}\n")
|
||||
file(APPEND ${LIBRARY_OUTPUT_PATH}/gdb.setup "directory ${PROJECT_INCLUDES}\n")
|
||||
|
||||
# 3. copy gdbserver executable
|
||||
file(COPY ${ANDROID_NDK}/prebuilt/android-${ANDROID_ARCH_NAME}/gdbserver/gdbserver DESTINATION ${LIBRARY_OUTPUT_PATH})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# register a target for remote debugging
|
||||
# copies the debug version to NDK_GDB_SOLIB_PATH then strips symbols of original
|
||||
macro(android_ndk_gdb_debuggable TARGET_NAME)
|
||||
if(ANDROID)
|
||||
get_property(TARGET_LOCATION TARGET ${TARGET_NAME} PROPERTY LOCATION)
|
||||
|
||||
# create custom target that depends on the real target so it gets executed afterwards
|
||||
add_dependencies(NDK_GDB ${TARGET_NAME})
|
||||
|
||||
# 4. copy lib to obj
|
||||
add_custom_command(TARGET NDK_GDB POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${TARGET_LOCATION} ${NDK_GDB_SOLIB_PATH})
|
||||
|
||||
# 5. strip symbols
|
||||
add_custom_command(TARGET NDK_GDB POST_BUILD COMMAND ${CMAKE_STRIP} ${TARGET_LOCATION})
|
||||
endif()
|
||||
endmacro()
|
||||
58
externals/cmakemodules/android/AndroidNdkModules.cmake
vendored
Normal file
58
externals/cmakemodules/android/AndroidNdkModules.cmake
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
# Copyright (c) 2014, Pavel Rojtberg
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
macro(android_ndk_import_module_cpufeatures)
|
||||
if(ANDROID)
|
||||
include_directories(${ANDROID_NDK}/sources/android/cpufeatures)
|
||||
add_library(cpufeatures ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c)
|
||||
target_link_libraries(cpufeatures dl)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(android_ndk_import_module_native_app_glue)
|
||||
if(ANDROID)
|
||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
add_library(native_app_glue ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
||||
target_link_libraries(native_app_glue log)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(android_ndk_import_module_ndk_helper)
|
||||
if(ANDROID)
|
||||
android_ndk_import_module_cpufeatures()
|
||||
android_ndk_import_module_native_app_glue()
|
||||
|
||||
include_directories(${ANDROID_NDK}/sources/android/ndk_helper)
|
||||
file(GLOB _NDK_HELPER_SRCS ${ANDROID_NDK}/sources/android/ndk_helper/*.cpp ${ANDROID_NDK}/sources/android/ndk_helper/gl3stub.c)
|
||||
add_library(ndk_helper ${_NDK_HELPER_SRCS})
|
||||
target_link_libraries(ndk_helper log android EGL GLESv2 cpufeatures native_app_glue)
|
||||
|
||||
unset(_NDK_HELPER_SRCS)
|
||||
endif()
|
||||
endmacro()
|
||||
240
externals/cmakemodules/android/README.md
vendored
Normal file
240
externals/cmakemodules/android/README.md
vendored
Normal file
@ -0,0 +1,240 @@
|
||||
# android-cmake
|
||||
|
||||
CMake is great, and so is Android. This is a collection of CMake scripts that may be useful to the Android NDK community. It is based on experience from porting OpenCV library to Android: http://opencv.org/platforms/android.html
|
||||
|
||||
Main goal is to share these scripts so that devs that use CMake as their build system may easily compile native code for Android.
|
||||
|
||||
## TL;DR
|
||||
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=android.toolchain.cmake \
|
||||
-DANDROID_NDK=<ndk_path> \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DANDROID_ABI="armeabi-v7a with NEON" \
|
||||
<source_path>
|
||||
cmake --build .
|
||||
|
||||
One-liner:
|
||||
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE=android.toolchain.cmake -DANDROID_NDK=<ndk_path> -DCMAKE_BUILD_TYPE=Release -DANDROID_ABI="armeabi-v7a with NEON" <source_path> && cmake --build .
|
||||
|
||||
_android-cmake_ will search for your NDK install in the following order:
|
||||
|
||||
1. Value of `ANDROID_NDK` CMake variable;
|
||||
1. Value of `ANDROID_NDK` environment variable;
|
||||
1. Search under paths from `ANDROID_NDK_SEARCH_PATHS` CMake variable;
|
||||
1. Search platform specific locations (home folder, Windows "Program Files", etc).
|
||||
|
||||
So if you have installed the NDK as `~/android-ndk-r10d` then _android-cmake_ will locate it automatically.
|
||||
|
||||
## Getting started
|
||||
|
||||
To build a cmake-based C/C++ project for Android you need:
|
||||
|
||||
* Android NDK (>= r5) http://developer.android.com/tools/sdk/ndk/index.html
|
||||
* CMake (>= v2.6.3, >= v2.8.9 recommended) http://www.cmake.org/download
|
||||
|
||||
The _android-cmake_ is also capable to build with NDK from AOSP or Linaro Android source tree, but you may be required to manually specify path to `libm` binary to link with.
|
||||
|
||||
## Difference from traditional CMake
|
||||
|
||||
Folowing the _ndk-build_ the _android-cmake_ supports **only two build targets**:
|
||||
|
||||
* `-DCMAKE_BUILD_TYPE=Release`
|
||||
* `-DCMAKE_BUILD_TYPE=Debug`
|
||||
|
||||
So don't even try other targets that can be found in CMake documentation and don't forget to explicitly specify `Release` or `Debug` because CMake builds without a build configuration by default.
|
||||
|
||||
## Difference from _ndk-build_
|
||||
|
||||
* Latest GCC available in NDK is used as the default compiler;
|
||||
* `Release` builds with `-O3` instead of `-Os`;
|
||||
* `Release` builds without debug info (without `-g`) (because _ndk-build_ always creates a stripped version but cmake delays this for `install/strip` target);
|
||||
* `-fsigned-char` is added to compiler flags to make `char` signed by default as it is on x86/x86_64;
|
||||
* GCC's stack protector is not used neither in `Debug` nor `Release` configurations;
|
||||
* No builds for multiple platforms (e.g. building for both arm and x86 require to run cmake twice with different parameters);
|
||||
* No file level Neon via `.neon` suffix;
|
||||
|
||||
The following features of _ndk-build_ are not supported by the _android-cmake_ yet:
|
||||
|
||||
* `armeabi-v7a-hard` ABI
|
||||
* `libc++_static`/`libc++_shared` STL runtime
|
||||
|
||||
## Basic options
|
||||
|
||||
Similarly to the NDK build system _android-cmake_ allows to select between several compiler toolchains and target platforms. Most of the options can be set either as cmake arguments: `-D<NAME>=<VALUE>` or as environment variables:
|
||||
|
||||
* **ANDROID_NDK** - path to the Android NDK. If not set then _android-cmake_ will search for the most recent version of supported NDK in commonly used locations;
|
||||
* **ANDROID_ABI** - specifies the target Application Binary Interface (ABI). This option nearly matches to the APP_ABI variable used by ndk-build tool from Android NDK. If not specified then set to `armeabi-v7a`. Possible target names are:
|
||||
* `armeabi` - ARMv5TE based CPU with software floating point operations;
|
||||
* **`armeabi-v7a`** - ARMv7 based devices with hardware FPU instructions (VFPv3_D16);
|
||||
* `armeabi-v7a with NEON` - same as armeabi-v7a, but sets NEON as floating-point unit;
|
||||
* `armeabi-v7a with VFPV3` - same as armeabi-v7a, but sets VFPv3_D32 as floating-point unit;
|
||||
* `armeabi-v6 with VFP` - tuned for ARMv6 processors having VFP;
|
||||
* `x86` - IA-32 instruction set
|
||||
* `mips` - MIPS32 instruction set
|
||||
* `arm64-v8a` - ARMv8 AArch64 instruction set - only for NDK r10 and newer
|
||||
* `x86_64` - Intel64 instruction set (r1) - only for NDK r10 and newer
|
||||
* `mips64` - MIPS64 instruction set (r6) - only for NDK r10 and newer
|
||||
* **ANDROID_NATIVE_API_LEVEL** - level of android API to build for. Can be set either to full name (example: `android-8`) or a numeric value (example: `17`). The default API level depends on the target ABI:
|
||||
* `android-8` for ARM;
|
||||
* `android-9` for x86 and MIPS;
|
||||
* `android-21` for 64-bit ABIs.
|
||||
|
||||
Building for `android-L` is possible only when it is explicitly selected.
|
||||
* **ANDROID_TOOLCHAIN_NAME** - the name of compiler toolchain to be used. This option allows to select between different GCC and Clang versions. The list of possible values depends on the NDK version and will be printed by toolchain file if an invalid value is set. By default _android-cmake_ selects the most recent version of GCC which can build for specified `ANDROID_ABI`.
|
||||
|
||||
Example values are:
|
||||
* `aarch64-linux-android-4.9`
|
||||
* `aarch64-linux-android-clang3.5`
|
||||
* `arm-linux-androideabi-4.8`
|
||||
* `arm-linux-androideabi-4.9`
|
||||
* `arm-linux-androideabi-clang3.5`
|
||||
* `mips64el-linux-android-4.9`
|
||||
* `mipsel-linux-android-4.8`
|
||||
* `x86-4.9`
|
||||
* `x86_64-4.9`
|
||||
* etc.
|
||||
* **ANDROID_STL** - the name of C++ runtime to use. The default is `gnustl_static`.
|
||||
* `none` - do not configure the runtime.
|
||||
* `system` - use the default minimal system C++ runtime library.
|
||||
* Implies `-fno-rtti -fno-exceptions`.
|
||||
* `system_re` - use the default minimal system C++ runtime library.
|
||||
* Implies `-frtti -fexceptions`.
|
||||
* `gabi++_static` - use the GAbi++ runtime as a static library.
|
||||
* Implies `-frtti -fno-exceptions`.
|
||||
* Available for NDK r7 and newer.
|
||||
* `gabi++_shared` - use the GAbi++ runtime as a shared library.
|
||||
* Implies `-frtti -fno-exceptions`.
|
||||
* Available for NDK r7 and newer.
|
||||
* `stlport_static` - use the STLport runtime as a static library.
|
||||
* Implies `-fno-rtti -fno-exceptions` for NDK before r7.
|
||||
* Implies `-frtti -fno-exceptions` for NDK r7 and newer.
|
||||
* `stlport_shared` - use the STLport runtime as a shared library.
|
||||
* Implies `-fno-rtti -fno-exceptions` for NDK before r7.
|
||||
* Implies `-frtti -fno-exceptions` for NDK r7 and newer.
|
||||
* **`gnustl_static`** - use the GNU STL as a static library.
|
||||
* Implies `-frtti -fexceptions`.
|
||||
* `gnustl_shared` - use the GNU STL as a shared library.
|
||||
* Implies `-frtti -fno-exceptions`.
|
||||
* Available for NDK r7b and newer.
|
||||
* Silently degrades to `gnustl_static` if not available.
|
||||
* **NDK_CCACHE** - path to `ccache` executable. If not set then initialized from `NDK_CCACHE` environment variable.
|
||||
|
||||
## Advanced _android-cmake_ options
|
||||
|
||||
Normally _android-cmake_ users are not supposed to touch these variables but they might be useful to workaround some build issues:
|
||||
|
||||
* **ANDROID_FORCE_ARM_BUILD** = `OFF` - generate 32-bit ARM instructions instead of Thumb. Applicable only for arm ABIs and is forced to be `ON` for `armeabi-v6 with VFP`;
|
||||
* **ANDROID_NO_UNDEFINED** = `ON` - show all undefined symbols as linker errors;
|
||||
* **ANDROID_SO_UNDEFINED** = `OFF` - allow undefined symbols in shared libraries;
|
||||
* actually it is turned `ON` by default for NDK older than `r7`
|
||||
* **ANDROID_STL_FORCE_FEATURES** = `ON` - automatically configure rtti and exceptions support based on C++ runtime;
|
||||
* **ANDROID_NDK_LAYOUT** = `RELEASE` - inner layout of Android NDK, should be detected automatically. Possible values are:
|
||||
* `RELEASE` - public releases from Google;
|
||||
* `LINARO` - NDK from Linaro project;
|
||||
* `ANDROID` - NDK from AOSP.
|
||||
* **ANDROID_FUNCTION_LEVEL_LINKING** = `ON` - enables saparate putting each function and data items into separate sections and enable garbage collection of unused input sections at link time (`-fdata-sections -ffunction-sections -Wl,--gc-sections`);
|
||||
* **ANDROID_GOLD_LINKER** = `ON` - use gold linker with GCC 4.6 for NDK r8b and newer (only for ARM and x86);
|
||||
* **ANDROID_NOEXECSTACK** = `ON` - enables or disables stack execution protection code (`-Wl,-z,noexecstack`);
|
||||
* **ANDROID_RELRO** = `ON` - Enables RELRO - a memory corruption mitigation technique (`-Wl,-z,relro -Wl,-z,now`);
|
||||
* **ANDROID_LIBM_PATH** - path to `libm.so` (set to something like `$(TOP)/out/target/product/<product_name>/obj/lib/libm.so`) to workaround unresolved `sincos`.
|
||||
|
||||
## Fine-tuning `CMakeLists.txt` for _android-cmake_
|
||||
|
||||
### Recognizing Android build
|
||||
|
||||
_android-cmake_ defines `ANDROID` CMake variable which can be used to add Android-specific stuff:
|
||||
|
||||
if (ANDROID)
|
||||
message(STATUS "Hello from Android build!")
|
||||
endif()
|
||||
|
||||
The recommended way to identify ARM/MIPS/x86 architecture is examining `CMAKE_SYSTEM_PROCESSOR` which is set to the appropriate value:
|
||||
|
||||
* `armv5te` - for `armeabi` ABI
|
||||
* `armv6` - for `armeabi-v6 with VFP` ABI
|
||||
* `armv7-a` - for `armeabi-v7a`, `armeabi-v7a with VFPV3` and `armeabi-v7a with NEON` ABIs
|
||||
* `aarch64` - for `arm64-v8a` ABI
|
||||
* `i686` - for `x86` ABI
|
||||
* `x86_64` - for `x86_64` ABI
|
||||
* `mips` - for `mips` ABI
|
||||
* `mips64` - for `mips64` ABI
|
||||
|
||||
Other variables that are set by _android-cmake_ and can be used for the fine-grained build configuration are:
|
||||
|
||||
* `NEON` - set if target ABI supports Neon;
|
||||
* `ANDROID_NATIVE_API_LEVEL` - native Android API level we are building for (note: Java part of Andoid application can be built for another API level)
|
||||
* `ANDROID_NDK_RELEASE` - version of the Android NDK
|
||||
* `ANDROID_NDK_HOST_SYSTEM_NAME` - "windows", "linux-x86" or "darwin-x86" depending on the host platform
|
||||
* `ANDROID_RTTI` - set if rtti is enabled by the runtime
|
||||
* `ANDROID_EXCEPTIONS` - set if exceptions are enabled by the runtime
|
||||
|
||||
### Finding packages
|
||||
|
||||
When crosscompiling CMake `find_*` commands are normally expected to find libraries and packages belonging to the same build target. So _android-cmake_ configures CMake to search in Android-specific paths only and ignore your host system locations. So
|
||||
|
||||
find_package(ZLIB)
|
||||
|
||||
will surely find libz.so within the Android NDK.
|
||||
|
||||
However sometimes you need to locate a host package even when cross-compiling. For example you can be searching for your documentation generator. The _android-cmake_ recommends you to use `find_host_package` and `find_host_program` macro defined in the `android.toolchain.cmake`:
|
||||
|
||||
find_host_package(Doxygen)
|
||||
find_host_program(PDFLATEX pdflatex)
|
||||
|
||||
However this will break regular builds so instead of wrapping package search into platform-specific logic you can copy the following snippet into your project (put it after your top-level `project()` command):
|
||||
|
||||
# Search packages for host system instead of packages for target system
|
||||
# in case of cross compilation these macro should be defined by toolchain file
|
||||
if(NOT COMMAND find_host_package)
|
||||
macro(find_host_package)
|
||||
find_package(${ARGN})
|
||||
endmacro()
|
||||
endif()
|
||||
if(NOT COMMAND find_host_program)
|
||||
macro(find_host_program)
|
||||
find_program(${ARGN})
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
### Compiler flags recycling
|
||||
|
||||
Make sure to do the following in your scripts:
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${my_cxx_flags}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${my_cxx_flags}")
|
||||
|
||||
The flags will be prepopulated with critical flags, so don't loose them. Also be aware that _android-cmake_ also sets configuration-specific compiler and linker flags.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Building on Windows
|
||||
|
||||
First of all `cygwin` builds are **NOT supported** and will not be supported by _android-cmake_. To build natively on Windows you need a port of make but I recommend http://martine.github.io/ninja/ instead.
|
||||
|
||||
To build with Ninja you need:
|
||||
|
||||
* Ensure you are using CMake newer than 2.8.9;
|
||||
* Download the latest Ninja from https://github.com/martine/ninja/releases;
|
||||
* Put the `ninja.exe` into your PATH (or add path to `ninja.exe` to your PATH environment variable);
|
||||
* Pass `-GNinja` to `cmake` alongside with other arguments (or choose Ninja generator in `cmake-gui`).
|
||||
* Enjoy the fast native multithreaded build :)
|
||||
|
||||
But if you still want to stick to old make then:
|
||||
|
||||
* Get a Windows port of GNU Make:
|
||||
* Android NDK r7 (and newer) already has `make.exe` on board;
|
||||
* `mingw-make` should work as fine;
|
||||
* Download some other port. For example, this one: http://gnuwin32.sourceforge.net/packages/make.htm.
|
||||
* Add path to your `make.exe` to system PATH or always use full path;
|
||||
* Pass `-G"MinGW Makefiles"` and `-DCMAKE_MAKE_PROGRAM="<full/path/to/>make.exe"`
|
||||
* It must be `MinGW Makefiles` and not `Unix Makefiles` even if your `make.exe` is not a MinGW's make.
|
||||
* Run `make.exe` or `cmake --build .` for single-threaded build.
|
||||
|
||||
### Projects with assembler files
|
||||
|
||||
The _android-cmake_ should correctly handle projects with assembler sources (`*.s` or `*.S`). But if you still facing problems with assembler then try to upgrade your CMake to version newer than 2.8.5
|
||||
|
||||
## Copying
|
||||
|
||||
_android-cmake_ is distributed under the terms of [BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause)
|
||||
1693
externals/cmakemodules/android/android.toolchain.cmake
vendored
Normal file
1693
externals/cmakemodules/android/android.toolchain.cmake
vendored
Normal file
File diff suppressed because it is too large
Load Diff
211
externals/cmakemodules/android/ndk_links.md
vendored
Normal file
211
externals/cmakemodules/android/ndk_links.md
vendored
Normal file
@ -0,0 +1,211 @@
|
||||
|
||||
============== r1 ============== (dead links)
|
||||
|
||||
* http://dl.google.com/android/ndk/android-ndk-1.5_r1-windows.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-1.5_r1-darwin-x86.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-1.5_r1-linux-x86.zip
|
||||
|
||||
============== r2 ==============
|
||||
|
||||
* http://dl.google.com/android/ndk/android-ndk-1.6_r1-windows.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-1.6_r1-darwin-x86.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-1.6_r1-linux-x86.zip
|
||||
|
||||
============== r3 ==============
|
||||
|
||||
* http://dl.google.com/android/ndk/android-ndk-r3-windows.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r3-darwin-x86.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r3-linux-x86.zip
|
||||
|
||||
============== r4 ==============
|
||||
|
||||
* http://dl.google.com/android/ndk/android-ndk-r4-windows.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r4-darwin-x86.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r4-linux-x86.zip
|
||||
|
||||
============== r4b ==============
|
||||
|
||||
* http://dl.google.com/android/ndk/android-ndk-r4b-windows.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r4b-darwin-x86.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r4b-linux-x86.zip
|
||||
|
||||
============== r5 ==============
|
||||
|
||||
* http://dl.google.com/android/ndk/android-ndk-r5-windows.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r5-darwin-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r5-linux-x86.tar.bz2
|
||||
|
||||
============== r5b ==============
|
||||
|
||||
* http://dl.google.com/android/ndk/android-ndk-r5b-windows.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r5b-darwin-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r5b-linux-x86.tar.bz2
|
||||
|
||||
============== r5c ==============
|
||||
|
||||
* http://dl.google.com/android/ndk/android-ndk-r5c-windows.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r5c-darwin-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r5c-linux-x86.tar.bz2
|
||||
|
||||
============== r6 ==============
|
||||
|
||||
* http://dl.google.com/android/ndk/android-ndk-r6-windows.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r6-darwin-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r6-linux-x86.tar.bz2
|
||||
|
||||
============== r6b ==============
|
||||
|
||||
* http://dl.google.com/android/ndk/android-ndk-r6b-windows.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r6b-darwin-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r6b-linux-x86.tar.bz2
|
||||
|
||||
============== r7 ==============
|
||||
|
||||
* http://dl.google.com/android/ndk/android-ndk-r7-windows.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r7-darwin-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r7-linux-x86.tar.bz2
|
||||
|
||||
============== r7b ==============
|
||||
|
||||
* http://dl.google.com/android/ndk/android-ndk-r7b-windows.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r7b-darwin-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r7b-linux-x86.tar.bz2
|
||||
|
||||
============== r7c ==============
|
||||
|
||||
* http://dl.google.com/android/ndk/android-ndk-r7c-windows.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r7c-darwin-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r7c-linux-x86.tar.bz2
|
||||
|
||||
============== r8 ==============
|
||||
|
||||
* http://dl.google.com/android/ndk/android-ndk-r8-windows.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r8-darwin-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r8-linux-x86.tar.bz2
|
||||
|
||||
============== r8b ==============
|
||||
|
||||
* http://dl.google.com/android/ndk/android-ndk-r8b-windows.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r8b-darwin-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r8b-linux-x86.tar.bz2
|
||||
|
||||
============== r8c ==============
|
||||
|
||||
* http://dl.google.com/android/ndk/android-ndk-r8c-windows.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r8c-darwin-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r8c-linux-x86.tar.bz2
|
||||
|
||||
============== r8d ==============
|
||||
|
||||
* http://dl.google.com/android/ndk/android-ndk-r8d-windows.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r8d-darwin-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r8d-linux-x86.tar.bz2
|
||||
|
||||
============== r8e ==============
|
||||
|
||||
* http://dl.google.com/android/ndk/android-ndk-r8e-windows-x86.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r8e-windows-x86_64.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r8e-darwin-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r8e-darwin-x86_64.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r8e-linux-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r8e-linux-x86_64.tar.bz2
|
||||
|
||||
============== r9 ==============
|
||||
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9-windows-x86.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9-windows-x86-legacy-toolchains.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9-windows-x86_64.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9-windows-x86_64-legacy-toolchains.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9-darwin-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9-darwin-x86-legacy-toolchains.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9-darwin-x86_64.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9-darwin-x86_64-legacy-toolchains.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9-linux-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9-linux-x86-legacy-toolchains.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9-linux-x86_64.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9-linux-x86_64-legacy-toolchains.tar.bz2
|
||||
|
||||
============== r9b ==============
|
||||
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9b-windows-x86.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9b-windows-x86-legacy-toolchains.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9b-windows-x86_64.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9b-windows-x86_64-legacy-toolchains.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9b-darwin-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9b-darwin-x86-legacy-toolchains.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9b-darwin-x86_64.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9b-darwin-x86_64-legacy-toolchains.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9b-linux-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9b-linux-x86-legacy-toolchains.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9b-linux-x86_64.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9b-linux-x86_64-legacy-toolchains.tar.bz2
|
||||
|
||||
============== r9c ==============
|
||||
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9c-windows-x86.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9c-windows-x86_64.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9c-darwin-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9c-darwin-x86_64.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9c-linux-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9c-linux-x86_64.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9c-cxx-stl-libs-with-debugging-info.zip
|
||||
|
||||
============== r9d ==============
|
||||
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9d-windows-x86.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9d-windows-x86_64.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9d-darwin-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9d-darwin-x86_64.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9d-linux-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9d-linux-x86_64.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r9d-cxx-stl-libs-with-debug-info.zip
|
||||
|
||||
============== r10 ==============
|
||||
|
||||
* http://dl.google.com/android/ndk/android-ndk32-r10-windows-x86.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk32-r10-windows-x86_64.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk32-r10-darwin-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk32-r10-darwin-x86_64.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk32-r10-linux-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk32-r10-linux-x86_64.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk64-r10-windows-x86.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk64-r10-windows-x86_64.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk64-r10-darwin-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk64-r10-darwin-x86_64.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk64-r10-linux-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk64-r10-linux-x86_64.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r10-cxx-stl-libs-with-debug-info.zip
|
||||
|
||||
============== r10b ==============
|
||||
|
||||
* http://dl.google.com/android/ndk/android-ndk32-r10b-windows-x86.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk32-r10b-windows-x86_64.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk32-r10b-darwin-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk32-r10b-darwin-x86_64.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk32-r10b-linux-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk32-r10b-linux-x86_64.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk64-r10b-windows-x86.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk64-r10b-windows-x86_64.zip
|
||||
* http://dl.google.com/android/ndk/android-ndk64-r10b-darwin-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk64-r10b-darwin-x86_64.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk64-r10b-linux-x86.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk64-r10b-linux-x86_64.tar.bz2
|
||||
* http://dl.google.com/android/ndk/android-ndk-r10b-cxx-stl-libs-with-debug-info.zip
|
||||
|
||||
============== r10c ==============
|
||||
|
||||
* http://dl.google.com/android/ndk/android-ndk-r10c-windows-x86.exe
|
||||
* http://dl.google.com/android/ndk/android-ndk-r10c-windows-x86_64.exe
|
||||
* http://dl.google.com/android/ndk/android-ndk-r10c-darwin-x86.bin
|
||||
* http://dl.google.com/android/ndk/android-ndk-r10c-darwin-x86_64.bin
|
||||
* http://dl.google.com/android/ndk/android-ndk-r10c-linux-x86.bin
|
||||
* http://dl.google.com/android/ndk/android-ndk-r10c-linux-x86_64.bin
|
||||
|
||||
============== r10d ==============
|
||||
|
||||
* http://dl.google.com/android/ndk/android-ndk-r10d-windows-x86.exe
|
||||
* http://dl.google.com/android/ndk/android-ndk-r10d-windows-x86_64.exe
|
||||
* http://dl.google.com/android/ndk/android-ndk-r10d-darwin-x86.bin
|
||||
* http://dl.google.com/android/ndk/android-ndk-r10d-darwin-x86_64.bin
|
||||
* http://dl.google.com/android/ndk/android-ndk-r10d-linux-x86.bin
|
||||
* http://dl.google.com/android/ndk/android-ndk-r10d-linux-x86_64.bin
|
||||
334
externals/cmakemodules/ios/ios.toolchain.cmake
vendored
Normal file
334
externals/cmakemodules/ios/ios.toolchain.cmake
vendored
Normal file
@ -0,0 +1,334 @@
|
||||
# This file is part of the ios-cmake project. It was retrieved from
|
||||
# https://github.com/cristeab/ios-cmake.git, which is a fork of
|
||||
# https://code.google.com/p/ios-cmake/. Which in turn is based off of
|
||||
# the Platform/Darwin.cmake and Platform/UnixPaths.cmake files which
|
||||
# are included with CMake 2.8.4
|
||||
#
|
||||
# The ios-cmake project is licensed under the new BSD license.
|
||||
#
|
||||
# Copyright (c) 2014, Bogdan Cristea and LTE Engineering Software,
|
||||
# Kitware, Inc., Insight Software Consortium. All rights reserved.
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# This file is based off of the Platform/Darwin.cmake and
|
||||
# Platform/UnixPaths.cmake files which are included with CMake 2.8.4
|
||||
# It has been altered for iOS development.
|
||||
#
|
||||
# Updated by Alex Stewart (alexs.mac@gmail.com).
|
||||
# The following variables control the behaviour of this toolchain:
|
||||
#
|
||||
# IOS_PLATFORM: OS (default) or SIMULATOR or SIMULATOR64
|
||||
# OS = Build for iPhoneOS.
|
||||
# SIMULATOR = Build for x86 i386 iPhone Simulator.
|
||||
# SIMULATOR64 = Build for x86 x86_64 iPhone Simulator.
|
||||
# CMAKE_OSX_SYSROOT: Path to the iOS SDK to use. By default this is
|
||||
# automatically determined from IOS_PLATFORM and xcodebuild, but
|
||||
# can also be manually specified (although this should not be required).
|
||||
# CMAKE_IOS_DEVELOPER_ROOT: Path to the Developer directory for the iOS platform
|
||||
# being compiled for. By default this is automatically determined from
|
||||
# CMAKE_OSX_SYSROOT, but can also be manually specified (although this should
|
||||
# not be required).
|
||||
# ENABLE_BITCODE: (true|false) Enables or disables bitcode support. Default true
|
||||
#
|
||||
# This toolchain defines the following variables for use externally:
|
||||
#
|
||||
# XCODE_VERSION: Version number (not including Build version) of Xcode detected.
|
||||
# IOS_SDK_VERSION: Version of iOS SDK being used.
|
||||
# CMAKE_OSX_ARCHITECTURES: Architectures being compiled for (generated from
|
||||
# IOS_PLATFORM).
|
||||
#
|
||||
# This toolchain defines the following macros for use externally:
|
||||
#
|
||||
# set_xcode_property (TARGET XCODE_PROPERTY XCODE_VALUE XCODE_VARIANT)
|
||||
# A convenience macro for setting xcode specific properties on targets.
|
||||
# Available variants are: All, Release, RelWithDebInfo, Debug, MinSizeRel
|
||||
# example: set_xcode_property (myioslib IPHONEOS_DEPLOYMENT_TARGET "3.1" "all").
|
||||
#
|
||||
# find_host_package (PROGRAM ARGS)
|
||||
# A macro used to find executable programs on the host system, not within the
|
||||
# iOS environment. Thanks to the android-cmake project for providing the
|
||||
# command.
|
||||
|
||||
# Fix for PThread library not in path
|
||||
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
|
||||
set(CMAKE_HAVE_THREADS_LIBRARY 1)
|
||||
set(CMAKE_USE_WIN32_THREADS_INIT 0)
|
||||
set(CMAKE_USE_PTHREADS_INIT 1)
|
||||
|
||||
# Get the Xcode version being used.
|
||||
execute_process(COMMAND xcodebuild -version
|
||||
OUTPUT_VARIABLE XCODE_VERSION
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REGEX MATCH "Xcode [0-9\\.]+" XCODE_VERSION "${XCODE_VERSION}")
|
||||
string(REGEX REPLACE "Xcode ([0-9\\.]+)" "\\1" XCODE_VERSION "${XCODE_VERSION}")
|
||||
message(STATUS "Building with Xcode version: ${XCODE_VERSION}")
|
||||
# Default to building for iPhoneOS if not specified otherwise, and we cannot
|
||||
# determine the platform from the CMAKE_OSX_ARCHITECTURES variable. The use
|
||||
# of CMAKE_OSX_ARCHITECTURES is such that try_compile() projects can correctly
|
||||
# determine the value of IOS_PLATFORM from the root project, as
|
||||
# CMAKE_OSX_ARCHITECTURES is propagated to them by CMake.
|
||||
if (NOT DEFINED IOS_PLATFORM)
|
||||
if (CMAKE_OSX_ARCHITECTURES)
|
||||
if (CMAKE_OSX_ARCHITECTURES MATCHES ".*arm.*")
|
||||
set(IOS_PLATFORM "OS")
|
||||
elseif (CMAKE_OSX_ARCHITECTURES MATCHES "i386")
|
||||
set(IOS_PLATFORM "SIMULATOR")
|
||||
elseif (CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
|
||||
set(IOS_PLATFORM "SIMULATOR64")
|
||||
endif()
|
||||
endif()
|
||||
if (NOT IOS_PLATFORM)
|
||||
set(IOS_PLATFORM "OS")
|
||||
endif()
|
||||
endif()
|
||||
set(IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING
|
||||
"Type of iOS platform for which to build.")
|
||||
# Determine the platform name and architectures for use in xcodebuild commands
|
||||
# from the specified IOS_PLATFORM name.
|
||||
if (IOS_PLATFORM STREQUAL "OS")
|
||||
set(XCODE_IOS_PLATFORM iphoneos)
|
||||
set(IOS_ARCH arm64)
|
||||
elseif (IOS_PLATFORM STREQUAL "SIMULATOR")
|
||||
set(XCODE_IOS_PLATFORM iphonesimulator)
|
||||
set(IOS_ARCH i386)
|
||||
elseif(IOS_PLATFORM STREQUAL "SIMULATOR64")
|
||||
set(XCODE_IOS_PLATFORM iphonesimulator)
|
||||
set(IOS_ARCH x86_64)
|
||||
else()
|
||||
message(FATAL_ERROR "Invalid IOS_PLATFORM: ${IOS_PLATFORM}")
|
||||
endif()
|
||||
message(STATUS "Configuring iOS build for platform: ${IOS_PLATFORM}, "
|
||||
"architecture(s): ${IOS_ARCH}")
|
||||
# If user did not specify the SDK root to use, then query xcodebuild for it.
|
||||
if (NOT CMAKE_OSX_SYSROOT)
|
||||
execute_process(COMMAND xcodebuild -version -sdk ${XCODE_IOS_PLATFORM} Path
|
||||
OUTPUT_VARIABLE CMAKE_OSX_SYSROOT
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
message(STATUS "Using SDK: ${CMAKE_OSX_SYSROOT} for platform: ${IOS_PLATFORM}")
|
||||
endif()
|
||||
if (NOT EXISTS ${CMAKE_OSX_SYSROOT})
|
||||
message(FATAL_ERROR "Invalid CMAKE_OSX_SYSROOT: ${CMAKE_OSX_SYSROOT} "
|
||||
"does not exist.")
|
||||
endif()
|
||||
# Specify minimum version of deployment target.
|
||||
if (NOT DEFINED IOS_DEPLOYMENT_TARGET)
|
||||
# Unless specified, SDK version 8.0 is used by default as minimum target version.
|
||||
set(IOS_DEPLOYMENT_TARGET "8.0"
|
||||
CACHE STRING "Minimum iOS version to build for." )
|
||||
message(STATUS "Using the default min-version since IOS_DEPLOYMENT_TARGET not provided!")
|
||||
endif()
|
||||
# Use bitcode or not
|
||||
if (NOT DEFINED ENABLE_BITCODE)
|
||||
# Unless specified, enable bitcode support by default
|
||||
set(ENABLE_BITCODE FALSE CACHE BOOL "Wheter or not to enable bitcode")
|
||||
message(STATUS "Disabling bitcode support by default. ENABLE_BITCODE not provided!")
|
||||
endif()
|
||||
# Get the SDK version information.
|
||||
execute_process(COMMAND xcodebuild -sdk ${CMAKE_OSX_SYSROOT} -version SDKVersion
|
||||
OUTPUT_VARIABLE IOS_SDK_VERSION
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
# Find the Developer root for the specific iOS platform being compiled for
|
||||
# from CMAKE_OSX_SYSROOT. Should be ../../ from SDK specified in
|
||||
# CMAKE_OSX_SYSROOT. There does not appear to be a direct way to obtain
|
||||
# this information from xcrun or xcodebuild.
|
||||
if (NOT CMAKE_IOS_DEVELOPER_ROOT)
|
||||
get_filename_component(IOS_PLATFORM_SDK_DIR ${CMAKE_OSX_SYSROOT} PATH)
|
||||
get_filename_component(CMAKE_IOS_DEVELOPER_ROOT ${IOS_PLATFORM_SDK_DIR} PATH)
|
||||
endif()
|
||||
if (NOT EXISTS ${CMAKE_IOS_DEVELOPER_ROOT})
|
||||
message(FATAL_ERROR "Invalid CMAKE_IOS_DEVELOPER_ROOT: "
|
||||
"${CMAKE_IOS_DEVELOPER_ROOT} does not exist.")
|
||||
endif()
|
||||
message("CMAKE_IOS_DEVELOPER_ROOT: ${CMAKE_IOS_DEVELOPER_ROOT}")
|
||||
# Find the C & C++ compilers for the specified SDK.
|
||||
if (NOT CMAKE_C_COMPILER)
|
||||
execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find clang
|
||||
OUTPUT_VARIABLE CMAKE_C_COMPILER
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
message(STATUS "Using C compiler: ${CMAKE_C_COMPILER}")
|
||||
endif()
|
||||
if (NOT CMAKE_CXX_COMPILER)
|
||||
execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find clang++
|
||||
OUTPUT_VARIABLE CMAKE_CXX_COMPILER
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
message(STATUS "Using CXX compiler: ${CMAKE_CXX_COMPILER}")
|
||||
endif()
|
||||
# Find (Apple's) libtool.
|
||||
execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find libtool
|
||||
OUTPUT_VARIABLE IOS_LIBTOOL
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
message(STATUS "Using libtool: ${IOS_LIBTOOL}")
|
||||
# Configure libtool to be used instead of ar + ranlib to build static libraries.
|
||||
# This is required on Xcode 7+, but should also work on previous versions of
|
||||
# Xcode.
|
||||
set(CMAKE_C_CREATE_STATIC_LIBRARY
|
||||
"${IOS_LIBTOOL} -static -o <TARGET> <LINK_FLAGS> <OBJECTS> ")
|
||||
set(CMAKE_CXX_CREATE_STATIC_LIBRARY
|
||||
"${IOS_LIBTOOL} -static -o <TARGET> <LINK_FLAGS> <OBJECTS> ")
|
||||
# Get the version of Darwin (OS X) of the host.
|
||||
execute_process(COMMAND uname -r
|
||||
OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
# Standard settings.
|
||||
set(CMAKE_SYSTEM_NAME Darwin CACHE INTERNAL "")
|
||||
set(CMAKE_SYSTEM_VERSION ${IOS_SDK_VERSION} CACHE INTERNAL "")
|
||||
set(UNIX TRUE CACHE BOOL "")
|
||||
set(APPLE TRUE CACHE BOOL "")
|
||||
set(IOS TRUE CACHE BOOL "")
|
||||
set(CMAKE_AR ar CACHE FILEPATH "" FORCE)
|
||||
set(CMAKE_RANLIB ranlib CACHE FILEPATH "" FORCE)
|
||||
# Force unset of OS X-specific deployment target (otherwise autopopulated),
|
||||
# required as of cmake 2.8.10.
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "" CACHE STRING
|
||||
"Must be empty for iOS builds." FORCE)
|
||||
# Set the architectures for which to build.
|
||||
set(CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE STRING "Build architecture for iOS")
|
||||
# Skip the platform compiler checks for cross compiling.
|
||||
set(CMAKE_CXX_COMPILER_FORCED TRUE)
|
||||
set(CMAKE_CXX_COMPILER_WORKS TRUE)
|
||||
set(CMAKE_C_COMPILER_FORCED TRUE)
|
||||
set(CMAKE_C_COMPILER_WORKS TRUE)
|
||||
# All iOS/Darwin specific settings - some may be redundant.
|
||||
set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
|
||||
set(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib")
|
||||
set(CMAKE_SHARED_MODULE_PREFIX "lib")
|
||||
set(CMAKE_SHARED_MODULE_SUFFIX ".so")
|
||||
set(CMAKE_MODULE_EXISTS 1)
|
||||
set(CMAKE_DL_LIBS "")
|
||||
set(CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ")
|
||||
set(CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ")
|
||||
set(CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}")
|
||||
set(CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}")
|
||||
message(STATUS "Building for minimum iOS version: ${IOS_DEPLOYMENT_TARGET}"
|
||||
" (SDK version: ${IOS_SDK_VERSION})")
|
||||
# Note that only Xcode 7+ supports the newer more specific:
|
||||
# -m${XCODE_IOS_PLATFORM}-version-min flags, older versions of Xcode use:
|
||||
# -m(ios/ios-simulator)-version-min instead.
|
||||
if (IOS_PLATFORM STREQUAL "OS")
|
||||
if (XCODE_VERSION VERSION_LESS 7.0)
|
||||
set(XCODE_IOS_PLATFORM_VERSION_FLAGS
|
||||
"-mios-version-min=${IOS_DEPLOYMENT_TARGET}")
|
||||
else()
|
||||
# Xcode 7.0+ uses flags we can build directly from XCODE_IOS_PLATFORM.
|
||||
set(XCODE_IOS_PLATFORM_VERSION_FLAGS
|
||||
"-m${XCODE_IOS_PLATFORM}-version-min=${IOS_DEPLOYMENT_TARGET}")
|
||||
endif()
|
||||
else()
|
||||
# SIMULATOR or SIMULATOR64 both use -mios-simulator-version-min.
|
||||
set(XCODE_IOS_PLATFORM_VERSION_FLAGS
|
||||
"-mios-simulator-version-min=${IOS_DEPLOYMENT_TARGET}")
|
||||
endif()
|
||||
message(STATUS "Version flags set to: ${XCODE_IOS_PLATFORM_VERSION_FLAGS}")
|
||||
|
||||
if (ENABLE_BITCODE)
|
||||
set(BITCODE "-fembed-bitcode")
|
||||
message(STATUS "Enabling bitcode support.")
|
||||
else()
|
||||
set(BITCODE "")
|
||||
message(STATUS "Disabling bitcode support.")
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_FLAGS
|
||||
"${XCODE_IOS_PLATFORM_VERSION_FLAGS} ${BITCODE} -fobjc-abi-version=2 -fobjc-arc ${CMAKE_C_FLAGS}")
|
||||
# Hidden visibilty is required for C++ on iOS.
|
||||
set(CMAKE_CXX_FLAGS
|
||||
"${XCODE_IOS_PLATFORM_VERSION_FLAGS} ${BITCODE} ${CMAKE_CXX_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${BITCODE} ${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
set(CMAKE_C_LINK_FLAGS "${XCODE_IOS_PLATFORM_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}")
|
||||
set(CMAKE_CXX_LINK_FLAGS "${XCODE_IOS_PLATFORM_VERSION_FLAGS} -Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}")
|
||||
# In order to ensure that the updated compiler flags are used in try_compile()
|
||||
# tests, we have to forcibly set them in the CMake cache, not merely set them
|
||||
# in the local scope.
|
||||
list(APPEND VARS_TO_FORCE_IN_CACHE
|
||||
CMAKE_C_FLAGS
|
||||
CMAKE_CXX_FLAGS
|
||||
CMAKE_CXX_RELEASE
|
||||
CMAKE_C_LINK_FLAGS
|
||||
CMAKE_CXX_LINK_FLAGS)
|
||||
foreach(VAR_TO_FORCE ${VARS_TO_FORCE_IN_CACHE})
|
||||
set(${VAR_TO_FORCE} "${${VAR_TO_FORCE}}" CACHE STRING "" FORCE)
|
||||
endforeach()
|
||||
set(CMAKE_PLATFORM_HAS_INSTALLNAME 1)
|
||||
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -headerpad_max_install_names")
|
||||
set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -headerpad_max_install_names")
|
||||
set(CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,")
|
||||
set(CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,")
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a")
|
||||
# Hack: if a new cmake (which uses CMAKE_INSTALL_NAME_TOOL) runs on an old
|
||||
# build tree (where install_name_tool was hardcoded) and where
|
||||
# CMAKE_INSTALL_NAME_TOOL isn't in the cache and still cmake didn't fail in
|
||||
# CMakeFindBinUtils.cmake (because it isn't rerun) hardcode
|
||||
# CMAKE_INSTALL_NAME_TOOL here to install_name_tool, so it behaves as it did
|
||||
# before, Alex.
|
||||
if (NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
|
||||
find_program(CMAKE_INSTALL_NAME_TOOL install_name_tool)
|
||||
endif (NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
|
||||
# Set the find root to the iOS developer roots and to user defined paths.
|
||||
set(CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_OSX_SYSROOT}
|
||||
${CMAKE_PREFIX_PATH} CACHE string "iOS find search path root" FORCE)
|
||||
# Default to searching for frameworks first.
|
||||
set(CMAKE_FIND_FRAMEWORK FIRST)
|
||||
# Set up the default search directories for frameworks.
|
||||
set(CMAKE_SYSTEM_FRAMEWORK_PATH
|
||||
${CMAKE_OSX_SYSROOT}/System/Library/Frameworks
|
||||
${CMAKE_OSX_SYSROOT}/System/Library/PrivateFrameworks
|
||||
${CMAKE_OSX_SYSROOT}/Developer/Library/Frameworks)
|
||||
# Only search the specified iOS SDK, not the remainder of the host filesystem.
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
# This little macro lets you set any XCode specific property.
|
||||
macro(set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE XCODE_RELVERSION)
|
||||
set(XCODE_RELVERSION_I "${XCODE_RELVERSION}")
|
||||
if (XCODE_RELVERSION_I STREQUAL "All")
|
||||
set_property(TARGET ${TARGET} PROPERTY
|
||||
XCODE_ATTRIBUTE_${XCODE_PROPERTY} "${XCODE_VALUE}")
|
||||
else()
|
||||
set_property(TARGET ${TARGET} PROPERTY
|
||||
XCODE_ATTRIBUTE_${XCODE_PROPERTY}[variant=${XCODE_RELVERSION_I}] "${XCODE_VALUE}")
|
||||
endif()
|
||||
endmacro(set_xcode_property)
|
||||
# This macro lets you find executable programs on the host system.
|
||||
macro(find_host_package)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER)
|
||||
set(IOS FALSE)
|
||||
find_package(${ARGN})
|
||||
set(IOS TRUE)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
endmacro(find_host_package)
|
||||
17
externals/cmakemodules/linux/LinuxAarch64.cmake
vendored
Normal file
17
externals/cmakemodules/linux/LinuxAarch64.cmake
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR aarch64)
|
||||
set(TARGET_ABI "linux-gnu")
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE aarch64-linux-gnu)
|
||||
|
||||
set(CMAKE_C_COMPILER aarch64-${TARGET_ABI}-gcc)
|
||||
set(CMAKE_CXX_COMPILER aarch64-${TARGET_ABI}-g++)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH "/usr/aarch64-${TARGET_ABI}")
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
||||
find_program(GCC_LOCATION ${CMAKE_C_COMPILER})
|
||||
if(NOT GCC_LOCATION)
|
||||
message(FATAL_ERROR "Failed to find ${CMAKE_C_COMPILER}")
|
||||
endif()
|
||||
43
externals/cmakemodules/linux/LinuxCrossToolchain.aarch64-unknown-linux-gnueabihf.cmake
vendored
Normal file
43
externals/cmakemodules/linux/LinuxCrossToolchain.aarch64-unknown-linux-gnueabihf.cmake
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
IF(NOT $ENV{PM_PACKAGES_ROOT} EQUAL "")
|
||||
SET(CMAKE_SYSTEM_NAME Linux)
|
||||
|
||||
INCLUDE(CMakeForceCompiler)
|
||||
|
||||
SET(LINUX_ROOT $ENV{PM_CLANGCROSSCOMPILE_PATH}/aarch64-unknown-linux-gnueabi)
|
||||
STRING(REGEX REPLACE "\\\\" "/" LINUX_ROOT ${LINUX_ROOT})
|
||||
|
||||
message (STATUS "LINUX_ROOT is '${LINUX_ROOT}'")
|
||||
SET(ARCHITECTURE_TRIPLE aarch64-unknown-linux-gnueabi)
|
||||
SET(CMAKE_SYSTEM_PROCESSOR aarch64)
|
||||
|
||||
SET(CMAKE_CROSSCOMPILING TRUE)
|
||||
SET(CMAKE_SYSTEM_NAME Linux)
|
||||
SET(CMAKE_SYSTEM_VERSION 1)
|
||||
|
||||
# sysroot
|
||||
SET(CMAKE_SYSROOT ${LINUX_ROOT})
|
||||
|
||||
SET(CMAKE_LIBRARY_ARCHITECTURE ${ARCHITECTURE_TRIPLE})
|
||||
|
||||
# specify the cross compiler
|
||||
CMAKE_FORCE_C_COMPILER ("${CMAKE_SYSROOT}/bin/clang.exe" Clang)
|
||||
SET(CMAKE_C_COMPILER ${CMAKE_SYSROOT}/bin/clang.exe)
|
||||
SET(CMAKE_C_COMPILER_TARGET ${ARCHITECTURE_TRIPLE})
|
||||
SET(CMAKE_C_FLAGS "-target ${ARCHITECTURE_TRIPLE} --sysroot ${LINUX_ROOT} ")
|
||||
|
||||
CMAKE_FORCE_CXX_COMPILER ("${CMAKE_SYSROOT}/bin/clang++.exe" Clang)
|
||||
SET(CMAKE_CXX_COMPILER ${CMAKE_SYSROOT}/bin/clang++.exe)
|
||||
SET(CMAKE_CXX_COMPILER_TARGET ${ARCHITECTURE_TRIPLE})
|
||||
SET(CMAKE_CXX_FLAGS "-target ${ARCHITECTURE_TRIPLE} --sysroot ${LINUX_ROOT} ")
|
||||
|
||||
SET(CMAKE_FIND_ROOT_PATH ${LINUX_ROOT})
|
||||
#set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY) # hoping to force it to use ar
|
||||
#set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
#set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
||||
SET(CMAKE_MAKE_PROGRAM "$ENV{PM_MINGW_PATH}/bin/mingw32-make.exe")
|
||||
ELSE()
|
||||
MESSAGE("PM_PACKAGES_ROOT variable not defined!")
|
||||
ENDIF()
|
||||
|
||||
|
||||
38
externals/cmakemodules/linux/LinuxCrossToolchain.arm-unknown-linux-gnueabihf.cmake
vendored
Normal file
38
externals/cmakemodules/linux/LinuxCrossToolchain.arm-unknown-linux-gnueabihf.cmake
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
IF(NOT $ENV{LINUX_ROOT} EQUAL "")
|
||||
SET(CMAKE_SYSTEM_NAME Linux)
|
||||
|
||||
# FIXME: fix Linux toolchains to support architectures
|
||||
SET(LINUX_ROOT $ENV{UE_SDKS_ROOT}/HostWin64/Linux_x64/arm-unknown-linux-gnueabihf_v5_clang-3.5.0-ld-2.23.1-glibc-2.13/toolchain)
|
||||
STRING(REGEX REPLACE "\\\\" "/" LINUX_ROOT ${LINUX_ROOT})
|
||||
|
||||
message (STATUS "LINUX_ROOT is '${LINUX_ROOT}'")
|
||||
SET(ARCHITECTURE_TRIPLE arm-unknown-linux-gnueabihf)
|
||||
SET(CMAKE_SYSTEM_PROCESSOR aarch64)
|
||||
|
||||
SET(CMAKE_CROSSCOMPILING TRUE)
|
||||
SET(CMAKE_SYSTEM_NAME Linux)
|
||||
SET(CMAKE_SYSTEM_VERSION 1)
|
||||
|
||||
# sysroot
|
||||
SET(CMAKE_SYSROOT ${LINUX_ROOT})
|
||||
|
||||
SET(CMAKE_LIBRARY_ARCHITECTURE ${ARCHITECTURE_TRIPLE})
|
||||
|
||||
# specify the cross compiler
|
||||
SET(CMAKE_C_COMPILER ${CMAKE_SYSROOT}/bin/clang.exe)
|
||||
SET(CMAKE_C_COMPILER_TARGET ${ARCHITECTURE_TRIPLE})
|
||||
SET(CMAKE_C_FLAGS "-target ${ARCHITECTURE_TRIPLE} --sysroot ${LINUX_ROOT} ")
|
||||
|
||||
SET(CMAKE_CXX_COMPILER ${CMAKE_SYSROOT}/bin/clang++.exe)
|
||||
SET(CMAKE_CXX_COMPILER_TARGET ${ARCHITECTURE_TRIPLE})
|
||||
SET(CMAKE_CXX_FLAGS "-target ${ARCHITECTURE_TRIPLE} --sysroot ${LINUX_ROOT} ")
|
||||
|
||||
SET(CMAKE_FIND_ROOT_PATH ${LINUX_ROOT})
|
||||
#set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY) # hoping to force it to use ar
|
||||
#set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
#set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
ELSE()
|
||||
MESSAGE("LINUX_ROOT environment variable not defined!")
|
||||
ENDIF()
|
||||
|
||||
|
||||
43
externals/cmakemodules/linux/LinuxCrossToolchain.x86_64-unknown-linux-gnu.cmake
vendored
Normal file
43
externals/cmakemodules/linux/LinuxCrossToolchain.x86_64-unknown-linux-gnu.cmake
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
IF(NOT $ENV{PM_PACKAGES_ROOT} EQUAL "")
|
||||
SET(CMAKE_SYSTEM_NAME Linux)
|
||||
|
||||
INCLUDE(CMakeForceCompiler)
|
||||
|
||||
SET(LINUX_ROOT $ENV{PM_CLANGCROSSCOMPILE_PATH}/x86_64-unknown-linux-gnu)
|
||||
STRING(REGEX REPLACE "\\\\" "/" LINUX_ROOT ${LINUX_ROOT})
|
||||
|
||||
message (STATUS "LINUX_ROOT is '${LINUX_ROOT}'")
|
||||
SET(ARCHITECTURE_TRIPLE x86_64-unknown-linux-gnu)
|
||||
SET(CMAKE_SYSTEM_PROCESSOR x86_64)
|
||||
|
||||
SET(CMAKE_CROSSCOMPILING TRUE)
|
||||
SET(CMAKE_SYSTEM_NAME Linux)
|
||||
SET(CMAKE_SYSTEM_VERSION 1)
|
||||
|
||||
# sysroot
|
||||
SET(CMAKE_SYSROOT ${LINUX_ROOT})
|
||||
|
||||
SET(CMAKE_LIBRARY_ARCHITECTURE ${ARCHITECTURE_TRIPLE})
|
||||
|
||||
# specify the cross compiler
|
||||
CMAKE_FORCE_C_COMPILER ("${CMAKE_SYSROOT}/bin/clang.exe" Clang)
|
||||
SET(CMAKE_C_COMPILER ${CMAKE_SYSROOT}/bin/clang.exe)
|
||||
SET(CMAKE_C_COMPILER_TARGET ${ARCHITECTURE_TRIPLE})
|
||||
SET(CMAKE_C_FLAGS "-target ${ARCHITECTURE_TRIPLE} --sysroot ${LINUX_ROOT} ")
|
||||
|
||||
CMAKE_FORCE_CXX_COMPILER ("${CMAKE_SYSROOT}/bin/clang++.exe" Clang)
|
||||
SET(CMAKE_CXX_COMPILER ${CMAKE_SYSROOT}/bin/clang++.exe)
|
||||
SET(CMAKE_CXX_COMPILER_TARGET ${ARCHITECTURE_TRIPLE})
|
||||
SET(CMAKE_CXX_FLAGS "-target ${ARCHITECTURE_TRIPLE} --sysroot ${LINUX_ROOT} ")
|
||||
|
||||
SET(CMAKE_FIND_ROOT_PATH ${LINUX_ROOT})
|
||||
#set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY) # hoping to force it to use ar
|
||||
#set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
#set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
||||
SET(CMAKE_MAKE_PROGRAM "$ENV{PM_MINGW_PATH}/bin/mingw32-make.exe")
|
||||
ELSE()
|
||||
MESSAGE("PM_PACKAGES_ROOT variable not defined!")
|
||||
ENDIF()
|
||||
|
||||
|
||||
34
externals/cmakemodules/template/PxIncludeTemplate.h
vendored
Normal file
34
externals/cmakemodules/template/PxIncludeTemplate.h
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
|
||||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
|
||||
|
||||
|
||||
#ifndef PX_${HEADER_GUARD_NAME}
|
||||
#define PX_${HEADER_GUARD_NAME}
|
||||
|
||||
${HEADER_CONTENT}
|
||||
|
||||
#endif // PX_${HEADER_GUARD_NAME}
|
||||
Reference in New Issue
Block a user