1 --- src/ponyc-0.43.0/lib/CMakeLists.txt.orig 2021-07-15 22:58:52.411387604 +0800
2 +++ src/ponyc-0.43.0/lib/CMakeLists.txt 2021-07-15 22:59:13.877217631 +0800
5 include(ExternalProject)
7 -if(NOT DEFINED PONYC_LIBS_BUILD_TYPE)
8 - set(PONYC_LIBS_BUILD_TYPE Release)
11 -set(PONYC_GBENCHMARK_URL https://github.com/google/benchmark/archive/v1.5.4.tar.gz)
12 -if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
13 - set(PONYC_GBENCHMARK_URL https://github.com/google/benchmark/archive/v1.5.3.tar.gz)
16 -ExternalProject_Add(gbenchmark
17 - URL ${PONYC_GBENCHMARK_URL}
18 - CMAKE_ARGS -DCMAKE_BUILD_TYPE=${PONYC_LIBS_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBENCHMARK_ENABLE_GTEST_TESTS=OFF -DCMAKE_CXX_FLAGS=-fpic --no-warn-unused-cli
21 -ExternalProject_Add(googletest
22 - URL https://github.com/google/googletest/archive/release-1.10.0.tar.gz
23 - CMAKE_ARGS -DCMAKE_BUILD_TYPE=${PONYC_LIBS_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCMAKE_CXX_FLAGS=-fpic -Dgtest_force_shared_crt=ON --no-warn-unused-cli
26 add_library(blake2 STATIC blake2/blake2b-ref.c)
27 set_property(TARGET blake2 PROPERTY POSITION_INDEPENDENT_CODE ON)
30 LIBRARY DESTINATION lib
36 -set(LLVM_DESIRED_HASH "fed41342a82f5a3a9201819a82bf7a48313e296b")
37 -set(PATCHES_DESIRED_HASH "3a655193262fd9b2e87340e096efcbd96726a07fe6dd42a263f3a4fc2dc0192e")
40 - if(EXISTS "${PROJECT_SOURCE_DIR}/../.git")
41 - # Update submodules as needed
42 - option(GIT_SUBMODULE "Check submodules during build" ON)
44 - message(STATUS "Updating submodules...")
45 - execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive --depth 1
46 - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
47 - RESULT_VARIABLE git_submod_result)
48 - #message("git_submod_result ${git_submod_result}")
49 - if(NOT git_submod_result EQUAL "0")
50 - message(FATAL_ERROR "git submodule update --init --recursive --depth 1 failed with ${git_submod_result}, please checkout submodules")
53 - # we check to make sure the submodule hash matches
54 - # the reason the submodule hash is in this file is to be able to use this file as a key for caching the libs in CI
55 - execute_process(COMMAND ${GIT_EXECUTABLE} submodule status
56 - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
57 - OUTPUT_VARIABLE git_submod_output)
58 - #message("git_submod_output ${git_submod_output}")
59 - string(FIND "${git_submod_output}" "${LLVM_DESIRED_HASH}" LLVM_SUBMOD_POS)
60 - if(LLVM_SUBMOD_POS EQUAL "-1")
61 - message(FATAL_ERROR "Expecting the lib/llvm/src submodule to be at hash '${LLVM_DESIRED_HASH}'; found '${git_submod_output}'; update the LLVM_DESIRED_HASH variable in lib/CMakeLists.txt if you've updated the submodule.")
67 - message("Applying patches...")
68 - file(GLOB PONY_LLVM_PATCHES "${PROJECT_SOURCE_DIR}/llvm/patches/*.diff")
70 - # check to see if the patch hashes match
71 - message("Checking patches ${PONY_LLVM_PATCHES}")
72 - set(PATCHES_ACTUAL_HASH "")
73 - foreach (PATCH ${PONY_LLVM_PATCHES})
74 - file(STRINGS ${PATCH} patch_file NEWLINE_CONSUME)
75 - string(REPLACE "\n" " " patch_file ${patch_file})
76 - string(SHA256 patch_file_hash ${patch_file})
77 - # message("${PATCH}: '${patch_file_hash}'")
78 - string(CONCAT PATCHES_ACTUAL_HASH ${PATCHES_ACTUAL_HASH} ${patch_file_hash})
79 - # message("concat is '${PATCHES_ACTUAL_HASH}'")
81 - string(SHA256 PATCHES_ACTUAL_HASH ${PATCHES_ACTUAL_HASH})
82 - # message("Desired hash ${PATCHES_DESIRED_HASH}")
83 - # message("Actual hash ${PATCHES_ACTUAL_HASH}")
84 - if(NOT PATCHES_ACTUAL_HASH EQUAL "${PATCHES_DESIRED_HASH}")
85 - message(FATAL_ERROR "Patch hash actual ${PATCHES_ACTUAL_HASH} does not match desired ${PATCHES_DESIRED_HASH}")
88 - foreach (PATCH ${PONY_LLVM_PATCHES})
89 - message(" Checking ${PATCH}")
90 - execute_process(COMMAND ${GIT_EXECUTABLE} apply --check -p 1 --ignore-whitespace --whitespace=nowarn ${PATCH}
91 - WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/llvm/src"
92 - ERROR_VARIABLE _err_out
93 - RESULT_VARIABLE git_apply_check_result)
94 - if(git_apply_check_result EQUAL "0")
95 - message(" Applying ${PATCH}")
96 - execute_process(COMMAND ${GIT_EXECUTABLE} apply -p 1 --ignore-whitespace --whitespace=nowarn ${PATCH}
97 - WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/llvm/src"
98 - RESULT_VARIABLE git_apply_result)
99 - if(NOT git_apply_result EQUAL "0")
100 - message(FATAL_ERROR "Unable to apply ${PATCH}")
103 - message(" Already applied ${PATCH}")
107 - message(FATAL_ERROR "Git not found!")
110 -message("Building targets: ${LLVM_TARGETS_TO_BUILD}")
112 -set(LLVM_ENABLE_BINDINGS OFF)
113 -set(LLVM_ENABLE_OCAMLDOC OFF)
114 -set(LLVM_ENABLE_PIC OFF)
115 -set(LLVM_ENABLE_TERMINFO OFF)
116 -set(LLVM_ENABLE_WARNINGS OFF)
117 -set(LLVM_ENABLE_Z3_SOLVER OFF)
118 -set(LLVM_INCLUDE_BENCHMARKS OFF)
119 -set(LLVM_INCLUDE_TESTS OFF)
120 -set(LLVM_TOOL_REMARKS_SHLIB_BUILD OFF)
121 -set(LLVM_ENABLE_ZLIB OFF)
123 -if(${CMAKE_HOST_SYSTEM_NAME} MATCHES "Darwin")
124 - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.14 -DUSE_SCHEDULER_SCALING_PTHREADS")
125 - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -mmacosx-version-min=10.14")
128 -add_subdirectory(llvm/src/llvm)