Skip to content

Commit

Permalink
Replaced the '_obj' CMake objects and their INTERFACE's, with just the (
Browse files Browse the repository at this point in the history
dotnet#92966)

regular objects, as with CMake 3.20, we no longer need to go through
the full interfaces path.
  • Loading branch information
ivdiazsa authored Oct 4, 2023
1 parent 65dbd33 commit a166bb7
Show file tree
Hide file tree
Showing 18 changed files with 59 additions and 129 deletions.
9 changes: 2 additions & 7 deletions src/coreclr/binder/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,5 @@ endif(CLR_CMAKE_TARGET_WIN32)

convert_to_absolute_path(BINDER_SOURCES ${BINDER_SOURCES})

add_library_clr(v3binder_obj
OBJECT
${BINDER_SOURCES}
)
add_dependencies(v3binder_obj eventing_headers)
add_library(v3binder INTERFACE)
target_sources(v3binder INTERFACE $<TARGET_OBJECTS:v3binder_obj>)
add_library_clr(v3binder OBJECT ${BINDER_SOURCES})
add_dependencies(v3binder eventing_headers)
10 changes: 2 additions & 8 deletions src/coreclr/classlibnative/bcltype/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,5 @@ set(BCLTYPE_SOURCES
variant.cpp
)

add_library_clr(bcltype_obj
OBJECT
${BCLTYPE_SOURCES}
)

add_dependencies(bcltype_obj eventing_headers)
add_library(bcltype INTERFACE)
target_sources(bcltype INTERFACE $<TARGET_OBJECTS:bcltype_obj>)
add_library_clr(bcltype OBJECT ${BCLTYPE_SOURCES})
add_dependencies(bcltype eventing_headers)
11 changes: 2 additions & 9 deletions src/coreclr/classlibnative/float/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,5 @@ set(FLOAT_SOURCES
floatsingle.cpp
)

add_library_clr(comfloat_wks_obj
OBJECT
${FLOAT_SOURCES}
)

add_dependencies(comfloat_wks_obj eventing_headers)

add_library(comfloat_wks INTERFACE)
target_sources(comfloat_wks INTERFACE $<TARGET_OBJECTS:comfloat_wks_obj>)
add_library_clr(comfloat_wks OBJECT ${FLOAT_SOURCES})
add_dependencies(comfloat_wks eventing_headers)
4 changes: 1 addition & 3 deletions src/coreclr/debug/debug-pal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,4 @@ if(CLR_CMAKE_HOST_UNIX)

endif(CLR_CMAKE_HOST_UNIX)

add_library_clr(debug-pal_obj OBJECT ${TWO_WAY_PIPE_SOURCES})
add_library(debug-pal INTERFACE)
target_sources(debug-pal INTERFACE $<TARGET_OBJECTS:debug-pal_obj>)
add_library_clr(debug-pal OBJECT ${TWO_WAY_PIPE_SOURCES})
24 changes: 11 additions & 13 deletions src/coreclr/debug/ee/wks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
if (CLR_CMAKE_TARGET_WIN32)

list(APPEND CORDBEE_SOURCES_WKS ${CORDBEE_HEADERS_WKS})

get_include_directories(ASM_INCLUDE_DIRECTORIES)
Expand All @@ -8,35 +7,34 @@ if (CLR_CMAKE_TARGET_WIN32)
set(ASM_FILE ${CORDBEE_DIR}/${ARCH_SOURCES_DIR}/dbghelpers.asm)

if(CLR_CMAKE_HOST_ARCH_ARM OR CLR_CMAKE_HOST_ARCH_ARM64 OR CLR_CMAKE_HOST_ARCH_LOONGARCH64)

preprocess_files(ASM_FILE ${ASM_FILE})

if (CMAKE_GENERATOR MATCHES "Visual Studio")
compile_asm(TARGET cordbee_wks_obj ASM_FILES ${ASM_FILE} OUTPUT_OBJECTS ASM_OBJECTS)
compile_asm(TARGET cordbee_wks ASM_FILES ${ASM_FILE} OUTPUT_OBJECTS ASM_OBJECTS)
endif()

add_library_clr(cordbee_wks_obj OBJECT ${CORDBEE_SOURCES_WKS} ${ASM_FILE} ${ASM_OBJECTS})
add_library_clr(cordbee_wks OBJECT ${CORDBEE_SOURCES_WKS} ${ASM_FILE} ${ASM_OBJECTS})

else ()

set(ASM_OPTIONS /c /Zi /W3 /errorReport:prompt)

if (CLR_CMAKE_HOST_ARCH_I386)
list (APPEND ASM_OPTIONS /safeseh)
endif (CLR_CMAKE_HOST_ARCH_I386)

set_source_files_properties(${ASM_FILE} PROPERTIES COMPILE_OPTIONS "${ASM_OPTIONS}")

add_library_clr(cordbee_wks_obj OBJECT ${CORDBEE_SOURCES_WKS} ${ASM_FILE})
add_library_clr(cordbee_wks OBJECT ${CORDBEE_SOURCES_WKS} ${ASM_FILE})

endif()

else ()

add_library_clr(cordbee_wks_obj OBJECT ${CORDBEE_SOURCES_WKS} ../${ARCH_SOURCES_DIR}/dbghelpers.S)
add_library_clr(cordbee_wks
OBJECT
${CORDBEE_SOURCES_WKS}
../${ARCH_SOURCES_DIR}/dbghelpers.S
)

endif (CLR_CMAKE_TARGET_WIN32)

target_precompile_headers(cordbee_wks_obj PRIVATE [["stdafx.h"]])
add_dependencies(cordbee_wks_obj eventing_headers)
add_library(cordbee_wks INTERFACE)
target_sources(cordbee_wks INTERFACE $<TARGET_OBJECTS:cordbee_wks_obj>)
target_precompile_headers(cordbee_wks PRIVATE [["stdafx.h"]])
add_dependencies(cordbee_wks eventing_headers)
8 changes: 2 additions & 6 deletions src/coreclr/dlls/mscorrc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,10 @@ if(CLR_CMAKE_HOST_WIN32)
add_library_clr(mscorrc SHARED
include.rc
)

install_clr(TARGETS mscorrc DESTINATIONS . sharedFramework COMPONENT runtime)

else()
build_resources(${CMAKE_CURRENT_SOURCE_DIR}/include.rc mscorrc TARGET_CPP_FILE)
add_library_clr(mscorrc OBJECT ${TARGET_CPP_FILE})

add_library_clr(mscorrc_obj OBJECT
${TARGET_CPP_FILE}
)
add_library(mscorrc INTERFACE)
target_sources(mscorrc INTERFACE $<TARGET_OBJECTS:mscorrc_obj>)
endif(CLR_CMAKE_HOST_WIN32)
12 changes: 3 additions & 9 deletions src/coreclr/gcinfo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
set(CMAKE_INCLUDE_CURRENT_DIR ON)

set( GCINFO_ALLARCH_SOURCES
set(GCINFO_ALLARCH_SOURCES
arraylist.cpp
gcinfoencoder.cpp
simplerhash.cpp
)

set( GCINFO_I386_SOURCES
set(GCINFO_I386_SOURCES
../gcdump/gcdump.cpp
../gcdump/i386/gcdumpx86.cpp
)
Expand All @@ -24,13 +24,7 @@ if(CLR_CMAKE_TARGET_ARCH_I386)
endif(CLR_CMAKE_TARGET_ARCH_I386)


add_library_clr(gcinfo_obj
OBJECT
${GCINFO_SOURCES}
)

add_library(gcinfo INTERFACE)
target_sources(gcinfo INTERFACE $<TARGET_OBJECTS:gcinfo_obj>)
add_library_clr(gcinfo OBJECT ${GCINFO_SOURCES})

install (FILES gcinfoencoder.cpp
DESTINATION gcinfo)
Expand Down
4 changes: 1 addition & 3 deletions src/coreclr/inc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ if(FEATURE_JIT_PITCHING)
endif(FEATURE_JIT_PITCHING)

# Compile *_i.cpp to lib
add_library_clr(corguids_obj OBJECT ${CORGUIDS_SOURCES})
add_library(corguids INTERFACE)
target_sources(corguids INTERFACE $<TARGET_OBJECTS:corguids_obj>)
add_library_clr(corguids OBJECT ${CORGUIDS_SOURCES})

# Binplace the inc files for packaging later.

Expand Down
8 changes: 1 addition & 7 deletions src/coreclr/interop/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,4 @@ endif(FEATURE_COMWRAPPERS)

convert_to_absolute_path(INTEROP_SOURCES ${INTEROP_SOURCES})

add_library_clr(interop_obj
OBJECT
${INTEROP_SOURCES}
)

add_library(interop INTERFACE)
target_sources(interop INTERFACE $<TARGET_OBJECTS:interop_obj>)
add_library_clr(interop OBJECT ${INTEROP_SOURCES})
11 changes: 4 additions & 7 deletions src/coreclr/jit/static/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@ project(ClrJit)

set_source_files_properties(${JIT_EXPORTS_FILE} PROPERTIES GENERATED TRUE)

add_library_clr(clrjit_obj
add_library_clr(clrjit_static
OBJECT
${JIT_SOURCES}
${JIT_ARCH_SOURCES}
)

if(CLR_CMAKE_HOST_UNIX)
add_dependencies(clrjit_obj coreclrpal gcinfo)
add_dependencies(clrjit_static coreclrpal gcinfo)
endif(CLR_CMAKE_HOST_UNIX)

target_include_directories(clrjit_obj PRIVATE ${JIT_SOURCE_DIR})
target_precompile_headers(clrjit_obj PRIVATE [["jitpch.h"]])

add_library(clrjit_static INTERFACE)
target_sources(clrjit_static INTERFACE $<TARGET_OBJECTS:clrjit_obj>)
target_include_directories(clrjit_static PRIVATE ${JIT_SOURCE_DIR})
target_precompile_headers(clrjit_static PRIVATE [["jitpch.h"]])
10 changes: 2 additions & 8 deletions src/coreclr/md/ceefilegen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,5 @@ if (CLR_CMAKE_TARGET_WIN32)
list(APPEND CEEFILEGEN_SOURCES ${CEEFILEGEN_HEADERS})
endif (CLR_CMAKE_TARGET_WIN32)

add_library_clr(ceefgen_obj
OBJECT
${CEEFILEGEN_SOURCES}
)
target_precompile_headers(ceefgen_obj PRIVATE stdafx.h)

add_library(ceefgen INTERFACE)
target_sources(ceefgen INTERFACE $<TARGET_OBJECTS:ceefgen_obj>)
add_library_clr(ceefgen OBJECT ${CEEFILEGEN_SOURCES})
target_precompile_headers(ceefgen PRIVATE stdafx.h)
8 changes: 3 additions & 5 deletions src/coreclr/md/compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,9 @@ add_library_clr(mdcompiler_dac ${MDCOMPILER_SOURCES})
set_target_properties(mdcompiler_dac PROPERTIES DAC_COMPONENT TRUE)
target_precompile_headers(mdcompiler_dac PRIVATE stdafx.h)

add_library_clr(mdcompiler_wks_obj OBJECT ${MDCOMPILER_WKS_SOURCES})
target_compile_definitions(mdcompiler_wks_obj PRIVATE FEATURE_METADATA_EMIT_ALL)
target_precompile_headers(mdcompiler_wks_obj PRIVATE stdafx.h)
add_library(mdcompiler_wks INTERFACE)
target_sources(mdcompiler_wks INTERFACE $<TARGET_OBJECTS:mdcompiler_wks_obj>)
add_library_clr(mdcompiler_wks OBJECT ${MDCOMPILER_WKS_SOURCES})
target_compile_definitions(mdcompiler_wks PRIVATE FEATURE_METADATA_EMIT_ALL)
target_precompile_headers(mdcompiler_wks PRIVATE stdafx.h)

add_library_clr(mdcompiler-dbi ${MDCOMPILER_SOURCES})
set_target_properties(mdcompiler-dbi PROPERTIES DBI_COMPONENT TRUE)
Expand Down
8 changes: 3 additions & 5 deletions src/coreclr/md/enc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,9 @@ add_library_clr(mdruntimerw_dac ${MDRUNTIMERW_SOURCES})
set_target_properties(mdruntimerw_dac PROPERTIES DAC_COMPONENT TRUE)
target_precompile_headers(mdruntimerw_dac PRIVATE stdafx.h)

add_library_clr(mdruntimerw_wks_obj OBJECT ${MDRUNTIMERW_SOURCES})
target_compile_definitions(mdruntimerw_wks_obj PRIVATE FEATURE_METADATA_EMIT_ALL)
target_precompile_headers(mdruntimerw_wks_obj PRIVATE stdafx.h)
add_library(mdruntimerw_wks INTERFACE)
target_sources(mdruntimerw_wks INTERFACE $<TARGET_OBJECTS:mdruntimerw_wks_obj>)
add_library_clr(mdruntimerw_wks OBJECT ${MDRUNTIMERW_SOURCES})
target_compile_definitions(mdruntimerw_wks PRIVATE FEATURE_METADATA_EMIT_ALL)
target_precompile_headers(mdruntimerw_wks PRIVATE stdafx.h)

add_library_clr(mdruntimerw-dbi ${MDRUNTIMERW_SOURCES})
set_target_properties(mdruntimerw-dbi PROPERTIES DBI_COMPONENT TRUE)
Expand Down
8 changes: 3 additions & 5 deletions src/coreclr/md/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@ add_library_clr(mdruntime_dac ${MDRUNTIME_SOURCES})
set_target_properties(mdruntime_dac PROPERTIES DAC_COMPONENT TRUE)
target_precompile_headers(mdruntime_dac PRIVATE stdafx.h)

add_library_clr(mdruntime_wks_obj OBJECT ${MDRUNTIME_SOURCES})
target_compile_definitions(mdruntime_wks_obj PRIVATE FEATURE_METADATA_EMIT_ALL)
target_precompile_headers(mdruntime_wks_obj PRIVATE stdafx.h)
add_library(mdruntime_wks INTERFACE)
target_sources(mdruntime_wks INTERFACE $<TARGET_OBJECTS:mdruntime_wks_obj>)
add_library_clr(mdruntime_wks OBJECT ${MDRUNTIME_SOURCES})
target_compile_definitions(mdruntime_wks PRIVATE FEATURE_METADATA_EMIT_ALL)
target_precompile_headers(mdruntime_wks PRIVATE stdafx.h)

add_library_clr(mdruntime-dbi ${MDRUNTIME_SOURCES})
set_target_properties(mdruntime-dbi PROPERTIES DBI_COMPONENT TRUE)
Expand Down
7 changes: 1 addition & 6 deletions src/coreclr/pal/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,7 @@ endif(NOT FEATURE_CROSSBITNESS)
# > warning for library: libtracepointprovider.a the table of contents is empty (no object file members in the library define global symbols)
#
if(CLR_CMAKE_TARGET_LINUX)
add_library(tracepointprovider_obj
OBJECT
misc/tracepointprovider.cpp
)
add_library(tracepointprovider INTERFACE)
target_sources(tracepointprovider INTERFACE $<TARGET_OBJECTS:tracepointprovider_obj>)
add_library(tracepointprovider OBJECT misc/tracepointprovider.cpp)
endif(CLR_CMAKE_TARGET_LINUX)

if(CLR_CMAKE_TARGET_OSX)
Expand Down
6 changes: 2 additions & 4 deletions src/coreclr/unwinder/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ list(APPEND UNWINDER_SOURCES
convert_to_absolute_path(UNWINDER_SOURCES ${UNWINDER_SOURCES})

if(CLR_CMAKE_HOST_UNIX)
add_library_clr(unwinder_wks_obj OBJECT ${UNWINDER_SOURCES})
add_dependencies(unwinder_wks_obj eventing_headers)
add_library(unwinder_wks INTERFACE)
target_sources(unwinder_wks INTERFACE $<TARGET_OBJECTS:unwinder_wks_obj>)
add_library_clr(unwinder_wks OBJECT ${UNWINDER_SOURCES})
add_dependencies(unwinder_wks eventing_headers)
endif(CLR_CMAKE_HOST_UNIX)

add_library_clr(unwinder_dac ${UNWINDER_SOURCES})
Expand Down
10 changes: 4 additions & 6 deletions src/coreclr/utilcode/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ convert_to_absolute_path(UTILCODE_DAC_SOURCES ${UTILCODE_DAC_SOURCES})
convert_to_absolute_path(UTILCODE_STATICNOHOST_SOURCES ${UTILCODE_STATICNOHOST_SOURCES})

add_library_clr(utilcode_dac STATIC ${UTILCODE_DAC_SOURCES})
add_library_clr(utilcode_obj OBJECT ${UTILCODE_SOURCES})
add_library(utilcode INTERFACE)
target_sources(utilcode INTERFACE $<TARGET_OBJECTS:utilcode_obj>)
add_library_clr(utilcode OBJECT ${UTILCODE_SOURCES})
add_library_clr(utilcodestaticnohost STATIC ${UTILCODE_STATICNOHOST_SOURCES})

target_link_libraries(utilcodestaticnohost PUBLIC coreclrminipal)
Expand All @@ -98,7 +96,7 @@ if(CLR_CMAKE_HOST_UNIX)
target_link_libraries(utilcode_dac PUBLIC nativeresourcestring)
target_link_libraries(utilcode INTERFACE nativeresourcestring)
add_dependencies(utilcode_dac coreclrpal)
add_dependencies(utilcode_obj coreclrpal)
add_dependencies(utilcode coreclrpal)
endif(CLR_CMAKE_HOST_UNIX)


Expand All @@ -114,8 +112,8 @@ set_target_properties(utilcode_dac PROPERTIES DAC_COMPONENT TRUE)
target_compile_definitions(utilcode_dac PRIVATE SELF_NO_HOST)
target_compile_definitions(utilcodestaticnohost PRIVATE SELF_NO_HOST)
add_dependencies(utilcode_dac ${UTILCODE_DEPENDENCIES})
add_dependencies(utilcode_obj ${UTILCODE_DEPENDENCIES})
add_dependencies(utilcode ${UTILCODE_DEPENDENCIES})
add_dependencies(utilcodestaticnohost ${UTILCODE_DEPENDENCIES})
target_precompile_headers(utilcode_dac PRIVATE [["stdafx.h"]])
target_precompile_headers(utilcode_obj PRIVATE [["stdafx.h"]])
target_precompile_headers(utilcode PRIVATE [["stdafx.h"]])
target_precompile_headers(utilcodestaticnohost PRIVATE [["stdafx.h"]])
30 changes: 12 additions & 18 deletions src/coreclr/vm/wks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ if (CLR_CMAKE_TARGET_WIN32)
endif (CLR_CMAKE_TARGET_WIN32)

add_library_clr(cee_wks_core OBJECT ${VM_SOURCES_WKS} ${VM_SOURCES_WKS_ARCH_ASM})
add_library_clr(cee_wks_obj OBJECT ${VM_SOURCES_WKS_SPECIAL})
add_library_clr(cee_wks_mergeable_obj OBJECT ${VM_SOURCES_WKS_SPECIAL})
add_library_clr(cee_wks OBJECT ${VM_SOURCES_WKS_SPECIAL})
add_library_clr(cee_wks_mergeable OBJECT ${VM_SOURCES_WKS_SPECIAL})

target_precompile_headers(cee_wks_core PRIVATE [["common.h"]])
target_precompile_headers(cee_wks_obj PRIVATE [["common.h"]])
target_precompile_headers(cee_wks_mergeable_obj PRIVATE [["common.h"]])
target_precompile_headers(cee_wks PRIVATE [["common.h"]])
target_precompile_headers(cee_wks_mergeable PRIVATE [["common.h"]])

if (MSVC)
# corelib.cpp does not compile with precompiled header file
set_source_files_properties(../corelib.cpp PROPERTIES COMPILE_FLAGS "/Y-")
endif()

add_dependencies(cee_wks_core eventing_headers)
add_dependencies(cee_wks_obj eventing_headers)
add_dependencies(cee_wks_mergeable_obj eventing_headers)
add_dependencies(cee_wks eventing_headers)
add_dependencies(cee_wks_mergeable eventing_headers)

if (CLR_CMAKE_TARGET_WIN32)
if(NOT CLR_CMAKE_HOST_ARCH_ARM AND NOT CLR_CMAKE_HOST_ARCH_ARM64)
Expand All @@ -38,25 +38,19 @@ if (CLR_CMAKE_TARGET_WIN32)
add_custom_target(asmconstants_inc DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.inc)

add_dependencies(cee_wks_core asmconstants_inc)
add_dependencies(cee_wks_obj asmconstants_inc)
add_dependencies(cee_wks_mergeable_obj asmconstants_inc)
add_dependencies(cee_wks asmconstants_inc)
add_dependencies(cee_wks_mergeable asmconstants_inc)

endif(NOT CLR_CMAKE_HOST_ARCH_ARM AND NOT CLR_CMAKE_HOST_ARCH_ARM64)
endif (CLR_CMAKE_TARGET_WIN32)

add_custom_target(precompiled_asm DEPENDS ${VM_WKS_ARCH_ASM_OBJECTS})
add_dependencies(cee_wks_core precompiled_asm)
add_dependencies(cee_wks_obj precompiled_asm)
add_dependencies(cee_wks_mergeable_obj precompiled_asm)
add_dependencies(cee_wks precompiled_asm)
add_dependencies(cee_wks_mergeable precompiled_asm)


target_compile_definitions(cee_wks_mergeable_obj PUBLIC FEATURE_MERGE_JIT_AND_ENGINE)
target_compile_definitions(cee_wks_mergeable_obj PUBLIC CORECLR_EMBEDDED)

add_library(cee_wks INTERFACE)
target_sources(cee_wks INTERFACE $<TARGET_OBJECTS:cee_wks_obj> $<TARGET_OBJECTS:cee_wks_core> ${VM_WKS_ARCH_ASM_OBJECTS})
add_library(cee_wks_mergeable INTERFACE)
target_sources(cee_wks_mergeable INTERFACE $<TARGET_OBJECTS:cee_wks_mergeable_obj> $<TARGET_OBJECTS:cee_wks_core> ${VM_WKS_ARCH_ASM_OBJECTS})
target_compile_definitions(cee_wks_mergeable PUBLIC FEATURE_MERGE_JIT_AND_ENGINE)
target_compile_definitions(cee_wks_mergeable PUBLIC CORECLR_EMBEDDED)

if (CLR_CMAKE_HOST_WIN32)
link_natvis_sources_for_target(cee_wks INTERFACE ../vm.natvis)
Expand Down

0 comments on commit a166bb7

Please sign in to comment.