scan_build=scan-build
fi
- nextCommand="\"$__RepoRootDir/eng/native/gen-buildsys.sh\" \"$cmakeDir\" \"$intermediatesDir\" $platformArch $__Compiler \"$__CompilerMajorVersion\" \"$__CompilerMinorVersion\" $__BuildType \"$generator\" $scan_build $cmakeArgs"
+ nextCommand="\"$__RepoRootDir/eng/native/gen-buildsys.sh\" \"$cmakeDir\" \"$intermediatesDir\" $platformArch $__Compiler $__BuildType \"$generator\" $scan_build $cmakeArgs"
echo "Invoking $nextCommand"
eval $nextCommand
;;
clang*|-clang*)
- __Compiler=clang
- # clangx.y or clang-x.y
- version="$(echo "$lowerI" | tr -d '[:alpha:]-=')"
- parts=(${version//./ })
- __CompilerMajorVersion="${parts[0]}"
- __CompilerMinorVersion="${parts[1]}"
- if [[ -z "$__CompilerMinorVersion" && "$__CompilerMajorVersion" -le 6 ]]; then
- __CompilerMinorVersion=0;
- fi
+ __Compiler="$lowerI"
;;
cmakeargs|-cmakeargs)
;;
gcc*|-gcc*)
- __Compiler=gcc
- # gccx.y or gcc-x.y
- version="$(echo "$lowerI" | tr -d '[:alpha:]-=')"
- parts=(${version//./ })
- __CompilerMajorVersion="${parts[0]}"
- __CompilerMinorVersion="${parts[1]}"
+ __Compiler="$lowerI"
;;
keepnativesymbols|-keepnativesymbols)
CROSSCOMPILE=1
export CROSSCOMPILE
# Darwin that doesn't use rootfs
- if [[ ! -n "$ROOTFS_DIR" && "$platform" != "Darwin" ]]; then
+ if [[ -z "$ROOTFS_DIR" && "$platform" != "Darwin" ]]; then
ROOTFS_DIR="$__RepoRootDir/.tools/rootfs/$__BuildArch"
export ROOTFS_DIR
fi
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0")
add_compile_options(-arch arm64)
elseif(CLR_CMAKE_HOST_ARCH_AMD64)
- set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13")
+ set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14")
add_compile_options(-arch x86_64)
else()
clr_unknown_arch()
# disable C++ RTTI
# /GR is added by default by CMake, so remove it manually.
- string(REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+ string(REPLACE "/GR " " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/FC>) # use full pathnames in diagnostics
get_filename_component(CLR_REPO_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../.. ABSOLUTE)
set(CLR_ENG_NATIVE_DIR ${CMAKE_CURRENT_LIST_DIR})
get_filename_component(CLR_SRC_NATIVE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../src/native ABSOLUTE)
-get_filename_component(CLR_SRC_LIBS_NATIVE_DIR ${CMAKE_CURRENT_LIST_DIR}/../../src/libraries/Native ABSOLUTE)
set (CLR_ARTIFACTS_OBJ_DIR "${CLR_REPO_ROOT_DIR}/artifacts/obj")
set(VERSION_HEADER_PATH "${CLR_ARTIFACTS_OBJ_DIR}/_version.h")
set(VERSION_FILE_PATH "${CLR_ARTIFACTS_OBJ_DIR}/_version.c")
set(${IncludeDirectories} ${INC_DIRECTORIES} PARENT_SCOPE)
endfunction(get_include_directories_asm)
+# Adds prefix to paths list
+function(addprefix var prefix list)
+ set(f)
+ foreach(i ${list})
+ set(f ${f} ${prefix}/${i})
+ endforeach()
+ set(${var} ${f} PARENT_SCOPE)
+endfunction()
+
# Finds and returns unwind libs
function(find_unwind_libs UnwindLibs)
if(CLR_CMAKE_HOST_ARCH_ARM)
endif()
endfunction()
+function(install_static_library targetName destination component)
+ if (NOT "${component}" STREQUAL "${targetName}")
+ get_property(definedComponents GLOBAL PROPERTY CLR_CMAKE_COMPONENTS)
+ list(FIND definedComponents "${component}" componentIdx)
+ if (${componentIdx} EQUAL -1)
+ message(FATAL_ERROR "The ${component} component is not defined. Add a call to `add_component(${component})` to define the component in the build.")
+ endif()
+ add_dependencies(${component} ${targetName})
+ endif()
+ install (TARGETS ${targetName} DESTINATION ${destination} COMPONENT ${component})
+ if (WIN32)
+ set_target_properties(${targetName} PROPERTIES
+ COMPILE_PDB_NAME "${targetName}"
+ COMPILE_PDB_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}"
+ )
+ install (FILES "$<TARGET_FILE_DIR:${targetName}>/${targetName}.pdb" DESTINATION ${destination} COMPONENT ${component})
+ endif()
+endfunction()
+
# install_clr(TARGETS targetName [targetName2 ...] [DESTINATIONS destination [destination2 ...]] [COMPONENT componentName])
function(install_clr)
set(multiValueArgs TARGETS DESTINATIONS)
if [[ "$#" -lt 4 ]]; then
echo "Usage..."
- echo "gen-buildsys.sh <path to top level CMakeLists.txt> <path to intermediate directory> <Architecture> <compiler> <compiler major version> <compiler minor version> [build flavor] [ninja] [scan-build] [cmakeargs]"
+ echo "gen-buildsys.sh <path to top level CMakeLists.txt> <path to intermediate directory> <Architecture> <compiler> [build flavor] [ninja] [scan-build] [cmakeargs]"
echo "Specify the path to the top level CMake file."
echo "Specify the path that the build system files are generated in."
echo "Specify the target architecture."
echo "Specify the name of compiler (clang or gcc)."
- echo "Specify the major version of compiler."
- echo "Specify the minor version of compiler."
echo "Optionally specify the build configuration (flavor.) Defaults to DEBUG."
echo "Optionally specify 'scan-build' to enable build with clang static analyzer."
echo "Use the Ninja generator instead of the Unix Makefiles generator."
build_arch="$3"
compiler="$4"
-majorVersion="$5"
-minorVersion="$6"
if [[ "$compiler" != "default" ]]; then
nativescriptroot="$( cd -P "$scriptroot/../common/native" && pwd )"
- source "$nativescriptroot/init-compiler.sh" "$nativescriptroot" "$build_arch" "$compiler" "$majorVersion" "$minorVersion"
+ source "$nativescriptroot/init-compiler.sh" "$nativescriptroot" "$build_arch" "$compiler"
CCC_CC="$CC"
CCC_CXX="$CXX"
generator="Unix Makefiles"
__UnprocessedCMakeArgs=""
-for i in "${@:7}"; do
+for i in "${@:5}"; do
upperI="$(echo "$i" | tr "[:lower:]" "[:upper:]")"
case "$upperI" in
# Possible build types are DEBUG, CHECKED, RELEASE, RELWITHDEBINFO.
# We have forced __PortableBuild=0. This is because -portablebuld
# has been passed as false.
if (( isPortable == 0 )); then
- if [ "${ID}" = "rhel" ] || [ "${ID}" = "rocky" ]; then
+ if [[ "${ID}" == "rhel" || "${ID}" == "rocky" ]]; then
# remove the last version digit
VERSION_ID="${VERSION_ID%.*}"
fi
<Project>
<PropertyGroup>
<StaticLibPrefix>lib</StaticLibPrefix>
+ <ExeSuffix Condition="'$(HostOS)' == 'windows'">.exe</ExeSuffix>
</PropertyGroup>
<!-- Add path globs specific to native binaries to exclude unnecessary files from packages. -->
<Choose>
<When Condition="$(PackageRID.StartsWith('win'))">
<PropertyGroup>
- <ExeSuffix>.exe</ExeSuffix>
<LibSuffix>.dll</LibSuffix>
<StaticLibSuffix>.lib</StaticLibSuffix>
<SymbolsSuffix>.pdb</SymbolsSuffix>
</PropertyGroup>
</When>
- <When Condition="$(PackageRID.StartsWith('osx'))">
+ <When Condition="$(PackageRID.StartsWith('osx')) or $(PackageRID.StartsWith('maccatalyst')) or $(PackageRID.StartsWith('ios')) or $(PackageRID.StartsWith('tvos'))">
<PropertyGroup>
- <LibPrefix Condition=" '$(SkipLibraryPrefixFromUnix)' == '' ">lib</LibPrefix>
+ <LibPrefix>lib</LibPrefix>
<LibSuffix>.dylib</LibSuffix>
<StaticLibSuffix>.a</StaticLibSuffix>
<SymbolsSuffix>.dwarf</SymbolsSuffix>
</When>
<When Condition="$(PackageRID.StartsWith('android'))">
<PropertyGroup>
- <LibPrefix Condition=" '$(SkipLibraryPrefixFromUnix)' == '' ">lib</LibPrefix>
+ <LibPrefix>lib</LibPrefix>
<LibSuffix>.so</LibSuffix>
<StaticLibSuffix>.a</StaticLibSuffix>
<!--symbols included in .so, like Linux, but can be generated externally and if so, uses .debug ext-->
</When>
<Otherwise>
<PropertyGroup>
- <LibPrefix Condition=" '$(SkipLibraryPrefixFromUnix)' == '' ">lib</LibPrefix>
+ <LibPrefix>lib</LibPrefix>
<LibSuffix>.so</LibSuffix>
<StaticLibSuffix>.a</StaticLibSuffix>
<SymbolsSuffix>.dbg</SymbolsSuffix>
macro(add_definitions)
list(APPEND ADDED_COMPILE_OPTIONS ${ARGV})
endmacro()
+ macro(include_directories)
+ cmake_parse_arguments(INCLUDE_DIRECTORIES "" "" "SYSTEM" ${ARGN})
+ if (INCLUDE_DIRECTORIES_SYSTEM)
+ foreach(dir ${INCLUDE_DIRECTORIES_SYSTEM})
+ list(APPEND ADDED_COMPILE_OPTIONS "-isystem ${dir}")
+ endforeach()
+ else()
+ foreach(arg IN LISTS ARGN)
+ list(APPEND ADDED_COMPILE_OPTIONS "-I${arg}")
+ endforeach()
+ endif()
+ endmacro()
endif()
include(${CMAKE_CURRENT_LIST_DIR}/../common/cross/toolchain.cmake)
message("<target-triple>${TOOLCHAIN}</target-triple>")
message("<linker-args>${CMAKE_SHARED_LINKER_FLAGS_INIT}</linker-args>")
message("<compiler-args>${ADDED_COMPILE_OPTIONS}</compiler-args>")
-message("</toolchain-info>")
\ No newline at end of file
+message("</toolchain-info>")