Skip to content

Commit

Permalink
Only use ninja if installed
Browse files Browse the repository at this point in the history
  • Loading branch information
puremourning authored and bstaletic committed Apr 13, 2024
1 parent 8a4b8e6 commit f8e77bb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions package_llvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ def GetLogicalCores():
return subprocess.check_output( cmd ).decode( 'utf-8' ).strip()


def GetGeneratorArgs():
return shutil.which( 'ninja' ) and [ '-G', 'Ninja' ] or []


def GetCacheArgs( build_dir ):
return [
'-DLLVM_CCACHE_BUILD=ON',
Expand All @@ -213,7 +217,7 @@ def BuildLlvm( build_dir,
# variables defined by LLVM.
cmake_configure_args = [
cmake,
'-G', 'Ninja',
*GetGeneratorArgs(),
# A release build implies LLVM_ENABLE_ASSERTIONS=OFF.
'-DCMAKE_BUILD_TYPE=Release',
'-DCMAKE_INSTALL_PREFIX={}'.format( install_dir ),
Expand Down Expand Up @@ -265,7 +269,7 @@ def BuildTableGen( build_dir, llvm_source_dir ):
cmake = shutil.which( 'cmake' )
subprocess.check_call( [
cmake,
'-G', 'Ninja',
*GetGeneratorArgs(),
'-DCMAKE_BUILD_TYPE=Release',
'-DLLVM_ENABLE_PROJECTS=clang',
*GetCacheArgs( build_dir ),
Expand Down

0 comments on commit f8e77bb

Please sign in to comment.