forked from OSchip/llvm-project
[libc] Revert "Propagate entrypoint deps to downstream targets."
This reverts commit 20cb440ea2
as the
target llvmlibc seems to be failing on the bots.
This commit is contained in:
parent
66590e1e9e
commit
a8086ba4ac
|
@ -1,46 +1,8 @@
|
||||||
# This is a helper function and not a build rule. It is to be used by the
|
|
||||||
# the "add_entrypoint_library" rule to generate the full list of object files
|
|
||||||
# recursively produced by "add_object_library" targets upstream in the
|
|
||||||
# dependency tree. This function traverses up through the
|
|
||||||
# "add_entrypoint_object" targets but does not collect the object files
|
|
||||||
# produced by them.
|
|
||||||
# Usage:
|
|
||||||
# get_object_files_for_test(<result var> <target0> [<target1> ...])
|
|
||||||
#
|
|
||||||
# targetN is either an "add_entrypoint_target" target or an
|
|
||||||
# "add_object_library" target.
|
|
||||||
function(get_object_files_for_entrypoint_library result)
|
|
||||||
set(object_files "")
|
|
||||||
foreach(dep IN LISTS ARGN)
|
|
||||||
get_target_property(dep_type ${dep} "TARGET_TYPE")
|
|
||||||
if (NOT dep_type)
|
|
||||||
continue()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(${dep_type} STREQUAL ${OBJECT_LIBRARY_TARGET_TYPE})
|
|
||||||
get_target_property(dep_object_files ${dep} "OBJECT_FILES")
|
|
||||||
if(dep_object_files)
|
|
||||||
list(APPEND object_files ${dep_object_files})
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
get_target_property(indirect_deps ${dep} "DEPS")
|
|
||||||
get_object_files_for_entrypoint_library(indirect_objfiles ${indirect_deps})
|
|
||||||
list(APPEND object_files ${indirect_objfiles})
|
|
||||||
endforeach(dep)
|
|
||||||
list(REMOVE_DUPLICATES object_files)
|
|
||||||
set(${result} ${object_files} PARENT_SCOPE)
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
# A rule to build a library from a collection of entrypoint objects.
|
# A rule to build a library from a collection of entrypoint objects.
|
||||||
# Usage:
|
# Usage:
|
||||||
# add_entrypoint_library(
|
# add_entrypoint_library(
|
||||||
# DEPENDS <list of add_entrypoint_object targets>
|
# DEPENDS <list of add_entrypoint_object targets>
|
||||||
# )
|
# )
|
||||||
#
|
|
||||||
# NOTE: If one wants an entrypoint to be availabe in a library, then they will
|
|
||||||
# have to list the entrypoint target explicitly in the DEPENDS list. Implicit
|
|
||||||
# entrypoint dependencies will not be added to the library.
|
|
||||||
function(add_entrypoint_library target_name)
|
function(add_entrypoint_library target_name)
|
||||||
cmake_parse_arguments(
|
cmake_parse_arguments(
|
||||||
"ENTRYPOINT_LIBRARY"
|
"ENTRYPOINT_LIBRARY"
|
||||||
|
@ -54,16 +16,15 @@ function(add_entrypoint_library target_name)
|
||||||
"of 'add_entrypoint_object' targets.")
|
"of 'add_entrypoint_object' targets.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
get_fq_deps_list(fq_deps_list ${ENTRYPOINT_LIBRARY_DEPENDS})
|
set(obj_list "")
|
||||||
get_object_files_for_entrypoint_library(obj_list ${fq_deps_list})
|
foreach(dep IN LISTS ENTRYPOINT_LIBRARY_DEPENDS)
|
||||||
foreach(dep IN LISTS fq_deps_list)
|
|
||||||
get_target_property(dep_type ${dep} "TARGET_TYPE")
|
get_target_property(dep_type ${dep} "TARGET_TYPE")
|
||||||
if(NOT (${dep_type} STREQUAL ${ENTRYPOINT_OBJ_TARGET_TYPE}))
|
if(NOT (${dep_type} STREQUAL ${ENTRYPOINT_OBJ_TARGET_TYPE}))
|
||||||
message(FATAL_ERROR "Dependency '${dep}' of 'add_entrypoint_collection' is "
|
message(FATAL_ERROR "Dependency '${dep}' of 'add_entrypoint_collection' is "
|
||||||
"not an 'add_entrypoint_object' target.")
|
"not an 'add_entrypoint_object' target.")
|
||||||
endif()
|
endif()
|
||||||
get_target_property(objfile ${dep} "OBJECT_FILE")
|
get_target_property(target_obj_files ${dep} "OBJECT_FILES")
|
||||||
list(APPEND obj_list ${objfile})
|
list(APPEND obj_list "${target_obj_files}")
|
||||||
endforeach(dep)
|
endforeach(dep)
|
||||||
list(REMOVE_DUPLICATES obj_list)
|
list(REMOVE_DUPLICATES obj_list)
|
||||||
|
|
||||||
|
@ -117,8 +78,6 @@ function(add_redirector_library target_name)
|
||||||
)
|
)
|
||||||
endfunction(add_redirector_library)
|
endfunction(add_redirector_library)
|
||||||
|
|
||||||
set(HDR_LIBRARY_TARGET_TYPE "HDR_LIBRARY")
|
|
||||||
|
|
||||||
# Rule to add header only libraries.
|
# Rule to add header only libraries.
|
||||||
# Usage
|
# Usage
|
||||||
# add_header_library(
|
# add_header_library(
|
||||||
|
@ -148,12 +107,12 @@ function(add_header_library target_name)
|
||||||
list(APPEND FULL_HDR_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/${hdr})
|
list(APPEND FULL_HDR_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/${hdr})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set(interface_target_name "${fq_target_name}.__header_library__")
|
set(interface_target_name "${fq_target_name}_header_library__")
|
||||||
|
|
||||||
add_library(${interface_target_name} INTERFACE)
|
add_library(${interface_target_name} INTERFACE)
|
||||||
target_sources(${interface_target_name} INTERFACE ${FULL_HDR_PATHS})
|
target_sources(${interface_target_name} INTERFACE ${FULL_HDR_PATHS})
|
||||||
get_fq_deps_list(fq_deps_list ${ADD_HEADER_DEPENDS})
|
|
||||||
if(ADD_HEADER_DEPENDS)
|
if(ADD_HEADER_DEPENDS)
|
||||||
|
get_fq_deps_list(fq_deps_list ${ADD_HEADER_DEPENDS})
|
||||||
add_dependencies(${interface_target_name} ${fq_deps_list})
|
add_dependencies(${interface_target_name} ${fq_deps_list})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -162,7 +121,6 @@ function(add_header_library target_name)
|
||||||
set_target_properties(
|
set_target_properties(
|
||||||
${fq_target_name}
|
${fq_target_name}
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
"TARGET_TYPE" "${HDR_LIBRARY_TARGET_TYPE}"
|
"TARGET_TYPE" "HDR_LIBRARY"
|
||||||
"DEPS" "${fq_deps_list}"
|
|
||||||
)
|
)
|
||||||
endfunction(add_header_library)
|
endfunction(add_header_library)
|
||||||
|
|
|
@ -43,17 +43,36 @@ function(add_object_library target_name)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
get_fq_deps_list(fq_deps_list ${ADD_OBJECT_DEPENDS})
|
set(all_object_files $<TARGET_OBJECTS:${fq_target_name}>)
|
||||||
if(fq_deps_list)
|
if(ADD_OBJECT_DEPENDS)
|
||||||
add_dependencies(${fq_target_name} ${fq_deps_list})
|
get_fq_deps_list(fq_deps_list ${ADD_OBJECT_DEPENDS})
|
||||||
|
add_dependencies(
|
||||||
|
${fq_target_name}
|
||||||
|
${fq_deps_list}
|
||||||
|
)
|
||||||
|
foreach(obj_target IN LISTS fq_deps_list)
|
||||||
|
if(NOT TARGET obj_target)
|
||||||
|
# Not all targets will be visible. So, we will ignore those which aren't
|
||||||
|
# visible yet.
|
||||||
|
continue()
|
||||||
|
endif()
|
||||||
|
get_target_property(obj_type ${obj_target} "TARGET_TYPE")
|
||||||
|
if((NOT obj_type) OR (NOT (${obj_type} STREQUAL ${OBJECT_LIBRARY_TARGET_TYPE})))
|
||||||
|
continue()
|
||||||
|
endif()
|
||||||
|
# If a dependency is also a object file library, we will collect the list of
|
||||||
|
# object files from it.
|
||||||
|
get_target_property(obj_files ${obj_target} "OBJECT_FILES")
|
||||||
|
list(APPEND all_object_files ${obj_files})
|
||||||
|
endforeach(obj_target)
|
||||||
endif()
|
endif()
|
||||||
|
list(REMOVE_DUPLICATES all_object_files)
|
||||||
|
|
||||||
set_target_properties(
|
set_target_properties(
|
||||||
${fq_target_name}
|
${fq_target_name}
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
"TARGET_TYPE" ${OBJECT_LIBRARY_TARGET_TYPE}
|
"TARGET_TYPE" ${OBJECT_LIBRARY_TARGET_TYPE}
|
||||||
"OBJECT_FILES" "$<TARGET_OBJECTS:${fq_target_name}>"
|
"OBJECT_FILES" "${all_object_files}"
|
||||||
"DEPS" "${fq_deps_list}"
|
|
||||||
)
|
)
|
||||||
endfunction(add_object_library)
|
endfunction(add_object_library)
|
||||||
|
|
||||||
|
@ -104,15 +123,14 @@ function(add_entrypoint_object target_name)
|
||||||
|
|
||||||
add_custom_target(${fq_target_name})
|
add_custom_target(${fq_target_name})
|
||||||
add_dependencies(${fq_target_name} ${fq_dep_name})
|
add_dependencies(${fq_target_name} ${fq_dep_name})
|
||||||
get_target_property(object_file ${fq_dep_name} "OBJECT_FILE")
|
get_target_property(all_objects ${fq_dep_name} "OBJECT_FILES")
|
||||||
get_target_property(object_file_raw ${fq_dep_name} "OBJECT_FILE_RAW")
|
get_target_property(all_objects_raw ${fq_dep_name} "OBJECT_FILES_RAW")
|
||||||
set_target_properties(
|
set_target_properties(
|
||||||
${fq_target_name}
|
${fq_target_name}
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
"TARGET_TYPE" ${ENTRYPOINT_OBJ_TARGET_TYPE}
|
"TARGET_TYPE" ${ENTRYPOINT_OBJ_TARGET_TYPE}
|
||||||
"OBJECT_FILE"
|
"OBJECT_FILES" "${all_objects}"
|
||||||
"OBJECT_FILE_RAW"
|
"OBJECT_FILES_RAW" "${all_objects_raw}"
|
||||||
"DEPS" "${fq_dep_name}"
|
|
||||||
)
|
)
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
@ -152,12 +170,38 @@ function(add_entrypoint_object target_name)
|
||||||
${LIBC_SOURCE_DIR}
|
${LIBC_SOURCE_DIR}
|
||||||
${LIBC_BUILD_DIR}
|
${LIBC_BUILD_DIR}
|
||||||
)
|
)
|
||||||
get_fq_deps_list(fq_deps_list ${ADD_ENTRYPOINT_OBJ_DEPENDS})
|
|
||||||
add_dependencies(
|
add_dependencies(
|
||||||
${objects_target_name}
|
${objects_target_name}
|
||||||
libc.src.__support.common
|
libc.src.__support.common
|
||||||
${fq_deps_list}
|
|
||||||
)
|
)
|
||||||
|
set(dep_objects "")
|
||||||
|
if(ADD_ENTRYPOINT_OBJ_DEPENDS)
|
||||||
|
get_fq_deps_list(fq_deps_list ${ADD_ENTRYPOINT_OBJ_DEPENDS})
|
||||||
|
add_dependencies(
|
||||||
|
${objects_target_name}
|
||||||
|
${fq_deps_list}
|
||||||
|
)
|
||||||
|
foreach(dep_target IN LISTS fq_deps_list)
|
||||||
|
if(NOT TARGET ${dep_target})
|
||||||
|
# Not all targets will be visible. So, we will ignore those which aren't
|
||||||
|
# visible yet.
|
||||||
|
continue()
|
||||||
|
endif()
|
||||||
|
get_target_property(obj_type ${dep_target} "TARGET_TYPE")
|
||||||
|
if((NOT obj_type) OR (NOT (${obj_type} STREQUAL ${OBJECT_LIBRARY_TARGET_TYPE})))
|
||||||
|
# Even from among the visible targets, we will collect object files
|
||||||
|
# only from add_object_library targets.
|
||||||
|
continue()
|
||||||
|
endif()
|
||||||
|
# Calling get_target_property requires that the target be visible at this
|
||||||
|
# point. For object library dependencies, this is a reasonable requirement.
|
||||||
|
# We can revisit this in future if we need cases which break under this
|
||||||
|
# requirement.
|
||||||
|
get_target_property(obj_files ${dep_target} "OBJECT_FILES")
|
||||||
|
list(APPEND dep_objects ${obj_files})
|
||||||
|
endforeach(dep_target)
|
||||||
|
endif()
|
||||||
|
list(REMOVE_DUPLICATES dep_objects)
|
||||||
|
|
||||||
if(ADD_ENTRYPOINT_OBJ_COMPILE_OPTIONS)
|
if(ADD_ENTRYPOINT_OBJ_COMPILE_OPTIONS)
|
||||||
target_compile_options(
|
target_compile_options(
|
||||||
|
@ -195,13 +239,16 @@ function(add_entrypoint_object target_name)
|
||||||
ALL
|
ALL
|
||||||
DEPENDS ${object_file}
|
DEPENDS ${object_file}
|
||||||
)
|
)
|
||||||
|
set(all_objects ${object_file})
|
||||||
|
list(APPEND all_objects ${dep_objects})
|
||||||
|
set(all_objects_raw ${object_file_raw})
|
||||||
|
list(APPEND all_objects_raw ${dep_objects})
|
||||||
set_target_properties(
|
set_target_properties(
|
||||||
${fq_target_name}
|
${fq_target_name}
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
"TARGET_TYPE" ${ENTRYPOINT_OBJ_TARGET_TYPE}
|
"TARGET_TYPE" ${ENTRYPOINT_OBJ_TARGET_TYPE}
|
||||||
"OBJECT_FILE" "${object_file}"
|
"OBJECT_FILES" "${all_objects}"
|
||||||
"OBJECT_FILE_RAW" "${object_file_raw}"
|
"OBJECT_FILES_RAW" "${all_objects_raw}"
|
||||||
"DEPS" "${fq_deps_list}"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if(LLVM_LIBC_ENABLE_LINTING)
|
if(LLVM_LIBC_ENABLE_LINTING)
|
||||||
|
@ -263,3 +310,4 @@ function(add_redirector_object target_name)
|
||||||
BEFORE PRIVATE -fPIC
|
BEFORE PRIVATE -fPIC
|
||||||
)
|
)
|
||||||
endfunction(add_redirector_object)
|
endfunction(add_redirector_object)
|
||||||
|
|
||||||
|
|
|
@ -1,42 +1,3 @@
|
||||||
# This is a helper function and not a build rule. It is to be used by the
|
|
||||||
# various test rules to generate the full list of object files
|
|
||||||
# recursively produced by "add_entrypoint_object" and "add_object_library"
|
|
||||||
# targets.
|
|
||||||
# Usage:
|
|
||||||
# get_object_files_for_test(<result var> <target0> [<target1> ...])
|
|
||||||
#
|
|
||||||
# targetN is either an "add_entrypoint_target" target or an
|
|
||||||
# "add_object_library" target.
|
|
||||||
function(get_object_files_for_test result)
|
|
||||||
set(object_files "")
|
|
||||||
foreach(dep IN LISTS ARGN)
|
|
||||||
get_target_property(dep_type ${dep} "TARGET_TYPE")
|
|
||||||
if(NOT dep_type)
|
|
||||||
# Target for which TARGET_TYPE property is not set do not
|
|
||||||
# provide any object files.
|
|
||||||
continue()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(${dep_type} STREQUAL ${OBJECT_LIBRARY_TARGET_TYPE})
|
|
||||||
get_target_property(dep_object_files ${dep} "OBJECT_FILES")
|
|
||||||
if(dep_object_files)
|
|
||||||
list(APPEND object_files ${dep_object_files})
|
|
||||||
endif()
|
|
||||||
elseif(${dep_type} STREQUAL ${ENTRYPOINT_OBJ_TARGET_TYPE})
|
|
||||||
get_target_property(object_file_raw ${dep} "OBJECT_FILE_RAW")
|
|
||||||
if(object_file_raw)
|
|
||||||
list(APPEND object_files ${object_file_raw})
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
get_target_property(indirect_deps ${dep} "DEPS")
|
|
||||||
get_object_files_for_test(indirect_objfiles ${indirect_deps})
|
|
||||||
list(APPEND object_files ${indirect_objfiles})
|
|
||||||
endforeach(dep)
|
|
||||||
list(REMOVE_DUPLICATES object_files)
|
|
||||||
set(${result} ${object_files} PARENT_SCOPE)
|
|
||||||
endfunction(get_object_files_for_test)
|
|
||||||
|
|
||||||
# Rule to add a libc unittest.
|
# Rule to add a libc unittest.
|
||||||
# Usage
|
# Usage
|
||||||
# add_libc_unittest(
|
# add_libc_unittest(
|
||||||
|
@ -68,6 +29,21 @@ function(add_libc_unittest target_name)
|
||||||
"'add_entrypoint_object' targets.")
|
"'add_entrypoint_object' targets.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(library_deps "")
|
||||||
|
get_fq_deps_list(fq_deps_list ${LIBC_UNITTEST_DEPENDS})
|
||||||
|
foreach(dep IN LISTS fq_deps_list)
|
||||||
|
get_target_property(dep_type ${dep} "TARGET_TYPE")
|
||||||
|
if(${dep_type} STREQUAL ${ENTRYPOINT_OBJ_TARGET_TYPE})
|
||||||
|
get_target_property(obj_files ${dep} "OBJECT_FILES_RAW")
|
||||||
|
list(APPEND library_deps ${obj_files})
|
||||||
|
elseif(${dep_type} STREQUAL ${OBJECT_LIBRARY_TARGET_TYPE})
|
||||||
|
get_target_property(obj_files ${dep} "OBJECT_FILES")
|
||||||
|
list(APPEND library_deps ${obj_files})
|
||||||
|
endif()
|
||||||
|
# TODO: Check if the dep is a normal CMake library target. If yes, then add it
|
||||||
|
# to the list of library_deps.
|
||||||
|
endforeach(dep)
|
||||||
|
list(REMOVE_DUPLICATES library_deps)
|
||||||
|
|
||||||
get_fq_target_name(${target_name} fq_target_name)
|
get_fq_target_name(${target_name} fq_target_name)
|
||||||
add_executable(
|
add_executable(
|
||||||
|
@ -90,9 +66,9 @@ function(add_libc_unittest target_name)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
get_fq_deps_list(fq_deps_list ${LIBC_UNITTEST_DEPENDS})
|
if(library_deps)
|
||||||
get_object_files_for_test(link_object_files ${fq_deps_list})
|
target_link_libraries(${fq_target_name} PRIVATE ${library_deps})
|
||||||
target_link_libraries(${fq_target_name} PRIVATE ${link_object_files})
|
endif()
|
||||||
|
|
||||||
set_target_properties(${fq_target_name}
|
set_target_properties(${fq_target_name}
|
||||||
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
@ -147,6 +123,22 @@ function(add_libc_fuzzer target_name)
|
||||||
"'add_entrypoint_object' targets.")
|
"'add_entrypoint_object' targets.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
get_fq_deps_list(fq_deps_list ${LIBC_FUZZER_DEPENDS})
|
||||||
|
set(library_deps "")
|
||||||
|
foreach(dep IN LISTS fq_deps_list)
|
||||||
|
get_target_property(dep_type ${dep} "TARGET_TYPE")
|
||||||
|
if (dep_type)
|
||||||
|
string(COMPARE EQUAL ${dep_type} ${ENTRYPOINT_OBJ_TARGET_TYPE} dep_is_entrypoint)
|
||||||
|
if(dep_is_entrypoint)
|
||||||
|
get_target_property(obj_file ${dep} "OBJECT_FILES_RAW")
|
||||||
|
list(APPEND library_deps ${obj_file})
|
||||||
|
continue()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
# TODO: Check if the dep is a normal CMake library target. If yes, then add it
|
||||||
|
# to the list of library_deps.
|
||||||
|
endforeach(dep)
|
||||||
|
|
||||||
get_fq_target_name(${target_name} fq_target_name)
|
get_fq_target_name(${target_name} fq_target_name)
|
||||||
add_executable(
|
add_executable(
|
||||||
${fq_target_name}
|
${fq_target_name}
|
||||||
|
@ -162,9 +154,9 @@ function(add_libc_fuzzer target_name)
|
||||||
${LIBC_BUILD_DIR}/include
|
${LIBC_BUILD_DIR}/include
|
||||||
)
|
)
|
||||||
|
|
||||||
get_fq_deps_list(fq_deps_list ${LIBC_FUZZER_DEPENDS})
|
if(library_deps)
|
||||||
get_object_files_for_test(link_object_files ${fq_deps_list})
|
target_link_libraries(${fq_target_name} PRIVATE ${library_deps})
|
||||||
target_link_libraries(${fq_target_name} PRIVATE ${link_object_files})
|
endif()
|
||||||
|
|
||||||
set_target_properties(${fq_target_name}
|
set_target_properties(${fq_target_name}
|
||||||
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
|
@ -8,7 +8,7 @@ function(add_loader_object name)
|
||||||
)
|
)
|
||||||
|
|
||||||
get_fq_target_name(${name} fq_target_name)
|
get_fq_target_name(${name} fq_target_name)
|
||||||
get_fq_deps_list(fq_deps_list ${ADD_LOADER_OBJECT_DEPENDS})
|
|
||||||
if(ADD_LOADER_OBJECT_ALIAS)
|
if(ADD_LOADER_OBJECT_ALIAS)
|
||||||
list(LENGTH ADD_LOADER_OBJECT_DEPENDS deps_size)
|
list(LENGTH ADD_LOADER_OBJECT_DEPENDS deps_size)
|
||||||
if(NOT (${deps_size} EQUAL "1"))
|
if(NOT (${deps_size} EQUAL "1"))
|
||||||
|
@ -23,15 +23,14 @@ function(add_loader_object name)
|
||||||
set_target_properties(
|
set_target_properties(
|
||||||
${fq_target_name}
|
${fq_target_name}
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
"TARGET_TYPE" "${OBJECT_LIBRARY_TARGET_TYPE}"
|
"TARGET_TYPE" "LOADER_OBJECT"
|
||||||
"OBJECT_FILES" ""
|
"OBJECT_FILES" ${dep_objfile}
|
||||||
"DEPS" "${fq_dep_name}"
|
|
||||||
)
|
)
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_object_library(
|
add_object_library(
|
||||||
${name}.__objects__
|
${name}_objects
|
||||||
SRCS ${ADD_LOADER_OBJECT_SRC}
|
SRCS ${ADD_LOADER_OBJECT_SRC}
|
||||||
DEPENDS ${ADD_LOADER_OBJECT_DEPENDS}
|
DEPENDS ${ADD_LOADER_OBJECT_DEPENDS}
|
||||||
COMPILE_OPTIONS ${ADD_LOADER_OBJECT_COMPILE_OPTIONS}
|
COMPILE_OPTIONS ${ADD_LOADER_OBJECT_COMPILE_OPTIONS}
|
||||||
|
@ -40,8 +39,8 @@ function(add_loader_object name)
|
||||||
set(objfile ${LIBC_BUILD_DIR}/lib/${name}.o)
|
set(objfile ${LIBC_BUILD_DIR}/lib/${name}.o)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${objfile}
|
OUTPUT ${objfile}
|
||||||
COMMAND cp $<TARGET_OBJECTS:${fq_target_name}.__objects__> ${objfile}
|
COMMAND cp $<TARGET_OBJECTS:${fq_target_name}_objects> ${objfile}
|
||||||
DEPENDS $<TARGET_OBJECTS:${fq_target_name}.__objects__>
|
DEPENDS $<TARGET_OBJECTS:${fq_target_name}_objects>
|
||||||
)
|
)
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
${fq_target_name}
|
${fq_target_name}
|
||||||
|
@ -50,9 +49,8 @@ function(add_loader_object name)
|
||||||
set_target_properties(
|
set_target_properties(
|
||||||
${fq_target_name}
|
${fq_target_name}
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
"TARGET_TYPE" "${OBJECT_LIBRARY_TARGET_TYPE}"
|
"TARGET_TYPE" "LOADER_OBJECT"
|
||||||
"OBJECT_FILES" ""
|
"OBJECT_FILES" ${objfile}
|
||||||
"DEPS" "${fq_target_name}.__objects__"
|
|
||||||
)
|
)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,6 @@ add_entrypoint_object(
|
||||||
../sigaction.h
|
../sigaction.h
|
||||||
DEPENDS
|
DEPENDS
|
||||||
.__restore
|
.__restore
|
||||||
.raise
|
|
||||||
libc.config.linux.linux_syscall_h
|
libc.config.linux.linux_syscall_h
|
||||||
libc.include.signal
|
libc.include.signal
|
||||||
libc.include.sys_syscall
|
libc.include.sys_syscall
|
||||||
|
|
|
@ -29,6 +29,23 @@ function(add_loader_test target_name)
|
||||||
|
|
||||||
set_target_properties(${fq_target_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
set_target_properties(${fq_target_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
|
set(dep_objects "")
|
||||||
|
if(ADD_LOADER_TEST_DEPENDS)
|
||||||
|
get_fq_deps_list(fq_deps_list ${ADD_LOADER_TEST_DEPENDS})
|
||||||
|
add_dependencies(${fq_target_name} ${fq_deps_list})
|
||||||
|
foreach(dep IN LISTS fq_deps_list)
|
||||||
|
get_target_property(objfile ${dep} "OBJECT_FILES")
|
||||||
|
if(NOT objfile)
|
||||||
|
message(
|
||||||
|
FATAL_ERROR
|
||||||
|
"Unexpected dependency of an `add_loader_test` target. A dependency "
|
||||||
|
"should be a target of type `add_entrypoint_object, `add_object`, or "
|
||||||
|
"`add_loader_object`.")
|
||||||
|
endif()
|
||||||
|
list(APPEND dep_objects ${objfile})
|
||||||
|
endforeach(dep)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
${fq_target_name}
|
${fq_target_name}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
|
@ -37,9 +54,7 @@ function(add_loader_test target_name)
|
||||||
${LIBC_BUILD_DIR}/include
|
${LIBC_BUILD_DIR}/include
|
||||||
)
|
)
|
||||||
|
|
||||||
get_fq_deps_list(fq_deps_list ${ADD_LOADER_TEST_DEPENDS})
|
target_link_libraries(${fq_target_name} ${dep_objects})
|
||||||
get_object_files_for_test(link_object_files ${fq_deps_list})
|
|
||||||
target_link_libraries(${fq_target_name} ${link_object_files})
|
|
||||||
|
|
||||||
target_link_options(
|
target_link_options(
|
||||||
${fq_target_name}
|
${fq_target_name}
|
||||||
|
|
|
@ -29,6 +29,8 @@ add_header_library(
|
||||||
float.h
|
float.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# TODO(sivachandra): Remove the dependency on __errno_location as the tested
|
||||||
|
# entry points depend on the already.
|
||||||
add_math_unittest(
|
add_math_unittest(
|
||||||
cosf_test
|
cosf_test
|
||||||
NEED_MPFR
|
NEED_MPFR
|
||||||
|
@ -40,6 +42,7 @@ add_math_unittest(
|
||||||
sdcomp26094.h
|
sdcomp26094.h
|
||||||
DEPENDS
|
DEPENDS
|
||||||
.float_utils
|
.float_utils
|
||||||
|
libc.src.errno.__errno_location
|
||||||
libc.src.math.cosf
|
libc.src.math.cosf
|
||||||
libc.utils.CPP.standalone_cpp
|
libc.utils.CPP.standalone_cpp
|
||||||
)
|
)
|
||||||
|
@ -55,6 +58,7 @@ add_math_unittest(
|
||||||
sdcomp26094.h
|
sdcomp26094.h
|
||||||
DEPENDS
|
DEPENDS
|
||||||
.float_utils
|
.float_utils
|
||||||
|
libc.src.errno.__errno_location
|
||||||
libc.src.math.sinf
|
libc.src.math.sinf
|
||||||
libc.utils.CPP.standalone_cpp
|
libc.utils.CPP.standalone_cpp
|
||||||
)
|
)
|
||||||
|
@ -70,6 +74,7 @@ add_math_unittest(
|
||||||
sdcomp26094.h
|
sdcomp26094.h
|
||||||
DEPENDS
|
DEPENDS
|
||||||
.float_utils
|
.float_utils
|
||||||
|
libc.src.errno.__errno_location
|
||||||
libc.src.math.sincosf
|
libc.src.math.sincosf
|
||||||
libc.utils.CPP.standalone_cpp
|
libc.utils.CPP.standalone_cpp
|
||||||
)
|
)
|
||||||
|
|
|
@ -8,4 +8,7 @@ add_libc_unittest(
|
||||||
fwrite_test.cpp
|
fwrite_test.cpp
|
||||||
DEPENDS
|
DEPENDS
|
||||||
libc.src.stdio.fwrite
|
libc.src.stdio.fwrite
|
||||||
|
# TODO(sivachandra): remove private dependencies of fwrite
|
||||||
|
libc.src.threads.mtx_lock
|
||||||
|
libc.src.threads.mtx_unlock
|
||||||
)
|
)
|
||||||
|
|
|
@ -9,7 +9,11 @@ add_libc_unittest(
|
||||||
SRCS
|
SRCS
|
||||||
strcat_test.cpp
|
strcat_test.cpp
|
||||||
DEPENDS
|
DEPENDS
|
||||||
|
# TODO (sivachandra): remove redundant deps.
|
||||||
|
libc.src.string.memcpy
|
||||||
libc.src.string.strcat
|
libc.src.string.strcat
|
||||||
|
libc.src.string.strcpy
|
||||||
|
libc.src.string.strlen
|
||||||
)
|
)
|
||||||
|
|
||||||
add_libc_unittest(
|
add_libc_unittest(
|
||||||
|
@ -19,7 +23,10 @@ add_libc_unittest(
|
||||||
SRCS
|
SRCS
|
||||||
strcpy_test.cpp
|
strcpy_test.cpp
|
||||||
DEPENDS
|
DEPENDS
|
||||||
|
# TODO (sivachandra): remove redundant deps.
|
||||||
|
libc.src.string.memcpy
|
||||||
libc.src.string.strcpy
|
libc.src.string.strcpy
|
||||||
|
libc.src.string.strlen
|
||||||
)
|
)
|
||||||
|
|
||||||
add_libc_unittest(
|
add_libc_unittest(
|
||||||
|
|
|
@ -9,5 +9,7 @@ add_libc_unittest(
|
||||||
DEPENDS
|
DEPENDS
|
||||||
libc.src.unistd.write
|
libc.src.unistd.write
|
||||||
libc.include.errno
|
libc.include.errno
|
||||||
|
# TODO(sivachandra): Remove redundant deps.
|
||||||
|
libc.src.errno.__errno_location
|
||||||
libc.include.unistd
|
libc.include.unistd
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue