1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

Revert "[RFC] Factor out repetitive cmake patterns for llvm-style projects"

This reverts commit e9b87f43bde8b5f0d8a79c5884fdce639b12e0ca.

There are issues with macros generating macros without an obvious simple fix
so I'm going to revert this and try something different.
This commit is contained in:
Stephen Neuendorffer 2020-10-04 15:17:34 -07:00
parent e7f476cce6
commit bcb409d3b1
2 changed files with 0 additions and 177 deletions

View File

@ -1,68 +0,0 @@
# LLVM-style projects generally have the same directory structure. This file
# provides some bolierplate cmake support for projects that supports this
# directory structure. Note that generally speaking, projects should prefer
# to use their own rules for these rather than relying on the core llvm build
# targets.
# Generally name should be lower case.
function(add_llvm_project_options name)
string(TOUPPER "${name}" uppername)
# Define options to control the inclusion and default build behavior for
# components which may not strictly be necessary (tools, examples, and tests).
#
# This is primarily to support building smaller or faster project files.
option(${uppername}_INCLUDE_TOOLS
"Generate build targets for the ${uppername} tools."
${LLVM_INCLUDE_TOOLS})
option(${uppername}_BUILD_TOOLS
"Build the ${uppername} tools. If OFF, just generate build targets."
${LLVM_BUILD_TOOLS})
option(${uppername}_INCLUDE_UTILS
"Generate build targets for the ${uppername} utils."
${LLVM_INCLUDE_UTILS})
option(${uppername}_BUILD_UTILS
"Build ${uppername} utility binaries. If OFF, just generate build targets."
${LLVM_BUILD_UTILS})
option(${uppername}_INSTALL_UTILS
"Include utility binaries in the 'install' target."
${LLVM_INSTALL_UTILS})
# i.e. Don't install headers, for instance.
option(${uppername}_INSTALL_TOOLCHAIN_ONLY
"Only include toolchain files in the 'install' target."
${LLVM_INSTALL_TOOLCHAIN_ONLY})
option(${uppername}_BUILD_EXAMPLES
"Build the ${uppername} example programs. If OFF, just generate build targets."
${LLVM_BUILD_EXAMPLES})
option(${uppername}_INCLUDE_EXAMPLES
"Generate build targets for the ${uppername} examples"
${LLVM_INCLUDE_EXAMPLES})
if(${uppername}_BUILD_EXAMPLES)
add_definitions(-DBUILD_EXAMPLES)
endif(${uppername}_BUILD_EXAMPLES)
option(${uppername}_BUILD_TESTS
"Build ${uppername} unit tests. If OFF, just generate build targets."
${LLVM_BUILD_TESTS})
option(${uppername}_INCLUDE_TESTS
"Generate build targets for the ${uppername} unit tests."
${LLVM_INCLUDE_TESTS})
if (${uppername}_INCLUDE_TESTS)
add_definitions(-D${uppername}_INCLUDE_TESTS)
endif()
option(${uppername}_INCLUDE_INTEGRATION_TESTS
"Generate build targets for the ${uppername} integration tests."
${LLVM_INCLUDE_INTEGRATION_TESTS})
if (${uppername}_INCLUDE_INTEGRATION_TESTS)
add_definitions(-D${uppername}_INCLUDE_INTEGRATION_TESTS)
endif()
option(${uppername}_INCLUDE_DOCS
"Generate build targets for the ${uppername} docs."
${LLVM_INCLUDE_DOCS})
endfunction(add_llvm_project_options)

View File

@ -1,109 +0,0 @@
# For project foo, this function generates:
# add_foo_tool(name) (An executable installed by default)
# add_foo_utility(name) (An executable *not* installed by default)
# add_foo_example(name) (An executable which is built, but never installed)
# add_foo_example_library(name) (A library to go along with an example)
# It also assumes the following configuration environment variables
# (see LLVMProjectOptions.cmake)
# FOO_TOOLS_INSTALL_DIR
# FOO_BUILD_TOOLS
# FOO_BUILD_UTILS
# FOO_INSTALL_UTILS
# FOO_BUILD_EXAMPLES
# FOO_HAS_EXPORTS
# FOO_INSTALL_TOOLCHAIN_ONLY
function(add_llvm_project_targets projectname)
string(TOUPPER "${name}" upperprojectname)
macro(add_${projectname}_tool name)
if( NOT ${upperprojectname}_BUILD_TOOLS )
set(EXCLUDE_FROM_ALL ON)
endif()
add_llvm_executable(${name} ${ARGN})
if ( ${name} IN_LIST LLVM_TOOLCHAIN_TOOLS OR NOT ${upperprojectname}_INSTALL_TOOLCHAIN_ONLY)
if( ${upperprojectname}_BUILD_TOOLS )
set(export_to_${projectname}exports)
if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
NOT LLVM_DISTRIBUTION_COMPONENTS)
set(export_to_${projectname}exports EXPORT ${upperprojectname}Exports)
set_property(GLOBAL PROPERTY ${upperprojectname}_HAS_EXPORTS True)
endif()
install(TARGETS ${name}
${export_to_${projectname}exports}
RUNTIME DESTINATION ${${upperprojectname}_TOOLS_INSTALL_DIR}
COMPONENT ${name})
if (NOT LLVM_ENABLE_IDE)
add_llvm_install_targets(install-${name}
DEPENDS ${name}
COMPONENT ${name})
endif()
endif()
endif()
if( ${upperprojectname}_BUILD_TOOLS )
set_property(GLOBAL APPEND PROPERTY ${upperprojectname}_EXPORTS ${name})
endif()
set_target_properties(${name} PROPERTIES FOLDER "Tools")
endmacro(add_${projectname}_tool name)
macro(add_${projectname}_example name)
if( NOT ${upperprojectname}_BUILD_EXAMPLES )
set(EXCLUDE_FROM_ALL ON)
endif()
add_llvm_executable(${name} ${ARGN})
if( ${upperprojectname}_BUILD_EXAMPLES )
install(TARGETS ${name} RUNTIME DESTINATION examples)
endif()
set_target_properties(${name} PROPERTIES FOLDER "Examples")
endmacro(add_${projectname}_example name)
macro(add_${projectname}_example_library name)
if( NOT ${upperprojectname}_BUILD_EXAMPLES )
set(EXCLUDE_FROM_ALL ON)
add_llvm_library(${name} BUILDTREE_ONLY ${ARGN})
else()
add_llvm_library(${name} ${ARGN})
endif()
set_target_properties(${name} PROPERTIES FOLDER "Examples")
endmacro(add_${projectname}_example_library name)
# This is a macro that is used to create targets for executables that are needed
# for development, but that are not intended to be installed by default.
macro(add_${projectname}_utility name)
if ( NOT ${upperprojectname}_BUILD_UTILS )
set(EXCLUDE_FROM_ALL ON)
endif()
add_llvm_executable(${name} DISABLE_LLVM_LINK_LLVM_DYLIB ${ARGN})
set_target_properties(${name} PROPERTIES FOLDER "Utils")
if (NOT ${upperprojectname}_INSTALL_TOOLCHAIN_ONLY)
if (${upperprojectname}_INSTALL_UTILS AND ${upperprojectname}_BUILD_UTILS)
set(export_to_${projectname}exports)
if (${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
NOT LLVM_DISTRIBUTION_COMPONENTS)
set(export_to_${projectname}exports EXPORT ${upperprojectname}Exports)
set_property(GLOBAL PROPERTY ${upperprojectname}_HAS_EXPORTS True)
endif()
install(TARGETS ${name}
${export_to_${projectname}exports}
RUNTIME DESTINATION ${LLVM_UTILS_INSTALL_DIR}
COMPONENT ${name})
if (NOT LLVM_ENABLE_IDE)
add_llvm_install_targets(install-${name}
DEPENDS ${name}
COMPONENT ${name})
endif()
set_property(GLOBAL APPEND PROPERTY ${upperprojectname}_EXPORTS ${name})
elseif(${upperprojectname}_BUILD_UTILS)
set_property(GLOBAL APPEND PROPERTY ${upperprojectname}_EXPORTS_BUILDTREE_ONLY ${name})
endif()
endif()
endmacro(add_${projectname}_utility name)
endfunction(add_llvm_project_targets)