3 function(addprefix var prefix list)
5 set(f ${f} ${prefix}/${i})
7 set(${var} ${f} PARENT_SCOPE)
11 ${PROJECT_BINARY_DIR}/
12 ${PROJECT_BINARY_DIR}/../..
13 ${PROJECT_BINARY_DIR}/../../mono/eglib
15 ${PROJECT_SOURCE_DIR}/../
16 ${PROJECT_SOURCE_DIR}/../eglib
17 ${PROJECT_SOURCE_DIR}/../sgen)
22 include(../eglib/CMakeLists.txt)
23 include(../utils/CMakeLists.txt)
24 include(../metadata/CMakeLists.txt)
25 include(../sgen/CMakeLists.txt)
26 include(../eventpipe/CMakeLists.txt)
28 set(eventpipe_sources_base
51 ep-metadata-generator.c
52 ep-metadata-generator.h
55 ep-provider-internals.h
73 if(ENABLE_PERFTRACING)
74 addprefix(eventpipe_sources ../eventpipe "${eventpipe_sources_base}")
80 set(pal_icushim_sources_base
83 set(pal_icushim_sources_base
87 set(icu_shim_sources_base
93 pal_localeNumberData.c
94 pal_localeStringData.c
98 ${pal_icushim_sources_base})
99 addprefix(icu_shim_sources "${ICU_SHIM_PATH}" "${icu_shim_sources_base}")
100 set_source_files_properties(${icu_shim_sources} PROPERTIES COMPILE_DEFINITIONS OSX_ICU_LIBRARY_PATH="${OSX_ICU_LIBRARY_PATH}")
101 set_source_files_properties(${icu_shim_sources} PROPERTIES COMPILE_FLAGS "-I${ICU_INCLUDEDIR} -I${CMAKE_SOURCE_DIR}/../libraries/Native/Unix/System.Globalization.Native/ -I${CMAKE_SOURCE_DIR}/../libraries/Native/Unix/Common/ ${ICU_FLAGS}")
102 set(ICU_LIBS "icucore")
103 set(ICU_LDFLAGS "-L${ICU_LIBDIR}")
110 set(mini_common_sources
151 mini-generic-sharing.c
186 simd-intrinsics-netcore.c
195 debugger-agent-stubs.c
196 debugger-state-machine.h
197 debugger-state-machine.c)
204 mini-amd64-gsharedvt.c
205 mini-amd64-gsharedvt.h
206 tramp-amd64-gsharedvt.c
215 tramp-x86-gsharedvt.c
223 mini-arm64-gsharedvt.c
224 mini-arm64-gsharedvt.h
225 tramp-arm64-gsharedvt.c
235 tramp-arm-gsharedvt.c
248 set(arch_sources ${amd64_sources})
250 set(arch_sources ${x86_sources})
252 set(arch_sources ${arm64_sources})
254 set(arch_sources ${arm_sources})
256 set(arch_sources ${wasm_sources})
265 mini-windows-dllmain.c
266 mini-windows-dlldac.c)
272 set(os_sources "${darwin_sources};${posix_sources}")
277 interp/interp-internals.h
279 interp/interp-intrins.h
280 interp/interp-intrins.c
284 set(interp_stub_sources
287 if(NOT DISABLE_INTERPRETER)
288 set(mini_interp_sources ${interp_sources})
290 set(mini_interp_sources ${interp_stub_sources})
293 if(ENABLE_INTERP_LIB)
294 add_library(mono-ee-interp STATIC "${interp_sources}")
295 install(TARGETS mono-ee-interp LIBRARY)
306 set(llvm_runtime_sources
308 elseif(ENABLE_LLVM_RUNTIME)
309 set(llvm_runtime_sources
313 set(mini_public_headers_base
315 mono-private-unstable.h)
316 addprefix(mini_public_headers ../mini "${mini_public_headers_base}")
318 set(mini_sources "${CMAKE_CURRENT_BINARY_DIR}/buildver-sgen.h;main-core.c;${mini_common_sources};${arch_sources};${os_sources};${mini_interp_sources};${llvm_sources};${debugger_sources};${llvm_runtime_sources}")
321 link_directories(${LLVM_LIBDIR})
325 set(OS_LIBS "-framework CoreFoundation" "-framework Foundation")
329 set(OS_LIBS "-framework CoreFoundation" "-lobjc" "-lc++")
332 add_library(monosgen-objects OBJECT "${eglib_sources};${metadata_sources};${utils_sources};${sgen_sources};${icu_shim_sources};${eventpipe_sources};${mini_sources}")
333 add_library(monosgen-static STATIC $<TARGET_OBJECTS:monosgen-objects>)
334 set_target_properties(monosgen-static PROPERTIES OUTPUT_NAME monosgen-2.0)
336 install(TARGETS monosgen-static LIBRARY)
337 install(FILES ${metadata_public_headers}
338 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mono-2.0/mono/metadata)
339 install(FILES ${utils_public_headers}
340 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mono-2.0/mono/utils)
341 install(FILES ${mini_public_headers}
342 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mono-2.0/mono/jit)
344 if(NOT DISABLE_SHARED_LIBS)
345 add_library(monosgen SHARED $<TARGET_OBJECTS:monosgen-objects>)
346 set_target_properties(monosgen PROPERTIES OUTPUT_NAME monosgen-2.0)
347 set_target_properties(monosgen PROPERTIES LIBRARY_OUTPUT_DIRECTORY .libs)
348 target_link_libraries(monosgen ${OS_LIBS} "iconv" ${LLVM_LIBS} ${ICU_LIBS})
350 set_target_properties(monosgen PROPERTIES LINK_FLAGS ${ICU_LDFLAGS})
352 install(TARGETS monosgen LIBRARY)
355 # FIXME: Always rebuilds, creates non-deterministic builds
356 # FIXME: Use the previous format
357 #string(TIMESTAMP BUILD_DATE)
360 # OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/buildver-sgen.h
361 # COMMAND echo "const char *build_date = \"${BUILD_DATE}\";" > ${CMAKE_CURRENT_BINARY_DIR}/buildver-sgen.h
365 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/buildver-sgen.h
366 COMMAND echo "const char *build_date = \"\";" > ${CMAKE_CURRENT_BINARY_DIR}/buildver-sgen.h
371 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.h
372 COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/gen-version-h.sh ${CMAKE_CURRENT_SOURCE_DIR}/../..
377 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cpu-amd64.h
378 COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/genmdesc.py TARGET_AMD64 ${CMAKE_CURRENT_SOURCE_DIR} cpu-amd64.h amd64_desc ${CMAKE_CURRENT_SOURCE_DIR}/cpu-amd64.md
383 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cpu-x86.h
384 COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/genmdesc.py TARGET_X86 ${CMAKE_CURRENT_SOURCE_DIR} cpu-x86.h x86_desc ${CMAKE_CURRENT_SOURCE_DIR}/cpu-x86.md
389 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cpu-arm64.h
390 COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/genmdesc.py TARGET_ARM64 ${CMAKE_CURRENT_SOURCE_DIR} cpu-arm64.h arm64_cpu_desc ${CMAKE_CURRENT_SOURCE_DIR}/cpu-arm64.md
395 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cpu-arm.h
396 COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/genmdesc.py TARGET_ARM ${CMAKE_CURRENT_SOURCE_DIR} cpu-arm.h arm_cpu_desc ${CMAKE_CURRENT_SOURCE_DIR}/cpu-arm.md
401 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cpu-wasm.h
402 COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/genmdesc.py TARGET_WASM ${CMAKE_CURRENT_SOURCE_DIR} cpu-wasm.h wasm_desc ${CMAKE_CURRENT_SOURCE_DIR}/cpu-wasm.md
406 if(NOT DISABLE_EXECUTABLES)
407 set(CMAKE_SKIP_RPATH 1)
408 add_executable(mono-sgen "main-sgen.c")
409 target_link_libraries(mono-sgen monosgen-static ${OS_LIBS} "iconv" ${LLVM_LIBS} ${ICU_LIBS})
411 set_target_properties(mono-sgen PROPERTIES LINK_FLAGS ${ICU_LDFLAGS})
413 install(TARGETS mono-sgen RUNTIME)