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,8 +1572,7 @@ endif() ...@@ -1572,8 +1572,7 @@ 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
...@@ -1601,52 +1600,52 @@ if(${REACTOR_BACKEND} STREQUAL "Subzero") ...@@ -1601,52 +1600,52 @@ if(${REACTOR_BACKEND} STREQUAL "Subzero")
${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 list(APPEND SUBZERO_LIST
${SOURCE_DIR}/Common/Memory.cpp ${SOURCE_DIR}/Common/Memory.cpp
) )
if(ARCH STREQUAL "x86_64") if(ARCH STREQUAL "x86_64")
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/IceInstX8664.cpp
${SUBZERO_DIR}/src/IceTargetLoweringX8664.cpp ${SUBZERO_DIR}/src/IceTargetLoweringX8664.cpp
) )
set(SUBZERO_TARGET X8664) set(SUBZERO_TARGET X8664)
elseif(ARCH STREQUAL "x86") 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/IceInstX8632.cpp ${SUBZERO_DIR}/src/IceInstX8632.cpp
${SUBZERO_DIR}/src/IceTargetLoweringX8632.cpp ${SUBZERO_DIR}/src/IceTargetLoweringX8632.cpp
) )
set(SUBZERO_TARGET X8632) set(SUBZERO_TARGET X8632)
elseif(ARCH STREQUAL "arm") elseif(ARCH STREQUAL "arm")
list(APPEND SUBZERO_LIST list(APPEND SUBZERO_LIST
${SUBZERO_DIR}/src/IceAssemblerARM32.cpp ${SUBZERO_DIR}/src/IceAssemblerARM32.cpp
${SUBZERO_DIR}/src/IceInstARM32.cpp ${SUBZERO_DIR}/src/IceInstARM32.cpp
${SUBZERO_DIR}/src/IceTargetLoweringARM32.cpp ${SUBZERO_DIR}/src/IceTargetLoweringARM32.cpp
) )
set(SUBZERO_TARGET ARM32) set(SUBZERO_TARGET ARM32)
elseif(ARCH STREQUAL "mipsel") elseif(ARCH STREQUAL "mipsel")
list(APPEND SUBZERO_LIST list(APPEND SUBZERO_LIST
${SUBZERO_DIR}/src/IceAssemblerMIPS32.cpp ${SUBZERO_DIR}/src/IceAssemblerMIPS32.cpp
${SUBZERO_DIR}/src/IceInstMIPS32.cpp ${SUBZERO_DIR}/src/IceInstMIPS32.cpp
${SUBZERO_DIR}/src/IceTargetLoweringMIPS32.cpp ${SUBZERO_DIR}/src/IceTargetLoweringMIPS32.cpp
) )
set(SUBZERO_TARGET MIPS32) set(SUBZERO_TARGET MIPS32)
else() else()
message(FATAL_ERROR "Architecture '${ARCH}' not supported by Subzero") message(FATAL_ERROR "Architecture '${ARCH}' not supported by Subzero")
endif() endif()
file(GLOB_RECURSE SUBZERO_DEPENDENCIES_LIST file(GLOB_RECURSE SUBZERO_DEPENDENCIES_LIST
${SUBZERO_LLVM_DIR}/*.cpp ${SUBZERO_LLVM_DIR}/*.cpp
${SUBZERO_LLVM_DIR}/*.c ${SUBZERO_LLVM_DIR}/*.c
${SUBZERO_LLVM_DIR}/*.h ${SUBZERO_LLVM_DIR}/*.h
) )
set(SUBZERO_REACTOR_LIST set(SUBZERO_REACTOR_LIST
${SOURCE_DIR}/Reactor/Debug.cpp ${SOURCE_DIR}/Reactor/Debug.cpp
${SOURCE_DIR}/Reactor/Debug.hpp ${SOURCE_DIR}/Reactor/Debug.hpp
${SOURCE_DIR}/Reactor/EmulatedReactor.cpp ${SOURCE_DIR}/Reactor/EmulatedReactor.cpp
...@@ -1661,23 +1660,23 @@ if(${REACTOR_BACKEND} STREQUAL "Subzero") ...@@ -1661,23 +1660,23 @@ if(${REACTOR_BACKEND} STREQUAL "Subzero")
${SOURCE_DIR}/Reactor/ReactorDebugInfo.hpp ${SOURCE_DIR}/Reactor/ReactorDebugInfo.hpp
${SOURCE_DIR}/Reactor/Routine.hpp ${SOURCE_DIR}/Reactor/Routine.hpp
${SOURCE_DIR}/Reactor/SubzeroReactor.cpp ${SOURCE_DIR}/Reactor/SubzeroReactor.cpp
) )
set(SUBZERO_INCLUDE_DIR set(SUBZERO_INCLUDE_DIR
${SUBZERO_DIR}/ ${SUBZERO_DIR}/
${SUBZERO_LLVM_DIR}/include/ ${SUBZERO_LLVM_DIR}/include/
${SUBZERO_DIR}/pnacl-llvm/include/ ${SUBZERO_DIR}/pnacl-llvm/include/
) )
if(WIN32) if(WIN32)
list(APPEND SUBZERO_INCLUDE_DIR ${SUBZERO_LLVM_DIR}/build/Windows/include/) list(APPEND SUBZERO_INCLUDE_DIR ${SUBZERO_LLVM_DIR}/build/Windows/include/)
elseif(LINUX) elseif(LINUX)
list(APPEND SUBZERO_INCLUDE_DIR ${SUBZERO_LLVM_DIR}/build/Linux/include/) list(APPEND SUBZERO_INCLUDE_DIR ${SUBZERO_LLVM_DIR}/build/Linux/include/)
elseif(APPLE) elseif(APPLE)
list(APPEND SUBZERO_INCLUDE_DIR ${SUBZERO_LLVM_DIR}/build/MacOS/include/) list(APPEND SUBZERO_INCLUDE_DIR ${SUBZERO_LLVM_DIR}/build/MacOS/include/)
endif() endif()
if(WIN32) if(WIN32)
list(APPEND SUBZERO_COMPILE_OPTIONS list(APPEND SUBZERO_COMPILE_OPTIONS
"/wd4146" # unary minus operator applied to unsigned type, result still unsigned "/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?) "/wd4334" # ''operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
...@@ -1690,37 +1689,34 @@ if(${REACTOR_BACKEND} STREQUAL "Subzero") ...@@ -1690,37 +1689,34 @@ if(${REACTOR_BACKEND} STREQUAL "Subzero")
"/wd4141" # 'inline': used more than once "/wd4141" # 'inline': used more than once
"/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 "/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
) )
endif() endif()
add_library(SubzeroDependencies STATIC add_library(SubzeroDependencies STATIC EXCLUDE_FROM_ALL
${SUBZERO_DEPENDENCIES_LIST} ${SUBZERO_DEPENDENCIES_LIST}
) )
set_target_properties(SubzeroDependencies PROPERTIES set_target_properties(SubzeroDependencies PROPERTIES
POSITION_INDEPENDENT_CODE 1 POSITION_INDEPENDENT_CODE 1
INCLUDE_DIRECTORIES "${SUBZERO_INCLUDE_DIR}" INCLUDE_DIRECTORIES "${SUBZERO_INCLUDE_DIR}"
COMPILE_OPTIONS "${SUBZERO_DEPENDENCIES_COMPILE_OPTIONS}" COMPILE_OPTIONS "${SUBZERO_DEPENDENCIES_COMPILE_OPTIONS}"
FOLDER "Subzero" FOLDER "Subzero"
) )
add_library(ReactorSubzero STATIC add_library(ReactorSubzero STATIC EXCLUDE_FROM_ALL
${SUBZERO_LIST} ${SUBZERO_LIST}
${SUBZERO_REACTOR_LIST} ${SUBZERO_REACTOR_LIST}
) )
set_target_properties(ReactorSubzero PROPERTIES set_target_properties(ReactorSubzero PROPERTIES
POSITION_INDEPENDENT_CODE 1 POSITION_INDEPENDENT_CODE 1
INCLUDE_DIRECTORIES "${SUBZERO_INCLUDE_DIR}" INCLUDE_DIRECTORIES "${SUBZERO_INCLUDE_DIR}"
COMPILE_OPTIONS "${SUBZERO_COMPILE_OPTIONS};${SWIFTSHADER_COMPILE_OPTIONS};${WARNINGS_AS_ERRORS}" 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;" 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" FOLDER "Subzero"
) )
target_link_libraries(ReactorSubzero SubzeroDependencies) target_link_libraries(ReactorSubzero SubzeroDependencies marl)
target_link_libraries(ReactorSubzero marl)
if(WIN32) if(WIN32)
target_compile_definitions(ReactorSubzero PRIVATE SUBZERO_USE_MICROSOFT_ABI) target_compile_definitions(ReactorSubzero PRIVATE SUBZERO_USE_MICROSOFT_ABI)
endif() endif()
endif(${REACTOR_BACKEND} STREQUAL "Subzero")
########################################################### ###########################################################
# 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})
if(${REACTOR_BACKEND} STREQUAL "LLVM") add_library(ReactorLLVM STATIC EXCLUDE_FROM_ALL ${REACTOR_LLVM_LIST})
add_library(ReactorLLVM STATIC ${REACTOR_LLVM_LIST}) set_target_properties(ReactorLLVM PROPERTIES
set_target_properties(ReactorLLVM PROPERTIES
INCLUDE_DIRECTORIES "${COMMON_INCLUDE_DIR}" INCLUDE_DIRECTORIES "${COMMON_INCLUDE_DIR}"
POSITION_INDEPENDENT_CODE 1 POSITION_INDEPENDENT_CODE 1
FOLDER "Core" FOLDER "Core"
COMPILE_OPTIONS "${SWIFTSHADER_COMPILE_OPTIONS};${WARNINGS_AS_ERRORS}" COMPILE_OPTIONS "${SWIFTSHADER_COMPILE_OPTIONS};${WARNINGS_AS_ERRORS}"
) )
target_link_libraries(ReactorLLVM llvm ${OS_LIBS}) target_link_libraries(ReactorLLVM llvm ${OS_LIBS})
if(${REACTOR_BACKEND} STREQUAL "LLVM")
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