mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +00:00
CMake: build llvm-config on Windows.
It was previously not being built on Windows because the cmake file relied on a sed script to generate a .in file that llvm-config needs. By using cmake's configure_file function, we can get rid off the sed hack, and also have this work on Windows. Differential Revision: http://llvm-reviews.chandlerc.com/D1481 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189125 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
12d3dc73dc
commit
3eb7322ca1
@ -2,13 +2,7 @@
|
|||||||
# three small executables. This is done to minimize memory load in parallel
|
# three small executables. This is done to minimize memory load in parallel
|
||||||
# builds. Please retain this ordering.
|
# builds. Please retain this ordering.
|
||||||
|
|
||||||
if( NOT WIN32 OR MSYS OR CYGWIN )
|
add_llvm_tool_subdirectory(llvm-config)
|
||||||
# We currently require 'sed' to build llvm-config, so don't try to build it
|
|
||||||
# on pure Win32.
|
|
||||||
add_llvm_tool_subdirectory(llvm-config)
|
|
||||||
else()
|
|
||||||
ignore_llvm_tool_subdirectory(llvm-config)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_llvm_tool_subdirectory(opt)
|
add_llvm_tool_subdirectory(opt)
|
||||||
add_llvm_tool_subdirectory(llvm-as)
|
add_llvm_tool_subdirectory(llvm-as)
|
||||||
|
@ -1,37 +1,25 @@
|
|||||||
set(LLVM_LINK_COMPONENTS support)
|
set(LLVM_LINK_COMPONENTS support)
|
||||||
|
|
||||||
# We need to generate the BuildVariables.inc file containing values which are
|
|
||||||
# only defined when under certain build modes. Unfortunately, that precludes
|
|
||||||
# doing this inside CMake so we have to shell out to sed. For now, that means we
|
|
||||||
# can't expect to build llvm-config on Window.s
|
|
||||||
set(BUILDVARIABLES_SRCPATH ${CMAKE_CURRENT_SOURCE_DIR}/BuildVariables.inc.in)
|
set(BUILDVARIABLES_SRCPATH ${CMAKE_CURRENT_SOURCE_DIR}/BuildVariables.inc.in)
|
||||||
set(BUILDVARIABLES_OBJPATH ${CMAKE_CURRENT_BINARY_DIR}/BuildVariables.inc)
|
set(BUILDVARIABLES_OBJPATH ${CMAKE_CURRENT_BINARY_DIR}/BuildVariables.inc)
|
||||||
set(SEDSCRIPT_OBJPATH ${CMAKE_CURRENT_BINARY_DIR}/BuildVariables.configure.sed)
|
|
||||||
|
|
||||||
# Compute the substitution values for various items.
|
# Compute the substitution values for various items.
|
||||||
get_system_libs(LLVM_SYSTEM_LIBS_LIST)
|
get_system_libs(LLVM_SYSTEM_LIBS_LIST)
|
||||||
foreach(l ${LLVM_SYSTEM_LIBS_LIST})
|
foreach(l ${LLVM_SYSTEM_LIBS_LIST})
|
||||||
set(SYSTEM_LIBS ${SYSTEM_LIBS} "-l${l}")
|
set(SYSTEM_LIBS ${SYSTEM_LIBS} "-l${l}")
|
||||||
endforeach()
|
endforeach()
|
||||||
set(C_FLGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
|
|
||||||
set(CXX_FLGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
|
|
||||||
set(CPP_FLGS "${CMAKE_CPP_FLAGS} ${CMAKE_CPP_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
|
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${BUILDVARIABLES_OBJPATH}
|
# Use configure_file to create BuildVariables.inc.
|
||||||
COMMAND echo s!@LLVM_SRC_ROOT@!${LLVM_MAIN_SRC_DIR}! > ${SEDSCRIPT_OBJPATH}
|
set(LLVM_SRC_ROOT ${LLVM_MAIN_SRC_DIR})
|
||||||
COMMAND echo s!@LLVM_OBJ_ROOT@!${LLVM_BINARY_DIR}! >> ${SEDSCRIPT_OBJPATH}
|
set(LLVM_OBJ_ROOT ${LLVM_BINARY_DIR})
|
||||||
COMMAND echo s!@LLVM_CPPFLAGS@!${CPP_FLGS}! >> ${SEDSCRIPT_OBJPATH}
|
set(LLVM_CPPFLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_CPP_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
|
||||||
COMMAND echo s!@LLVM_CFLAGS@!${C_FLGS}! >> ${SEDSCRIPT_OBJPATH}
|
set(LLVM_CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
|
||||||
COMMAND echo s!@LLVM_CXXFLAGS@!${CXX_FLGS}! >> ${SEDSCRIPT_OBJPATH}
|
set(LLVM_CXXFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}")
|
||||||
# TODO: Use general flags for linking! not just for shared libs:
|
set(LLVM_LDFLAGS ${CMAKE_SHARED_LINKER_FLAGS})
|
||||||
COMMAND echo s!@LLVM_LDFLAGS@!${CMAKE_SHARED_LINKER_FLAGS}! >> ${SEDSCRIPT_OBJPATH}
|
set(LLVM_BUILDMODE ${CMAKE_BUILD_TYPE})
|
||||||
COMMAND echo s!@LLVM_BUILDMODE@!${CMAKE_BUILD_TYPE}! >> ${SEDSCRIPT_OBJPATH}
|
set(LLVM_SYSTEM_LIBS ${SYSTEM_LIBS})
|
||||||
COMMAND echo s!@LLVM_SYSTEM_LIBS@!${SYSTEM_LIBS}! >> ${SEDSCRIPT_OBJPATH}
|
set(LLVM_TARGETS_BUILT ${LLVM_TARGETS_TO_BUILD})
|
||||||
COMMAND echo s!@LLVM_TARGETS_BUILT@!${LLVM_TARGETS_TO_BUILD}! >> ${SEDSCRIPT_OBJPATH}
|
configure_file(${BUILDVARIABLES_SRCPATH} ${BUILDVARIABLES_OBJPATH} @ONLY)
|
||||||
COMMAND sed -f ${SEDSCRIPT_OBJPATH} < ${BUILDVARIABLES_SRCPATH} > ${BUILDVARIABLES_OBJPATH}
|
|
||||||
VERBATIM
|
|
||||||
COMMENT "Building BuildVariables.inc include."
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add the llvm-config tool.
|
# Add the llvm-config tool.
|
||||||
add_llvm_tool(llvm-config
|
add_llvm_tool(llvm-config
|
||||||
|
Loading…
Reference in New Issue
Block a user