{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/59946070","id":59946070,"diff_hunk":"@@ -1,59 +1,119 @@\n # Require at least version 2.8.12 of CMake\n cmake_minimum_required(VERSION 2.8.12)\n \n+if(CMAKE_VERSION VERSION_EQUAL 3.0 OR CMAKE_VERSION VERSION_GREATER 3.0)\n+    cmake_policy(SET CMP0042 NEW)\n+endif()\n+\n # Set the project name\n project(CoreCLR)\n \n-set(CORECLR_SET_RPATH ON)\n+# Include cmake functions\n+include(functions.cmake)\n+\n+# Set commonly used directory names\n+set(CLR_DIR ${CMAKE_CURRENT_SOURCE_DIR})\n+set(VM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/vm)\n+set(GENERATED_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/src/inc)\n \n+set(CORECLR_SET_RPATH ON)\n if(CORECLR_SET_RPATH)\n     # Enable @rpath support for shared libraries.\n     set(MACOSX_RPATH ON)\n endif(CORECLR_SET_RPATH)\n \n-if(CMAKE_VERSION VERSION_EQUAL 3.0 OR CMAKE_VERSION VERSION_GREATER 3.0)\n-    cmake_policy(SET CMP0042 NEW)\n+OPTION(CMAKE_ENABLE_CODE_COVERAGE \"Enable code coverage\" OFF)\n+\n+# Ensure that python is present\n+find_program(PYTHON python)\n+if (PYTHON STREQUAL \"PYTHON-NOTFOUND\")\n+    message(FATAL_ERROR \"PYTHON not found: Please install Python 2.7.9 or later from https://www.python.org/downloads/\")\n endif()\n \n-set(CLR_DIR ${CMAKE_CURRENT_SOURCE_DIR})\n-set(VM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/vm)\n-set(GENERATED_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/src/inc)\n+# Ensure other tools are present\n+if(WIN32)\n+    enable_language(ASM_MASM)\n \n-function(clr_unknown_arch)\n-    if (WIN32)\n-        message(FATAL_ERROR \"Only AMD64, ARM64 and I386 are supported\")\n-    else()\n-        message(FATAL_ERROR \"Only AMD64, ARM64 and ARM are supported\")\n+    # Ensure that MC is present\n+    find_program(MC mc)\n+    if (MC STREQUAL \"MC-NOTFOUND\")\n+        message(FATAL_ERROR \"MC not found\")\n     endif()\n-endfunction()\n \n+    if(CLR_CMAKE_HOST_ARCH STREQUAL arm64)\n+      # CMAKE_CXX_COMPILER will default to the compiler installed with \n+      # Visual studio. Overwrite it to the compiler on the path. \n+      # TODO, remove when cmake generator supports Arm64 as a target.  \n+      find_program(PATH_CXX_COMPILER cl) \n+      set(CMAKE_CXX_COMPILER ${PATH_CXX_COMPILER})  \n+      message(\"Overwriting the CMAKE_CXX_COMPILER.\") \n+      message(CMAKE_CXX_COMPILER found:${CMAKE_CXX_COMPILER}) \n+    endif()\n+else()\n+    enable_language(ASM)\n+\n+    # Ensure that awk is present\n+    find_program(AWK awk)\n+    if (AWK STREQUAL \"AWK-NOTFOUND\")\n+        message(FATAL_ERROR \"AWK not found\")\n+    endif()\n+ \n+    if (CMAKE_SYSTEM_NAME STREQUAL Darwin)\n+\n+      # Ensure that dsymutil and strip is present\n+      find_program(DSYMUTIL dsymutil)\n+      if (DSYMUTIL STREQUAL \"DSYMUTIL-NOTFOUND\")\n+          message(FATAL_ERROR \"dsymutil not found\")\n+      endif()\n+      find_program(STRIP strip)\n+      if (STRIP STREQUAL \"STRIP-NOTFOUND\")\n+          message(FATAL_ERROR \"strip not found\")\n+      endif()\n+    elseif (CMAKE_SYSTEM_NAME STREQUAL Linux)\n+      # Ensure that objcopy is present\n+      if(DEFINED ENV{CROSSCOMPILE})\n+        if(CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l)\n+          find_program(OBJCOPY arm-linux-gnueabihf-objcopy)\n+        elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)\n+          find_program(OBJCOPY aarch64-linux-gnu-objcopy)\n+        else()\n+          clr_unknown_arch()\n+        endif()\n+      else()\n+        find_program(OBJCOPY objcopy)\n+      endif()\n+      if (OBJCOPY STREQUAL \"OBJCOPY-NOTFOUND\")\n+          message(FATAL_ERROR \"objcopy not found\")\n+      endif()\n+    endif ()\n+endif(WIN32)\n+\n+#----------------------------------------\n+# Detect and set platform variable names\n+#     - for non-windows build platform & architecture is detected using inbuilt CMAKE variables\n+#     - for windows we use the passed in parameter to CMAKE to determine build arch\n+#----------------------------------------\n if(CMAKE_SYSTEM_NAME STREQUAL Linux)\n-    set(CLR_CMAKE_PLATFORM_UNIX 1)\n-    if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)\n-        set(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64 1)\n+    set(CLR_CMAKE_PLATFORM_UNIX 1) # variant of unix\n+    # CMAKE_SYSTEM_PROCESSOR returns the value of `uname -p`.\n+    # For the AMD/Intel 64bit architecure two different strings are common.\n+    # Linux and Darwin identify it as \"x86_64\" while FreeBSD uses the\n+    # \"amd64\" string. Accept either of the two here.\n+    if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64)\n+        set(CLR_CMAKE_PLATFORM_UNIX_AMD64 1) # amd64 arch and unix OS","path":"CMakeLists.txt","position":118,"original_position":118,"commit_id":"448ed66cad28f7b216d7980e2f430e2645554d05","original_commit_id":"448ed66cad28f7b216d7980e2f430e2645554d05","user":{"login":"rahku","id":10636986,"avatar_url":"https://avatars.githubusercontent.com/u/10636986?v=3","gravatar_id":"","url":"https://api.github.com/users/rahku","html_url":"https://github.com/rahku","followers_url":"https://api.github.com/users/rahku/followers","following_url":"https://api.github.com/users/rahku/following{/other_user}","gists_url":"https://api.github.com/users/rahku/gists{/gist_id}","starred_url":"https://api.github.com/users/rahku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rahku/subscriptions","organizations_url":"https://api.github.com/users/rahku/orgs","repos_url":"https://api.github.com/users/rahku/repos","events_url":"https://api.github.com/users/rahku/events{/privacy}","received_events_url":"https://api.github.com/users/rahku/received_events","type":"User","site_admin":false},"body":"ok will do","created_at":"2016-04-15T21:48:39Z","updated_at":"2016-04-15T21:48:39Z","html_url":"https://github.com/dotnet/coreclr/pull/4349#discussion_r59946070","pull_request_url":"https://api.github.com/repos/dotnet/coreclr/pulls/4349","_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments/59946070"},"html":{"href":"https://github.com/dotnet/coreclr/pull/4349#discussion_r59946070"},"pull_request":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/4349"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/coreclr/pulls/4349","id":66582503,"html_url":"https://github.com/dotnet/coreclr/pull/4349","diff_url":"https://github.com/dotnet/coreclr/pull/4349.diff","patch_url":"https://github.com/dotnet/coreclr/pull/4349.patch","issue_url":"https://api.github.com/repos/dotnet/coreclr/issues/4349","number":4349,"state":"open","locked":false,"title":"enable build of cross target components.","user":{"login":"rahku","id":10636986,"avatar_url":"https://avatars.githubusercontent.com/u/10636986?v=3","gravatar_id":"","url":"https://api.github.com/users/rahku","html_url":"https://github.com/rahku","followers_url":"https://api.github.com/users/rahku/followers","following_url":"https://api.github.com/users/rahku/following{/other_user}","gists_url":"https://api.github.com/users/rahku/gists{/gist_id}","starred_url":"https://api.github.com/users/rahku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rahku/subscriptions","organizations_url":"https://api.github.com/users/rahku/orgs","repos_url":"https://api.github.com/users/rahku/repos","events_url":"https://api.github.com/users/rahku/events{/privacy}","received_events_url":"https://api.github.com/users/rahku/received_events","type":"User","site_admin":false},"body":"This enables the build of following cross target components:\r\n1. crossgen\r\n2. mscordacore.dll\r\n3. sos.dll\r\n4. mscordbi.dll\r\nThis is currently only enabled for arm64 and generates x64 binaries. For cross builds it uses the same hierarchy of cmake files from source root folder. At the end of build, build calls cmake again to generate solution for cross build specifying both host & target arch. This PR adds host & target arch configuration in cmake. I decided to reuse CLR_CMAKE_PLATFORM_ARCH_* to be as the host arch and CLR_CMAKE_TARGET_ARCH_* to be as target arch. For non-cross builds they are one and same and differ in cross builds. I have also refactored root CMakeLists.txt into smaller files. Binaries for cross builds are placed at bin\\product\\<OS.Arch.Type>\\<hostArch> (eg for arm64 they will be at bin\\product\\OS.arm64.debug\\x64)","created_at":"2016-04-15T02:33:15Z","updated_at":"2016-04-15T21:48:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c9b6904698930f81066e4be00acbbdaf0f94b1ea","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/coreclr/pulls/4349/commits","review_comments_url":"https://api.github.com/repos/dotnet/coreclr/pulls/4349/comments","review_comment_url":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/coreclr/issues/4349/comments","statuses_url":"https://api.github.com/repos/dotnet/coreclr/statuses/448ed66cad28f7b216d7980e2f430e2645554d05","head":{"label":"rahku:master","ref":"master","sha":"448ed66cad28f7b216d7980e2f430e2645554d05","user":{"login":"rahku","id":10636986,"avatar_url":"https://avatars.githubusercontent.com/u/10636986?v=3","gravatar_id":"","url":"https://api.github.com/users/rahku","html_url":"https://github.com/rahku","followers_url":"https://api.github.com/users/rahku/followers","following_url":"https://api.github.com/users/rahku/following{/other_user}","gists_url":"https://api.github.com/users/rahku/gists{/gist_id}","starred_url":"https://api.github.com/users/rahku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rahku/subscriptions","organizations_url":"https://api.github.com/users/rahku/orgs","repos_url":"https://api.github.com/users/rahku/repos","events_url":"https://api.github.com/users/rahku/events{/privacy}","received_events_url":"https://api.github.com/users/rahku/received_events","type":"User","site_admin":false},"repo":{"id":46449949,"name":"coreclr","full_name":"rahku/coreclr","owner":{"login":"rahku","id":10636986,"avatar_url":"https://avatars.githubusercontent.com/u/10636986?v=3","gravatar_id":"","url":"https://api.github.com/users/rahku","html_url":"https://github.com/rahku","followers_url":"https://api.github.com/users/rahku/followers","following_url":"https://api.github.com/users/rahku/following{/other_user}","gists_url":"https://api.github.com/users/rahku/gists{/gist_id}","starred_url":"https://api.github.com/users/rahku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rahku/subscriptions","organizations_url":"https://api.github.com/users/rahku/orgs","repos_url":"https://api.github.com/users/rahku/repos","events_url":"https://api.github.com/users/rahku/events{/privacy}","received_events_url":"https://api.github.com/users/rahku/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rahku/coreclr","description":"This repo contains the .NET Core runtime, called CoreCLR, and the base library, called mscorlib. It includes the garbage collector, JIT compiler, base .NET data types and many low-level classes.","fork":true,"url":"https://api.github.com/repos/rahku/coreclr","forks_url":"https://api.github.com/repos/rahku/coreclr/forks","keys_url":"https://api.github.com/repos/rahku/coreclr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rahku/coreclr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rahku/coreclr/teams","hooks_url":"https://api.github.com/repos/rahku/coreclr/hooks","issue_events_url":"https://api.github.com/repos/rahku/coreclr/issues/events{/number}","events_url":"https://api.github.com/repos/rahku/coreclr/events","assignees_url":"https://api.github.com/repos/rahku/coreclr/assignees{/user}","branches_url":"https://api.github.com/repos/rahku/coreclr/branches{/branch}","tags_url":"https://api.github.com/repos/rahku/coreclr/tags","blobs_url":"https://api.github.com/repos/rahku/coreclr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rahku/coreclr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rahku/coreclr/git/refs{/sha}","trees_url":"https://api.github.com/repos/rahku/coreclr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rahku/coreclr/statuses/{sha}","languages_url":"https://api.github.com/repos/rahku/coreclr/languages","stargazers_url":"https://api.github.com/repos/rahku/coreclr/stargazers","contributors_url":"https://api.github.com/repos/rahku/coreclr/contributors","subscribers_url":"https://api.github.com/repos/rahku/coreclr/subscribers","subscription_url":"https://api.github.com/repos/rahku/coreclr/subscription","commits_url":"https://api.github.com/repos/rahku/coreclr/commits{/sha}","git_commits_url":"https://api.github.com/repos/rahku/coreclr/git/commits{/sha}","comments_url":"https://api.github.com/repos/rahku/coreclr/comments{/number}","issue_comment_url":"https://api.github.com/repos/rahku/coreclr/issues/comments{/number}","contents_url":"https://api.github.com/repos/rahku/coreclr/contents/{+path}","compare_url":"https://api.github.com/repos/rahku/coreclr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rahku/coreclr/merges","archive_url":"https://api.github.com/repos/rahku/coreclr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rahku/coreclr/downloads","issues_url":"https://api.github.com/repos/rahku/coreclr/issues{/number}","pulls_url":"https://api.github.com/repos/rahku/coreclr/pulls{/number}","milestones_url":"https://api.github.com/repos/rahku/coreclr/milestones{/number}","notifications_url":"https://api.github.com/repos/rahku/coreclr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rahku/coreclr/labels{/name}","releases_url":"https://api.github.com/repos/rahku/coreclr/releases{/id}","deployments_url":"https://api.github.com/repos/rahku/coreclr/deployments","created_at":"2015-11-18T21:54:03Z","updated_at":"2016-01-13T22:50:11Z","pushed_at":"2016-04-15T02:49:49Z","git_url":"git://github.com/rahku/coreclr.git","ssh_url":"git@github.com:rahku/coreclr.git","clone_url":"https://github.com/rahku/coreclr.git","svn_url":"https://github.com/rahku/coreclr","homepage":"http://dotnet.github.io/","size":74734,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"b0d613888c6c1b78add096a0832ba6ae7928f56c","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":30092893,"name":"coreclr","full_name":"dotnet/coreclr","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/coreclr","description":"This repo contains the .NET Core runtime, called CoreCLR, and the base library, called mscorlib. It includes the garbage collector, JIT compiler, base .NET data types and many low-level classes.","fork":false,"url":"https://api.github.com/repos/dotnet/coreclr","forks_url":"https://api.github.com/repos/dotnet/coreclr/forks","keys_url":"https://api.github.com/repos/dotnet/coreclr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/coreclr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/coreclr/teams","hooks_url":"https://api.github.com/repos/dotnet/coreclr/hooks","issue_events_url":"https://api.github.com/repos/dotnet/coreclr/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/coreclr/events","assignees_url":"https://api.github.com/repos/dotnet/coreclr/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/coreclr/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/coreclr/tags","blobs_url":"https://api.github.com/repos/dotnet/coreclr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/coreclr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/coreclr/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/coreclr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/coreclr/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/coreclr/languages","stargazers_url":"https://api.github.com/repos/dotnet/coreclr/stargazers","contributors_url":"https://api.github.com/repos/dotnet/coreclr/contributors","subscribers_url":"https://api.github.com/repos/dotnet/coreclr/subscribers","subscription_url":"https://api.github.com/repos/dotnet/coreclr/subscription","commits_url":"https://api.github.com/repos/dotnet/coreclr/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/coreclr/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/coreclr/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/coreclr/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/coreclr/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/coreclr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/coreclr/merges","archive_url":"https://api.github.com/repos/dotnet/coreclr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/coreclr/downloads","issues_url":"https://api.github.com/repos/dotnet/coreclr/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/coreclr/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/coreclr/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/coreclr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/coreclr/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/coreclr/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/coreclr/deployments","created_at":"2015-01-30T22:10:02Z","updated_at":"2016-04-15T20:58:59Z","pushed_at":"2016-04-15T21:47:31Z","git_url":"git://github.com/dotnet/coreclr.git","ssh_url":"git@github.com:dotnet/coreclr.git","clone_url":"https://github.com/dotnet/coreclr.git","svn_url":"https://github.com/dotnet/coreclr","homepage":"http://dotnet.github.io/","size":80648,"stargazers_count":6164,"watchers_count":6164,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1390,"mirror_url":null,"open_issues_count":768,"forks":1390,"open_issues":768,"watchers":6164,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/4349"},"html":{"href":"https://github.com/dotnet/coreclr/pull/4349"},"issue":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/4349"},"comments":{"href":"https://api.github.com/repos/dotnet/coreclr/issues/4349/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/4349/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/coreclr/pulls/4349/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/coreclr/statuses/448ed66cad28f7b216d7980e2f430e2645554d05"}}}}