[mono] Use more idiomatic cmake style#82182
Conversation
The goal is to use the cmake targets instead of _sources and _headers variables as well as to use the cmake add_subdirectory commands to bring in parts of the build
unlike eglib_objects, this one can be added by executables and static or shared libraries without pulling in the eglib sources. This is what we want for dynamic runtime components, static interpreter and icall table libs, etc
otherwise it would only include the mini objects - it's not transitive
except for mini where we also enable CXX under some conditions (LLVM or ICU, or browser wasm)
|
The reason we were not doing this is that metadata/ etc. dirs are not buildable by themselves, they are just used to organize source files. Previously in mono/mono, there were actually libmetadata.a files somebody can link against to build monodis, |
None of that changes. there's no libmetadata.a, etc. It's only changing how the build is organized. |
can't have sources directly on add_library(target INTERFACE ...)
|
This also seems to speed up the native runtime builds (by about 2%, but still...) methodology (osx arm64, xcode 14.2, cmake 3.25.2, ninja 1.11.1): killall dotnet
rm -rf artifacts
./build.sh --restore -s mono -c Debug
time ./build.sh --build -s mono -c Debugbaseline: 2:06.86 total |
it's set later in the cmake file already
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
runnning extra-platforms to check whether I broke the mono.mscordbi build |
|
mscordbi links ok. we're good |
Make mono's build use a slightly more idiomatic
cmakestyle:project()per subdirectory, rather than just inminiadd_subdirectoryfor each subdirectoryaddprefixto relativize everything fromminiDoesn't untangle
src/mono/mono/componentsfromsrc/mono/moni/miniyet, although things could be grouped better there too.