Add Windows wamrc and iwasm build in release CI (#3857)
- For Windows, llvm libs need to cache more directories, so use a multi-line environment variable for paths - Remove conditionally build directories `win32build`, just use `build` for all platform - Add Windows wamrc and iwasm(disable lib pthread semaphore and fast jit for now) build in release CI
This commit is contained in:
@ -125,9 +125,7 @@ def build_llvm(llvm_dir, platform, backends, projects, use_clang=False, extra_fl
|
||||
if not llvm_dir.exists():
|
||||
raise Exception(f"{llvm_dir} doesn't exist")
|
||||
|
||||
build_dir = llvm_dir.joinpath(
|
||||
"win32build" if "windows" == platform else "build"
|
||||
).resolve()
|
||||
build_dir = llvm_dir.joinpath("build").resolve()
|
||||
build_dir.mkdir(exist_ok=True)
|
||||
|
||||
lib_llvm_core_library = build_dir.joinpath("lib/libLLVMCore.a").resolve()
|
||||
@ -178,6 +176,7 @@ def repackage_llvm(llvm_dir):
|
||||
raise Exception("Find more than one LLVM-*.tar.gz")
|
||||
|
||||
if not packs:
|
||||
raise Exception("Didn't find any LLVM-* package")
|
||||
return
|
||||
|
||||
llvm_package = packs[0].name
|
||||
@ -193,6 +192,31 @@ def repackage_llvm(llvm_dir):
|
||||
# rm ./LLVM-1*.gz
|
||||
os.remove(llvm_dir.joinpath(llvm_package).resolve())
|
||||
|
||||
def repackage_llvm_windows(llvm_dir):
|
||||
build_dir = llvm_dir.joinpath("./build").resolve()
|
||||
|
||||
packs_path = [f for f in build_dir.glob("./_CPack_Packages/win64/NSIS/LLVM-*-win64")]
|
||||
if len(packs_path) > 1:
|
||||
raise Exception("Find more than one LLVM-* package")
|
||||
|
||||
if not packs_path:
|
||||
raise Exception("Didn't find any LLVM-* package")
|
||||
return
|
||||
|
||||
llvm_package_path = f"_CPack_Packages/win64/NSIS/{packs_path[0].name}"
|
||||
windows_package_dir = build_dir.joinpath(llvm_package_path).resolve()
|
||||
|
||||
# mv package dir outside of build
|
||||
shutil.move(str(windows_package_dir), str(llvm_dir))
|
||||
# rm -r build
|
||||
shutil.rmtree(str(build_dir))
|
||||
# mkdir build
|
||||
build_dir.mkdir()
|
||||
# move back all the subdiretories under cpack directory(bin/include/lib) to build dir
|
||||
moved_package_dir = llvm_dir.joinpath(packs_path[0].name)
|
||||
for sub_dir in moved_package_dir.iterdir():
|
||||
shutil.move(str(sub_dir), str(build_dir))
|
||||
moved_package_dir.rmdir()
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="build necessary LLVM libraries")
|
||||
@ -304,7 +328,11 @@ def main():
|
||||
)
|
||||
is not None
|
||||
):
|
||||
repackage_llvm(llvm_dir)
|
||||
# TODO: repackage process may change in the future, this work for LLVM 15.x
|
||||
if "windows" == platform:
|
||||
repackage_llvm_windows(llvm_dir)
|
||||
else:
|
||||
repackage_llvm(llvm_dir)
|
||||
|
||||
return True
|
||||
except subprocess.CalledProcessError:
|
||||
|
||||
@ -102,9 +102,6 @@ if (WAMR_BUILD_JIT EQUAL 1)
|
||||
if (NOT DEFINED LLVM_DIR)
|
||||
set (LLVM_SRC_ROOT "${WAMR_ROOT_DIR}/core/deps/llvm")
|
||||
set (LLVM_BUILD_ROOT "${LLVM_SRC_ROOT}/build")
|
||||
if (WAMR_BUILD_PLATFORM STREQUAL "windows")
|
||||
set (LLVM_BUILD_ROOT "${LLVM_SRC_ROOT}/win32build")
|
||||
endif ()
|
||||
if (NOT EXISTS "${LLVM_BUILD_ROOT}")
|
||||
message (FATAL_ERROR "Cannot find LLVM dir: ${LLVM_BUILD_ROOT}")
|
||||
endif ()
|
||||
|
||||
@ -59,7 +59,12 @@ if (WAMR_BUILD_INTERP EQUAL 1)
|
||||
endif ()
|
||||
|
||||
if (WAMR_BUILD_FAST_JIT EQUAL 1)
|
||||
include (${IWASM_DIR}/fast-jit/iwasm_fast_jit.cmake)
|
||||
if (WAMR_BUILD_PLATFORM STREQUAL "windows")
|
||||
message ("Fast JIT currently not supported on Windows")
|
||||
set (WAMR_BUILD_FAST_JIT 0)
|
||||
else ()
|
||||
include (${IWASM_DIR}/fast-jit/iwasm_fast_jit.cmake)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (WAMR_BUILD_JIT EQUAL 1)
|
||||
@ -104,6 +109,10 @@ if (WAMR_BUILD_WASI_NN EQUAL 1)
|
||||
endif ()
|
||||
|
||||
if (WAMR_BUILD_LIB_PTHREAD EQUAL 1)
|
||||
if (WAMR_BUILD_PLATFORM STREQUAL "windows")
|
||||
set (WAMR_BUILD_LIB_PTHREAD_SEMAPHORE 0)
|
||||
message ("Lib pthread semaphore currently not supported on Windows")
|
||||
endif ()
|
||||
include (${IWASM_DIR}/libraries/lib-pthread/lib_pthread.cmake)
|
||||
# Enable the dependent feature if lib pthread is enabled
|
||||
set (WAMR_BUILD_THREAD_MGR 1)
|
||||
|
||||
Reference in New Issue
Block a user