mirror of
https://github.com/ziglang/zig.git
synced 2024-11-15 00:26:57 +00:00
simpler cmake for msvc
This commit is contained in:
parent
fb365e3952
commit
3fe50cb13c
@ -7,128 +7,65 @@
|
||||
# LLVM_LIBRARIES
|
||||
# LLVM_LIBDIRS
|
||||
|
||||
if(MSVC)
|
||||
find_package(LLVM REQUIRED CONFIG)
|
||||
find_program(LLVM_CONFIG_EXE
|
||||
NAMES llvm-config-5.0 llvm-config
|
||||
PATHS
|
||||
"/mingw64/bin"
|
||||
"/c/msys64/mingw64/bin"
|
||||
"c:/msys64/mingw64/bin"
|
||||
"C:/Libraries/llvm-5.0.0/bin")
|
||||
|
||||
# TODO: this currently doesn't work, it currently defines UNICODE but zig
|
||||
# uses MBCS
|
||||
#add_definitions(${LLVM_DEFINITIONS})
|
||||
|
||||
link_directories(${LLVM_LIBRARY_DIRS})
|
||||
llvm_map_components_to_libnames(LLVM_LIBRARIES
|
||||
LTO
|
||||
Symbolize
|
||||
XCoreDisassembler
|
||||
XCoreCodeGen
|
||||
XCoreAsmPrinter
|
||||
SystemZDisassembler
|
||||
SystemZCodeGen
|
||||
SystemZAsmParser
|
||||
SystemZAsmPrinter
|
||||
SparcDisassembler
|
||||
SparcCodeGen
|
||||
SparcAsmParser
|
||||
SparcAsmPrinter
|
||||
PowerPCDisassembler
|
||||
PowerPCCodeGen
|
||||
PowerPCAsmParser
|
||||
PowerPCAsmPrinter
|
||||
NVPTXCodeGen
|
||||
NVPTXAsmPrinter
|
||||
MSP430CodeGen
|
||||
MSP430AsmPrinter
|
||||
MipsDisassembler
|
||||
MipsCodeGen
|
||||
MipsAsmParser
|
||||
MipsAsmPrinter
|
||||
LanaiDisassembler
|
||||
LanaiCodeGen
|
||||
LanaiAsmParser
|
||||
LanaiAsmPrinter
|
||||
HexagonDisassembler
|
||||
HexagonCodeGen
|
||||
HexagonAsmParser
|
||||
BPFDisassembler
|
||||
BPFCodeGen
|
||||
BPFAsmPrinter
|
||||
ARMDisassembler
|
||||
ARMCodeGen
|
||||
ARMAsmParser
|
||||
ARMAsmPrinter
|
||||
AMDGPUDisassembler
|
||||
AMDGPUCodeGen
|
||||
AMDGPUAsmParser
|
||||
AMDGPUAsmPrinter
|
||||
AArch64Disassembler
|
||||
AArch64CodeGen
|
||||
AArch64AsmParser
|
||||
AArch64AsmPrinter
|
||||
LibDriver
|
||||
X86Disassembler
|
||||
X86AsmParser
|
||||
X86CodeGen
|
||||
X86AsmPrinter
|
||||
Core
|
||||
)
|
||||
|
||||
else()
|
||||
find_program(LLVM_CONFIG_EXE
|
||||
NAMES llvm-config-5.0 llvm-config
|
||||
PATHS
|
||||
"/mingw64/bin"
|
||||
"/c/msys64/mingw64/bin"
|
||||
"c:/msys64/mingw64/bin"
|
||||
"C:/Libraries/llvm-5.0.0/bin")
|
||||
|
||||
if(NOT(CMAKE_BUILD_TYPE STREQUAL "Debug"))
|
||||
execute_process(
|
||||
COMMAND ${LLVM_CONFIG_EXE} --libfiles --link-static
|
||||
OUTPUT_VARIABLE LLVM_LIBRARIES_SPACES
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REPLACE " " ";" LLVM_LIBRARIES "${LLVM_LIBRARIES_SPACES}")
|
||||
|
||||
execute_process(
|
||||
COMMAND ${LLVM_CONFIG_EXE} --system-libs --link-static
|
||||
OUTPUT_VARIABLE LLVM_SYSTEM_LIBS_SPACES
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REPLACE " " ";" LLVM_SYSTEM_LIBS "${LLVM_SYSTEM_LIBS_SPACES}")
|
||||
|
||||
execute_process(
|
||||
COMMAND ${LLVM_CONFIG_EXE} --libdir --link-static
|
||||
OUTPUT_VARIABLE LLVM_LIBDIRS_SPACES
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REPLACE " " ";" LLVM_LIBDIRS "${LLVM_LIBDIRS_SPACES}")
|
||||
endif()
|
||||
if(NOT LLVM_LIBRARIES)
|
||||
execute_process(
|
||||
COMMAND ${LLVM_CONFIG_EXE} --libs
|
||||
OUTPUT_VARIABLE LLVM_LIBRARIES
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${LLVM_CONFIG_EXE} --system-libs
|
||||
OUTPUT_VARIABLE LLVM_SYSTEM_LIBS
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${LLVM_CONFIG_EXE} --libdir
|
||||
OUTPUT_VARIABLE LLVM_LIBDIRS
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
endif()
|
||||
if(NOT(CMAKE_BUILD_TYPE STREQUAL "Debug"))
|
||||
execute_process(
|
||||
COMMAND ${LLVM_CONFIG_EXE} --libfiles --link-static
|
||||
OUTPUT_VARIABLE LLVM_LIBRARIES_SPACES
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REPLACE " " ";" LLVM_LIBRARIES "${LLVM_LIBRARIES_SPACES}")
|
||||
|
||||
execute_process(
|
||||
COMMAND ${LLVM_CONFIG_EXE} --includedir
|
||||
OUTPUT_VARIABLE LLVM_INCLUDE_DIRS
|
||||
COMMAND ${LLVM_CONFIG_EXE} --system-libs --link-static
|
||||
OUTPUT_VARIABLE LLVM_SYSTEM_LIBS_SPACES
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REPLACE " " ";" LLVM_SYSTEM_LIBS "${LLVM_SYSTEM_LIBS_SPACES}")
|
||||
|
||||
set(LLVM_LIBRARIES ${LLVM_LIBRARIES} ${LLVM_SYSTEM_LIBS})
|
||||
|
||||
if(NOT LLVM_LIBRARIES)
|
||||
find_library(LLVM_LIBRARIES NAMES LLVM LLVM-5.0 LLVM-5)
|
||||
endif()
|
||||
|
||||
link_directories("${CMAKE_PREFIX_PATH}/lib")
|
||||
execute_process(
|
||||
COMMAND ${LLVM_CONFIG_EXE} --libdir --link-static
|
||||
OUTPUT_VARIABLE LLVM_LIBDIRS_SPACES
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REPLACE " " ";" LLVM_LIBDIRS "${LLVM_LIBDIRS_SPACES}")
|
||||
endif()
|
||||
if(NOT LLVM_LIBRARIES)
|
||||
execute_process(
|
||||
COMMAND ${LLVM_CONFIG_EXE} --libs
|
||||
OUTPUT_VARIABLE LLVM_LIBRARIES_SPACES
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REPLACE " " ";" LLVM_LIBRARIES "${LLVM_LIBRARIES_SPACES}")
|
||||
|
||||
execute_process(
|
||||
COMMAND ${LLVM_CONFIG_EXE} --system-libs
|
||||
OUTPUT_VARIABLE LLVM_SYSTEM_LIBS_SPACES
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REPLACE " " ";" LLVM_SYSTEM_LIBS "${LLVM_SYSTEM_LIBS_SPACES}")
|
||||
|
||||
execute_process(
|
||||
COMMAND ${LLVM_CONFIG_EXE} --libdir
|
||||
OUTPUT_VARIABLE LLVM_LIBDIRS_SPACES
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REPLACE " " ";" LLVM_LIBDIRS "${LLVM_LIBDIRS_SPACES}")
|
||||
endif()
|
||||
|
||||
execute_process(
|
||||
COMMAND ${LLVM_CONFIG_EXE} --includedir
|
||||
OUTPUT_VARIABLE LLVM_INCLUDE_DIRS
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
set(LLVM_LIBRARIES ${LLVM_LIBRARIES} ${LLVM_SYSTEM_LIBS})
|
||||
|
||||
if(NOT LLVM_LIBRARIES)
|
||||
find_library(LLVM_LIBRARIES NAMES LLVM LLVM-5.0 LLVM-5)
|
||||
endif()
|
||||
|
||||
link_directories("${CMAKE_PREFIX_PATH}/lib")
|
||||
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
Loading…
Reference in New Issue
Block a user