diff --git a/src/corehost/build.sh b/src/corehost/build.sh index 7717bdc15..d08723c41 100755 --- a/src/corehost/build.sh +++ b/src/corehost/build.sh @@ -4,6 +4,19 @@ # I really don't know, but it doesn't work when I do that. Something about SIGCHLD not getting from clang to cmake or something. # -anurse +usage() +{ + echo "Usage: $0 --arch --rid [--xcompiler ]" + echo "" + echo "Options:" + echo " --arch Target Architecture (amd64, x86, arm)" + echo " --rid Target Runtime Identifier" + echo " --xcompiler Cross Compiler when the target is arm" + echo " e.g.) /usr/bin/arm-linux-gnueabi-g++-4.7" + + exit 1 +} + set -e SOURCE="${BASH_SOURCE[0]}" @@ -16,6 +29,7 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" __build_arch= __runtime_id= +__CrossBuild=0 while [ "$1" != "" ]; do lowerI="$(echo $1 | awk '{print tolower($0)}')" @@ -32,6 +46,11 @@ while [ "$1" != "" ]; do shift __runtime_id=$1 ;; + --xcompiler) + shift + __CrossCompiler="$1" + __CrossBuild=1 + ;; *) echo "Unknown argument to build.sh $1"; exit 1 esac @@ -47,6 +66,9 @@ case $__build_arch in x86) __define=-DCLI_CMAKE_PLATFORM_ARCH_I386=1 ;; + arm) + __define=-DCLI_CMAKE_PLATFORM_ARCH_ARM=1 + ;; *) echo "Unknown architecture $__build_arch"; exit 1 ;; @@ -55,5 +77,9 @@ __cmake_defines="${__cmake_defines} ${__define}" echo "Building Corehost from $DIR to $(pwd)" -cmake "$DIR" -G "Unix Makefiles" $__cmake_defines -DCLI_CMAKE_RUNTIME_ID:STRING=$__runtime_id +if [ $__CrossBuild == 1 ]; then + cmake "$DIR" -G "Unix Makefiles" $__cmake_defines -DCLI_CMAKE_RUNTIME_ID:STRING=$__runtime_id -DCMAKE_CXX_COMPILER="$__CrossCompiler" +else + cmake "$DIR" -G "Unix Makefiles" $__cmake_defines -DCLI_CMAKE_RUNTIME_ID:STRING=$__runtime_id +fi make diff --git a/src/corehost/cli/json/casablanca/include/cpprest/json.h b/src/corehost/cli/json/casablanca/include/cpprest/json.h index 704cbfad9..7490c866e 100755 --- a/src/corehost/cli/json/casablanca/include/cpprest/json.h +++ b/src/corehost/cli/json/casablanca/include/cpprest/json.h @@ -313,7 +313,7 @@ public: /// Field names associated with JSON values /// Whether to preserve the original order of the fields /// A non-empty JSON object value - static _ASYNCRTIMP json::value __cdecl object(std::vector> fields, bool keep_order = false); + static _ASYNCRTIMP json::value __cdecl object(std::vector> fields, bool keep_order = false); /// /// Creates an empty JSON array diff --git a/src/corehost/cli/json/casablanca/src/json/json.cpp b/src/corehost/cli/json/casablanca/src/json/json.cpp index 77380460c..c5d45544d 100644 --- a/src/corehost/cli/json/casablanca/src/json/json.cpp +++ b/src/corehost/cli/json/casablanca/src/json/json.cpp @@ -237,7 +237,7 @@ web::json::value web::json::value::object(bool keep_order) ); } -web::json::value web::json::value::object(std::vector> fields, bool keep_order) +web::json::value web::json::value::object(std::vector> fields, bool keep_order) { std::unique_ptr ptr = utility::details::make_unique(std::move(fields), keep_order); return web::json::value(std::move(ptr) diff --git a/src/corehost/cli/setup.cmake b/src/corehost/cli/setup.cmake index d3e65f55d..27b924b15 100644 --- a/src/corehost/cli/setup.cmake +++ b/src/corehost/cli/setup.cmake @@ -41,6 +41,8 @@ if(CLI_CMAKE_PLATFORM_ARCH_I386) add_definitions(-D_TARGET_X86_=1) elseif(CLI_CMAKE_PLATFORM_ARCH_AMD64) add_definitions(-D_TARGET_AMD64_=1) +elseif(CLI_CMAKE_PLATFORM_ARCH_ARM) + add_definitions(-D_TARGET_ARM_=1) else() message(FATAL_ERROR "Unknown target architecture") endif() diff --git a/src/corehost/common/utils.cpp b/src/corehost/common/utils.cpp index 1587e7df5..f5aafd976 100644 --- a/src/corehost/common/utils.cpp +++ b/src/corehost/common/utils.cpp @@ -121,6 +121,8 @@ const pal::char_t* get_arch() return _X("x64"); #elif _TARGET_X86_ return _X("x86"); +#elif _TARGET_ARM_ + return _X("arm"); #else #error "Unknown target" #endif