66037d2da516eeb6181eeb31d566c1188e56f954
[platform/upstream/coreclr.git] / src / inc / CMakeLists.txt
1 set( CORGUIDS_IDL_SOURCES
2   cordebug.idl
3   xcordebug.idl
4   clrdata.idl
5   clrinternal.idl
6   xclrdata.idl
7   corprof.idl
8   corpub.idl
9   ivalidator.idl
10   ivehandler.idl
11   gchost.idl
12   fusionpriv.idl
13   mscorsvc.idl
14   tlbimpexp.idl
15   clrprivappxhosting.idl
16   clrprivbinding.idl
17   clrprivhosting.idl
18   clrprivruntimebinders.idl
19   corsym.idl
20 )
21
22 if(WIN32)
23 #Build for corguids is done in two steps:
24 #1. compile .idl to *_i.c : This is done using custom midl command
25 #2. compile *_i.c to .lib
26
27 # Get the current list of definitions to pass to midl
28 get_compile_definitions(MIDL_DEFINITIONS)
29 get_include_directories(MIDL_INCLUDE_DIRECTORIES)
30
31
32 # Run custom midl command over each idl file
33 FIND_PROGRAM( MIDL midl.exe )
34 foreach(GENERATE_IDL IN LISTS CORGUIDS_IDL_SOURCES)
35    get_filename_component(IDLNAME ${GENERATE_IDL} NAME_WE)
36    set(OUT_NAME ${CMAKE_CURRENT_BINARY_DIR}/idls_out/${IDLNAME}_i.c)
37    list(APPEND CORGUIDS_SOURCES ${OUT_NAME})
38    add_custom_command(OUTPUT ${OUT_NAME}
39                       COMMAND ${MIDL} ${MIDL_INCLUDE_DIRECTORIES} /h ${CMAKE_CURRENT_BINARY_DIR}/idls_out/${IDLNAME}.h ${MIDL_DEFINITIONS} /out ${CMAKE_CURRENT_BINARY_DIR}/idls_out ${CMAKE_CURRENT_SOURCE_DIR}/${GENERATE_IDL}
40                       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${GENERATE_IDL} 
41                       COMMENT "Compiling ${GENERATE_IDL}")
42 endforeach(GENERATE_IDL)
43
44 set_source_files_properties(${CORGUIDS_SOURCES}
45                             PROPERTIES GENERATED TRUE)
46
47 # Compile *_i.c as C files
48 add_compile_options(/TC)
49
50 else()
51
52 #The MIDL tool exists for Windows only, so for other systems, we have the prebuilt xxx_i.c files checked in
53 foreach(IDL_SOURCE IN LISTS CORGUIDS_IDL_SOURCES)
54    get_filename_component(IDLNAME ${IDL_SOURCE} NAME_WE)
55    set(C_SOURCE ../pal/prebuilt/idl/${IDLNAME}_i.c)
56    list(APPEND CORGUIDS_SOURCES ${C_SOURCE})
57 endforeach(IDL_SOURCE)
58
59 endif(WIN32)
60
61 # Compile *_i.c to lib
62 add_library(corguids ${CORGUIDS_SOURCES})