Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try llvm #157

Merged
merged 10 commits into from
Aug 8, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
hack on
  • Loading branch information
wolfv committed Aug 7, 2022
commit f7ea4560bfb8dede9775e994640a338126b3c444
68 changes: 68 additions & 0 deletions recipes/recipes_emscripten/llvmdev/install_llvm.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,75 @@
#!/bin/bash
set -x

# set -x

# Make osx work like linux.
sed -i.bak "s/NOT APPLE AND ARG_SONAME/ARG_SONAME/g" llvm/cmake/modules/AddLLVM.cmake
sed -i.bak "s/NOT APPLE AND NOT ARG_SONAME/NOT ARG_SONAME/g" llvm/cmake/modules/AddLLVM.cmake

mkdir build
cd build

# if [[ "$target_platform" == "linux-64" ]]; then
# CMAKE_ARGS="${CMAKE_ARGS} -DLLVM_USE_INTEL_JITEVENTS=ON"
# fi

# if [[ "$CC_FOR_BUILD" != "" && "$CC_FOR_BUILD" != "$CC" ]]; then
# CMAKE_ARGS="${CMAKE_ARGS} -DCROSS_TOOLCHAIN_FLAGS_NATIVE=-DCMAKE_C_COMPILER=$CC_FOR_BUILD;-DCMAKE_CXX_COMPILER=$CXX_FOR_BUILD;-DCMAKE_C_FLAGS=-O2;-DCMAKE_CXX_FLAGS=-O2;-DCMAKE_EXE_LINKER_FLAGS=-Wl,-rpath,${BUILD_PREFIX}/lib;-DCMAKE_MODULE_LINKER_FLAGS=;-DCMAKE_SHARED_LINKER_FLAGS=;-DCMAKE_STATIC_LINKER_FLAGS=;-DLLVM_INCLUDE_BENCHMARKS=OFF;"
# CMAKE_ARGS="${CMAKE_ARGS} -DLLVM_HOST_TRIPLE=$(echo $HOST | sed s/conda/unknown/g) -DLLVM_DEFAULT_TARGET_TRIPLE=$(echo $HOST | sed s/conda/unknown/g)"
# fi

# disable -fno-plt due to https://bugs.llvm.org/show_bug.cgi?id=51863 due to some GCC bug
# if [[ "$target_platform" == "linux-ppc64le" ]]; then
# CFLAGS="$(echo $CFLAGS | sed 's/-fno-plt //g')"
# CXXFLAGS="$(echo $CXXFLAGS | sed 's/-fno-plt //g')"
# fi

cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DCMAKE_BUILD_TYPE=Release \
-DHAVE_LIBEDIT=OFF \
-DLLVM_HAVE_LIBXAR=OFF \
-DLLVM_ENABLE_LIBXML2=OFF \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_ENABLE_TERMINFO=OFF \
-DLLVM_ENABLE_ZLIB=ON \
-DLLVM_INCLUDE_BENCHMARKS=OFF \
-DLLVM_INCLUDE_DOCS=OFF \
-DLLVM_INCLUDE_EXAMPLES=OFF \
-DLLVM_INCLUDE_GO_TESTS=OFF \
-DLLVM_INCLUDE_TESTS=ON \
-DLLVM_INCLUDE_UTILS=ON \
-DLLVM_INSTALL_UTILS=ON \
-DLLVM_UTILS_INSTALL_DIR=libexec/llvm \
-DLLVM_BUILD_LLVM_DYLIB=yes \
-DLLVM_LINK_LLVM_DYLIB=yes \
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly \
${CMAKE_ARGS} \
-GNinja \
../llvm

ninja -j${CPU_COUNT}

# if [[ "${target_platform}" == "linux-64" || "${target_platform}" == "osx-64" ]]; then
# export TEST_CPU_FLAG="-mcpu=haswell"
# else
# export TEST_CPU_FLAG=""
# fi

# if [[ "$CONDA_BUILD_CROSS_COMPILATION" != "1" ]]; then
# # bin/opt -S -vector-library=SVML $TEST_CPU_FLAG -O3 $RECIPE_DIR/numba-3016.ll | bin/FileCheck $RECIPE_DIR/numba-3016.ll || exit $?

# if [[ "$target_platform" == linux* ]]; then
# ln -s $(which $CC) $BUILD_PREFIX/bin/gcc
# fi

# ninja -j${CPU_COUNT} check-llvm

# cd ../llvm/test
# ../../build/bin/llvm-lit -vv Transforms ExecutionEngine Analysis CodeGen/X86
# fi

# cd build
ninja install

IFS='.' read -ra VER_ARR <<< "$PKG_VERSION"
Expand Down
46 changes: 25 additions & 21 deletions recipes/recipes_emscripten/llvmdev/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,29 @@ source:
build:
number: 0

requirements:
build:
- "{{ compiler('cxx') }}"
- cmake
- ninja
- python >=3
- libcxx {{ cxx_compiler_version }} # [osx]
host:
- libcxx {{ cxx_compiler_version }} # [osx]
- zlib
- libxml2 # [win]

outputs:
# requirements:
# build:
# - "{{ compiler('cxx') }}"
# - cmake
# - ninja
# - python >=3
# - libcxx {{ cxx_compiler_version }} # [osx]
# host:
# - libcxx {{ cxx_compiler_version }} # [osx]
# - zlib
# - libxml2 # [win]

# Contains everything
- name: llvmdev
- package:
name: llvmdev
build:
script: install_llvm.sh # [not win]
activate_in_script: true
requirements:
build:
- "{{ compiler('cxx') }}"
- cmake
- cmake <3.24
- ninja
- python >=3
host:
Expand All @@ -61,9 +62,10 @@ outputs:

# Contains the shared libraries. To make different LLVM libraries co-installable
# soversion is appended to the package name.
- name: libllvm{{ major_ver }}
- package:
name: libllvm{{ major_ver }}
build:
skip: true # [win and vc<14]
# skip: true # [win and vc<14]
script: install_llvm.sh # [not win]
activate_in_script: true
# run_exports: # [not win]
Expand All @@ -72,7 +74,7 @@ outputs:
build:
- "{{ compiler('cxx') }}"
- ninja # [not win]
- cmake # [not win]
- cmake <3.24 # [not win]
- python >=3 # [not win]
host:
# - libcxx >={{ cxx_compiler_version }} # [osx]
Expand All @@ -85,8 +87,9 @@ outputs:

# This is a meta package so that people can use the latest libllvm and also
# for run_exports
- name: llvm
build:
- package:
name: llvm
# build:
# skip: true # [(win and vc<14)]
# run_exports: # [not win]
# - '{{ pin_subpackage("libllvm" + major_ver, max_pin="x.x") }}' # [not win]
Expand All @@ -103,15 +106,16 @@ outputs:
# - echo "Hello World!"

# # Contains LLVM tools
- name: llvm-tools
- package:
name: llvm-tools
# script: install_llvm.bat # [win]
build:
script: install_llvm.sh
activate_in_script: true
requirements:
build:
- "{{ compiler('cxx') }}"
- cmake
- cmake <3.24
- ninja
- python >=3
host:
Expand Down