Change Windows build to use a precompiled version of LLVM

This commit is contained in:
Magnus Norddahl 2016-10-01 06:51:55 +02:00
parent 28bb5da181
commit 8765cf2016
3 changed files with 51 additions and 53 deletions

1
.gitignore vendored
View file

@ -47,3 +47,4 @@
/build_vc2015-32 /build_vc2015-32
/build_vc2015-64 /build_vc2015-64
/build /build
/llvm

View file

@ -255,56 +255,44 @@ if( NOT NO_OPENAL )
endif() endif()
endif() endif()
# C:/Development/Environment/Src/llvm-3.9.0/build/lib/cmake/llvm set( LLVM_COMPONENTS core support asmparser asmprinter bitreader codegen passes ipo
find_package(LLVM REQUIRED CONFIG) irreader transformutils instrumentation profiledata debuginfocodeview runtimedyld
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") object instcombine linker analysis selectiondag scalaropts vectorize executionengine
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") mc mcdisassembler mcparser mcjit target )
llvm_map_components_to_libnames(llvm_libs set( LLVM_COMPONENTS_X86 x86asmprinter x86info x86desc x86utils x86codegen )
analysis set( LLVM_COMPONENTS_X64 aarch64asmprinter aarch64info aarch64desc aarch64utils aarch64codegen )
asmparser
asmprinter # Path where it looks for the LLVM compiled files on Windows
bitreader set( LLVM_PRECOMPILED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../llvm" )
bitwriter
codegen if( NOT WIN32 )
core # Example LLVM_DIR folder: C:/Development/Environment/Src/llvm-3.9.0/build/lib/cmake/llvm
executionengine find_package(LLVM REQUIRED CONFIG)
globalisel message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
instcombine message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
ipo llvm_map_components_to_libnames( llvm_libs ${LLVM_COMPONENTS} ${LLVM_COMPONENTS_X86} ${LLVM_COMPONENTS_X64} )
irreader include_directories( ${LLVM_INCLUDE_DIRS} )
linker set( ZDOOM_LIBS ${ZDOOM_LIBS} ${llvm_libs} )
lto else()
mc include_directories( "${LLVM_PRECOMPILED_DIR}/include" )
mcdisassembler if( X64 )
mcjit include_directories( "${LLVM_PRECOMPILED_DIR}/64bit/include" )
mcparser set( llvm_libs_base "${LLVM_PRECOMPILED_DIR}/llvm/64bit" )
mirparser set( LLVM_ALL_COMPONENTS ${LLVM_COMPONENTS} ${LLVM_COMPONENTS_X64} )
object else()
objectyaml include_directories( "${LLVM_PRECOMPILED_DIR}/32bit/include" )
orcjit set( llvm_libs_base "${LLVM_PRECOMPILED_DIR}/32bit" )
passes set( LLVM_ALL_COMPONENTS ${LLVM_COMPONENTS} ${LLVM_COMPONENTS_X86} )
scalaropts endif()
selectiondag foreach(buildtype IN ITEMS RELEASE DEBUG)
support set( llvm_libs_${buildtype} "${llvm_libs_base}/${buildtype}" )
symbolize set( LLVM_${buildtype}_LIBS "" )
tablegen foreach( llvm_module ${LLVM_ALL_COMPONENTS} )
target find_library( LLVM_${llvm_module}_LIBRARY_${buildtype} LLVM${llvm_module} PATHS ${llvm_libs_${buildtype}} )
transformutils set( LLVM_${buildtype}_LIBS ${LLVM_${buildtype}_LIBS} ${LLVM_${llvm_module}_LIBRARY_${buildtype}} )
vectorize endforeach( llvm_module )
x86asmparser endforeach(buildtype)
x86asmprinter endif()
x86codegen
x86desc
x86info
x86utils
aarch64asmparser
aarch64asmprinter
aarch64codegen
aarch64desc
aarch64info
aarch64utils)
include_directories(${LLVM_INCLUDE_DIRS})
set( ZDOOM_LIBS ${ZDOOM_LIBS} ${llvm_libs} )
if( NOT NO_FMOD ) if( NOT NO_FMOD )
# Search for FMOD include files # Search for FMOD include files
@ -1513,6 +1501,16 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS")
endif() endif()
target_link_libraries( zdoom ${ZDOOM_LIBS} gdtoa dumb lzma ) target_link_libraries( zdoom ${ZDOOM_LIBS} gdtoa dumb lzma )
if( WIN32 )
foreach(debuglib ${LLVM_DEBUG_LIBS})
target_link_libraries( zdoom debug ${debuglib} )
endforeach(debuglib)
foreach(releaselib ${LLVM_RELEASE_LIBS})
target_link_libraries( zdoom optimized ${releaselib} )
endforeach(releaselib)
endif()
include_directories( . include_directories( .
g_doom g_doom
g_heretic g_heretic

View file

@ -246,7 +246,6 @@ LLVMProgram::LLVMProgram()
InitializeNativeTarget(); InitializeNativeTarget();
InitializeNativeTargetAsmPrinter(); InitializeNativeTargetAsmPrinter();
InitializeNativeTargetAsmParser();
std::string errorstring; std::string errorstring;
@ -263,8 +262,8 @@ LLVMProgram::LLVMProgram()
cpuFeaturesStr += it.getKey(); cpuFeaturesStr += it.getKey();
} }
//Printf("LLVM target triple: %s\n", targetTriple.c_str()); DPrintf(DMSG_SPAMMY, "LLVM target triple: %s\n", targetTriple.c_str());
//Printf("LLVM CPU and features: %s, %s\n", cpuName.c_str(), cpuFeaturesStr.c_str()); DPrintf(DMSG_SPAMMY, "LLVM CPU and features: %s, %s\n", cpuName.c_str(), cpuFeaturesStr.c_str());
const Target *target = TargetRegistry::lookupTarget(targetTriple, errorstring); const Target *target = TargetRegistry::lookupTarget(targetTriple, errorstring);
if (!target) if (!target)