Commit e329f010 by Nicolas Capens Committed by Nicolas Capens

Exclude all static libraries from "all" build target

This ensures these intermediate targets only get built when needed, and allows reducing the complexity of conditional logic. Bug: b/151250656 Change-Id: I3cbc2cc7a4c3d6f3691eeeef55d381ef03c2db9f Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42308 Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAntonio Maiorano <amaiorano@google.com>
parent 8bce0676
...@@ -1572,155 +1572,151 @@ endif() ...@@ -1572,155 +1572,151 @@ endif()
# Subzero # Subzero
########################################################### ###########################################################
if(${REACTOR_BACKEND} STREQUAL "Subzero") set(SUBZERO_LIST
set(SUBZERO_LIST ${SUBZERO_DIR}/src/IceAssembler.cpp
${SUBZERO_DIR}/src/IceAssembler.cpp ${SUBZERO_DIR}/src/IceCfg.cpp
${SUBZERO_DIR}/src/IceCfg.cpp ${SUBZERO_DIR}/src/IceCfgNode.cpp
${SUBZERO_DIR}/src/IceCfgNode.cpp ${SUBZERO_DIR}/src/IceClFlags.cpp
${SUBZERO_DIR}/src/IceClFlags.cpp ${SUBZERO_DIR}/src/IceELFObjectWriter.cpp
${SUBZERO_DIR}/src/IceELFObjectWriter.cpp ${SUBZERO_DIR}/src/IceELFSection.cpp
${SUBZERO_DIR}/src/IceELFSection.cpp ${SUBZERO_DIR}/src/IceFixups.cpp
${SUBZERO_DIR}/src/IceFixups.cpp ${SUBZERO_DIR}/src/IceGlobalContext.cpp
${SUBZERO_DIR}/src/IceGlobalContext.cpp ${SUBZERO_DIR}/src/IceGlobalInits.cpp
${SUBZERO_DIR}/src/IceGlobalInits.cpp ${SUBZERO_DIR}/src/IceInst.cpp
${SUBZERO_DIR}/src/IceInst.cpp ${SUBZERO_DIR}/src/IceInstrumentation.cpp
${SUBZERO_DIR}/src/IceInstrumentation.cpp ${SUBZERO_DIR}/src/IceIntrinsics.cpp
${SUBZERO_DIR}/src/IceIntrinsics.cpp ${SUBZERO_DIR}/src/IceLiveness.cpp
${SUBZERO_DIR}/src/IceLiveness.cpp ${SUBZERO_DIR}/src/IceLoopAnalyzer.cpp
${SUBZERO_DIR}/src/IceLoopAnalyzer.cpp ${SUBZERO_DIR}/src/IceMangling.cpp
${SUBZERO_DIR}/src/IceMangling.cpp ${SUBZERO_DIR}/src/IceMemory.cpp
${SUBZERO_DIR}/src/IceMemory.cpp ${SUBZERO_DIR}/src/IceOperand.cpp
${SUBZERO_DIR}/src/IceOperand.cpp ${SUBZERO_DIR}/src/IceRangeSpec.cpp
${SUBZERO_DIR}/src/IceRangeSpec.cpp ${SUBZERO_DIR}/src/IceRegAlloc.cpp
${SUBZERO_DIR}/src/IceRegAlloc.cpp ${SUBZERO_DIR}/src/IceRevision.cpp
${SUBZERO_DIR}/src/IceRevision.cpp ${SUBZERO_DIR}/src/IceRNG.cpp
${SUBZERO_DIR}/src/IceRNG.cpp ${SUBZERO_DIR}/src/IceSwitchLowering.cpp
${SUBZERO_DIR}/src/IceSwitchLowering.cpp ${SUBZERO_DIR}/src/IceTargetLowering.cpp
${SUBZERO_DIR}/src/IceTargetLowering.cpp ${SUBZERO_DIR}/src/IceThreading.cpp
${SUBZERO_DIR}/src/IceThreading.cpp ${SUBZERO_DIR}/src/IceTimerTree.cpp
${SUBZERO_DIR}/src/IceTimerTree.cpp ${SUBZERO_DIR}/src/IceTypes.cpp
${SUBZERO_DIR}/src/IceTypes.cpp ${SUBZERO_DIR}/src/IceVariableSplitting.cpp
${SUBZERO_DIR}/src/IceVariableSplitting.cpp )
)
# FIXME: Shouldn't depend on external source files directly. # FIXME: Shouldn't depend on external source files directly.
list(APPEND SUBZERO_LIST
${SOURCE_DIR}/Common/Memory.cpp
)
if(ARCH STREQUAL "x86_64")
list(APPEND SUBZERO_LIST list(APPEND SUBZERO_LIST
${SOURCE_DIR}/Common/Memory.cpp ${SUBZERO_DIR}/src/IceTargetLoweringX86.cpp
${SUBZERO_DIR}/src/IceInstX8664.cpp
${SUBZERO_DIR}/src/IceTargetLoweringX8664.cpp
) )
set(SUBZERO_TARGET X8664)
if(ARCH STREQUAL "x86_64") elseif(ARCH STREQUAL "x86")
list(APPEND SUBZERO_LIST list(APPEND SUBZERO_LIST
${SUBZERO_DIR}/src/IceTargetLoweringX86.cpp ${SUBZERO_DIR}/src/IceTargetLoweringX86.cpp
${SUBZERO_DIR}/src/IceInstX8664.cpp ${SUBZERO_DIR}/src/IceInstX8632.cpp
${SUBZERO_DIR}/src/IceTargetLoweringX8664.cpp ${SUBZERO_DIR}/src/IceTargetLoweringX8632.cpp
)
set(SUBZERO_TARGET X8664)
elseif(ARCH STREQUAL "x86")
list(APPEND SUBZERO_LIST
${SUBZERO_DIR}/src/IceTargetLoweringX86.cpp
${SUBZERO_DIR}/src/IceInstX8632.cpp
${SUBZERO_DIR}/src/IceTargetLoweringX8632.cpp
)
set(SUBZERO_TARGET X8632)
elseif(ARCH STREQUAL "arm")
list(APPEND SUBZERO_LIST
${SUBZERO_DIR}/src/IceAssemblerARM32.cpp
${SUBZERO_DIR}/src/IceInstARM32.cpp
${SUBZERO_DIR}/src/IceTargetLoweringARM32.cpp
)
set(SUBZERO_TARGET ARM32)
elseif(ARCH STREQUAL "mipsel")
list(APPEND SUBZERO_LIST
${SUBZERO_DIR}/src/IceAssemblerMIPS32.cpp
${SUBZERO_DIR}/src/IceInstMIPS32.cpp
${SUBZERO_DIR}/src/IceTargetLoweringMIPS32.cpp
)
set(SUBZERO_TARGET MIPS32)
else()
message(FATAL_ERROR "Architecture '${ARCH}' not supported by Subzero")
endif()
file(GLOB_RECURSE SUBZERO_DEPENDENCIES_LIST
${SUBZERO_LLVM_DIR}/*.cpp
${SUBZERO_LLVM_DIR}/*.c
${SUBZERO_LLVM_DIR}/*.h
) )
set(SUBZERO_TARGET X8632)
set(SUBZERO_REACTOR_LIST elseif(ARCH STREQUAL "arm")
${SOURCE_DIR}/Reactor/Debug.cpp list(APPEND SUBZERO_LIST
${SOURCE_DIR}/Reactor/Debug.hpp ${SUBZERO_DIR}/src/IceAssemblerARM32.cpp
${SOURCE_DIR}/Reactor/EmulatedReactor.cpp ${SUBZERO_DIR}/src/IceInstARM32.cpp
${SOURCE_DIR}/Reactor/ExecutableMemory.cpp ${SUBZERO_DIR}/src/IceTargetLoweringARM32.cpp
${SOURCE_DIR}/Reactor/ExecutableMemory.hpp
${SOURCE_DIR}/Reactor/Nucleus.hpp
${SOURCE_DIR}/Reactor/Optimizer.cpp
${SOURCE_DIR}/Reactor/Print.hpp
${SOURCE_DIR}/Reactor/Reactor.cpp
${SOURCE_DIR}/Reactor/Reactor.hpp
${SOURCE_DIR}/Reactor/ReactorDebugInfo.cpp
${SOURCE_DIR}/Reactor/ReactorDebugInfo.hpp
${SOURCE_DIR}/Reactor/Routine.hpp
${SOURCE_DIR}/Reactor/SubzeroReactor.cpp
) )
set(SUBZERO_TARGET ARM32)
set(SUBZERO_INCLUDE_DIR elseif(ARCH STREQUAL "mipsel")
${SUBZERO_DIR}/ list(APPEND SUBZERO_LIST
${SUBZERO_LLVM_DIR}/include/ ${SUBZERO_DIR}/src/IceAssemblerMIPS32.cpp
${SUBZERO_DIR}/pnacl-llvm/include/ ${SUBZERO_DIR}/src/IceInstMIPS32.cpp
${SUBZERO_DIR}/src/IceTargetLoweringMIPS32.cpp
) )
set(SUBZERO_TARGET MIPS32)
else()
message(FATAL_ERROR "Architecture '${ARCH}' not supported by Subzero")
endif()
if(WIN32) file(GLOB_RECURSE SUBZERO_DEPENDENCIES_LIST
list(APPEND SUBZERO_INCLUDE_DIR ${SUBZERO_LLVM_DIR}/build/Windows/include/) ${SUBZERO_LLVM_DIR}/*.cpp
elseif(LINUX) ${SUBZERO_LLVM_DIR}/*.c
list(APPEND SUBZERO_INCLUDE_DIR ${SUBZERO_LLVM_DIR}/build/Linux/include/) ${SUBZERO_LLVM_DIR}/*.h
elseif(APPLE) )
list(APPEND SUBZERO_INCLUDE_DIR ${SUBZERO_LLVM_DIR}/build/MacOS/include/)
endif()
if(WIN32) set(SUBZERO_REACTOR_LIST
list(APPEND SUBZERO_COMPILE_OPTIONS ${SOURCE_DIR}/Reactor/Debug.cpp
"/wd4146" # unary minus operator applied to unsigned type, result still unsigned ${SOURCE_DIR}/Reactor/Debug.hpp
"/wd4334" # ''operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) ${SOURCE_DIR}/Reactor/EmulatedReactor.cpp
"/wd4996" # The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: new_name. ${SOURCE_DIR}/Reactor/ExecutableMemory.cpp
) ${SOURCE_DIR}/Reactor/ExecutableMemory.hpp
list(APPEND SUBZERO_DEPENDENCIES_COMPILE_OPTIONS ${SOURCE_DIR}/Reactor/Nucleus.hpp
${SUBZERO_COMPILE_OPTIONS} ${SOURCE_DIR}/Reactor/Optimizer.cpp
"/wd4267" # '=': conversion from 'size_t' to 'sopno', possible loss of data ${SOURCE_DIR}/Reactor/Print.hpp
"/wd4244" # '=': conversion from '__int64' to 'llvm_regoff_t', possible loss of data ${SOURCE_DIR}/Reactor/Reactor.cpp
"/wd4141" # 'inline': used more than once ${SOURCE_DIR}/Reactor/Reactor.hpp
"/wd4291" # 'void *operator new(size_t,const `anonymous-namespace'::NamedBufferAlloc &)': no matching operator delete found; memory will not be freed if initialization throws an exception ${SOURCE_DIR}/Reactor/ReactorDebugInfo.cpp
) ${SOURCE_DIR}/Reactor/ReactorDebugInfo.hpp
endif() ${SOURCE_DIR}/Reactor/Routine.hpp
${SOURCE_DIR}/Reactor/SubzeroReactor.cpp
)
add_library(SubzeroDependencies STATIC set(SUBZERO_INCLUDE_DIR
${SUBZERO_DEPENDENCIES_LIST} ${SUBZERO_DIR}/
) ${SUBZERO_LLVM_DIR}/include/
set_target_properties(SubzeroDependencies PROPERTIES ${SUBZERO_DIR}/pnacl-llvm/include/
POSITION_INDEPENDENT_CODE 1 )
INCLUDE_DIRECTORIES "${SUBZERO_INCLUDE_DIR}"
COMPILE_OPTIONS "${SUBZERO_DEPENDENCIES_COMPILE_OPTIONS}"
FOLDER "Subzero"
)
add_library(ReactorSubzero STATIC if(WIN32)
${SUBZERO_LIST} list(APPEND SUBZERO_INCLUDE_DIR ${SUBZERO_LLVM_DIR}/build/Windows/include/)
${SUBZERO_REACTOR_LIST} elseif(LINUX)
list(APPEND SUBZERO_INCLUDE_DIR ${SUBZERO_LLVM_DIR}/build/Linux/include/)
elseif(APPLE)
list(APPEND SUBZERO_INCLUDE_DIR ${SUBZERO_LLVM_DIR}/build/MacOS/include/)
endif()
if(WIN32)
list(APPEND SUBZERO_COMPILE_OPTIONS
"/wd4146" # unary minus operator applied to unsigned type, result still unsigned
"/wd4334" # ''operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
"/wd4996" # The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: new_name.
) )
set_target_properties(ReactorSubzero PROPERTIES list(APPEND SUBZERO_DEPENDENCIES_COMPILE_OPTIONS
POSITION_INDEPENDENT_CODE 1 ${SUBZERO_COMPILE_OPTIONS}
INCLUDE_DIRECTORIES "${SUBZERO_INCLUDE_DIR}" "/wd4267" # '=': conversion from 'size_t' to 'sopno', possible loss of data
COMPILE_OPTIONS "${SUBZERO_COMPILE_OPTIONS};${SWIFTSHADER_COMPILE_OPTIONS};${WARNINGS_AS_ERRORS}" "/wd4244" # '=': conversion from '__int64' to 'llvm_regoff_t', possible loss of data
COMPILE_DEFINITIONS "SZTARGET=${SUBZERO_TARGET}; ALLOW_DUMP=0; ALLOW_TIMERS=0; ALLOW_LLVM_CL=0; ALLOW_LLVM_IR=0; ALLOW_LLVM_IR_AS_INPUT=0; ALLOW_MINIMAL_BUILD=0; ALLOW_WASM=0; ICE_THREAD_LOCAL_HACK=0;" "/wd4141" # 'inline': used more than once
FOLDER "Subzero" "/wd4291" # 'void *operator new(size_t,const `anonymous-namespace'::NamedBufferAlloc &)': no matching operator delete found; memory will not be freed if initialization throws an exception
) )
target_link_libraries(ReactorSubzero SubzeroDependencies) endif()
target_link_libraries(ReactorSubzero marl) add_library(SubzeroDependencies STATIC EXCLUDE_FROM_ALL
${SUBZERO_DEPENDENCIES_LIST}
)
set_target_properties(SubzeroDependencies PROPERTIES
POSITION_INDEPENDENT_CODE 1
INCLUDE_DIRECTORIES "${SUBZERO_INCLUDE_DIR}"
COMPILE_OPTIONS "${SUBZERO_DEPENDENCIES_COMPILE_OPTIONS}"
FOLDER "Subzero"
)
if(WIN32) add_library(ReactorSubzero STATIC EXCLUDE_FROM_ALL
target_compile_definitions(ReactorSubzero PRIVATE SUBZERO_USE_MICROSOFT_ABI) ${SUBZERO_LIST}
endif() ${SUBZERO_REACTOR_LIST}
endif(${REACTOR_BACKEND} STREQUAL "Subzero") )
set_target_properties(ReactorSubzero PROPERTIES
POSITION_INDEPENDENT_CODE 1
INCLUDE_DIRECTORIES "${SUBZERO_INCLUDE_DIR}"
COMPILE_OPTIONS "${SUBZERO_COMPILE_OPTIONS};${SWIFTSHADER_COMPILE_OPTIONS};${WARNINGS_AS_ERRORS}"
COMPILE_DEFINITIONS "SZTARGET=${SUBZERO_TARGET}; ALLOW_DUMP=0; ALLOW_TIMERS=0; ALLOW_LLVM_CL=0; ALLOW_LLVM_IR=0; ALLOW_LLVM_IR_AS_INPUT=0; ALLOW_MINIMAL_BUILD=0; ALLOW_WASM=0; ICE_THREAD_LOCAL_HACK=0;"
FOLDER "Subzero"
)
target_link_libraries(ReactorSubzero SubzeroDependencies marl)
if(WIN32)
target_compile_definitions(ReactorSubzero PRIVATE SUBZERO_USE_MICROSOFT_ABI)
endif()
########################################################### ###########################################################
# Include Directories # Include Directories
...@@ -2032,7 +2028,7 @@ endif() ...@@ -2032,7 +2028,7 @@ endif()
# SwiftShader Targets # SwiftShader Targets
########################################################### ###########################################################
add_library(SwiftShader STATIC ${SWIFTSHADER_LIST}) add_library(SwiftShader STATIC EXCLUDE_FROM_ALL ${SWIFTSHADER_LIST})
set_target_properties(SwiftShader PROPERTIES set_target_properties(SwiftShader PROPERTIES
INCLUDE_DIRECTORIES "${COMMON_INCLUDE_DIR}" INCLUDE_DIRECTORIES "${COMMON_INCLUDE_DIR}"
POSITION_INDEPENDENT_CODE 1 POSITION_INDEPENDENT_CODE 1
...@@ -2042,15 +2038,16 @@ set_target_properties(SwiftShader PROPERTIES ...@@ -2042,15 +2038,16 @@ set_target_properties(SwiftShader PROPERTIES
) )
target_link_libraries(SwiftShader ${OS_LIBS}) target_link_libraries(SwiftShader ${OS_LIBS})
add_library(ReactorLLVM STATIC EXCLUDE_FROM_ALL ${REACTOR_LLVM_LIST})
set_target_properties(ReactorLLVM PROPERTIES
INCLUDE_DIRECTORIES "${COMMON_INCLUDE_DIR}"
POSITION_INDEPENDENT_CODE 1
FOLDER "Core"
COMPILE_OPTIONS "${SWIFTSHADER_COMPILE_OPTIONS};${WARNINGS_AS_ERRORS}"
)
target_link_libraries(ReactorLLVM llvm ${OS_LIBS})
if(${REACTOR_BACKEND} STREQUAL "LLVM") if(${REACTOR_BACKEND} STREQUAL "LLVM")
add_library(ReactorLLVM STATIC ${REACTOR_LLVM_LIST})
set_target_properties(ReactorLLVM PROPERTIES
INCLUDE_DIRECTORIES "${COMMON_INCLUDE_DIR}"
POSITION_INDEPENDENT_CODE 1
FOLDER "Core"
COMPILE_OPTIONS "${SWIFTSHADER_COMPILE_OPTIONS};${WARNINGS_AS_ERRORS}"
)
target_link_libraries(ReactorLLVM llvm ${OS_LIBS})
set(Reactor ReactorLLVM) set(Reactor ReactorLLVM)
elseif(${REACTOR_BACKEND} STREQUAL "Subzero") elseif(${REACTOR_BACKEND} STREQUAL "Subzero")
set(Reactor ReactorSubzero) set(Reactor ReactorSubzero)
...@@ -2070,7 +2067,7 @@ if(REACTOR_EMIT_DEBUG_INFO) ...@@ -2070,7 +2067,7 @@ if(REACTOR_EMIT_DEBUG_INFO)
# Boost stacktrace uses exceptions, so force enable it # Boost stacktrace uses exceptions, so force enable it
set_cpp_flag("-fexceptions") set_cpp_flag("-fexceptions")
add_library(Libbacktrace STATIC ${LIBBACKTRACE_LIST}) add_library(Libbacktrace STATIC EXCLUDE_FROM_ALL ${LIBBACKTRACE_LIST})
set_target_properties(Libbacktrace PROPERTIES set_target_properties(Libbacktrace PROPERTIES
INCLUDE_DIRECTORIES "${LIBBACKTRACE_INCLUDE_DIR}" INCLUDE_DIRECTORIES "${LIBBACKTRACE_INCLUDE_DIR}"
POSITION_INDEPENDENT_CODE 1 POSITION_INDEPENDENT_CODE 1
...@@ -2085,10 +2082,9 @@ if(REACTOR_EMIT_DEBUG_INFO) ...@@ -2085,10 +2082,9 @@ if(REACTOR_EMIT_DEBUG_INFO)
set(BOOST_INCLUDEDIR ${BOOST_THIRD_PARTY_DIR}) set(BOOST_INCLUDEDIR ${BOOST_THIRD_PARTY_DIR})
find_package(Boost REQUIRED) find_package(Boost REQUIRED)
target_link_libraries(${Reactor} Boost::boost) target_link_libraries(${Reactor} Boost::boost)
endif(REACTOR_EMIT_DEBUG_INFO) endif(REACTOR_EMIT_DEBUG_INFO)
add_library(GLCompiler STATIC ${OPENGL_COMPILER_LIST}) add_library(GLCompiler STATIC EXCLUDE_FROM_ALL ${OPENGL_COMPILER_LIST})
set_target_properties(GLCompiler PROPERTIES set_target_properties(GLCompiler PROPERTIES
INCLUDE_DIRECTORIES "${OPENGL_INCLUDE_DIR}" INCLUDE_DIRECTORIES "${OPENGL_INCLUDE_DIR}"
POSITION_INDEPENDENT_CODE 1 POSITION_INDEPENDENT_CODE 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment