summaryrefslogtreecommitdiff
path: root/indra/cmake/MonoEmbed.cmake
blob: 30890aed217ad31b262fe4803ba716fae1617df5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# -*- cmake -*-

include(Prebuilt)
use_prebuilt_binary(libmono)

SET(GLIB_2_0 glib-2.0)

if (WINDOWS)
    SET(MONO_LIB mono) 
else (WINDOWS)
    SET(MONO_LIB mono)
    SET(M_LIBRARIES m)
    SET(GTHREAD_2_0 gthread-2.0)
endif(WINDOWS)


IF (DARWIN)

  FIND_LIBRARY(MONO_LIBRARY NAMES Mono)
  # Find_file doesnt work as expected. Hardcode relative to Mono.framework. 
  #FIND_FILE(GLIB_CONFIG glibconfig.h ${MONO_LIBRARY})
  #FIND_FILE(MONO_GLIB_LIBRARY glib.h ${MONO_LIBRARY})
  SET(MONO_GLIB_LIBRARY ${MONO_LIBRARY}/Headers/glib-2.0/)
  SET(GLIB_CONFIG ${MONO_LIBRARY}/Libraries/glib-2.0/include/)
  SET(MONO_LIB_DIRECTORY ${MONO_LIBRARY}/Libraries)

  IF (MONO_LIBRARY AND MONO_GLIB_LIBRARY AND GLIB_CONFIG)
    MESSAGE(STATUS "Found Mono for embedding")
    INCLUDE_DIRECTORIES(${MONO_GLIB_LIBRARY} ${GLIB_CONFIG})
    LINK_DIRECTORIES(${MONO_LIB_DIRECTORY})
  ELSE (MONO_LIBRARY AND MONO_GLIB_LIBRARY AND GLIB_CONFIG)
    MESSAGE(FATAL_ERROR "Mono not found for embedding")   
    MESSAGE(${MONO_LIBRARY})
    MESSAGE(${MONO_GLIB_LIBRARY})
    MESSAGE(${GLIB_CONFIG})
  ENDIF (MONO_LIBRARY AND MONO_GLIB_LIBRARY AND GLIB_CONFIG)

ELSE (DARWIN)

  SET(MONO_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include)  
  SET(GLIB_2_0_PLATFORM_INCLUDE_DIR
    ${LIBS_PREBUILT_DIR}/include/glib-2.0)
  SET(GLIB_2_0_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/glib-2.0)

  INCLUDE_DIRECTORIES(
    ${MONO_INCLUDE_DIR} 
    ${GLIB_2_0_PLATFORM_INCLUDE_DIR} 
    ${GLIB_2_0_INCLUDE_DIR})
    
ENDIF (DARWIN) 

SET(MONO_LIBRARIES 
    ${MONO_LIB} 
    ${M_LIBRARIES} 
    ${GLIB_2_0}
    ${GTHREAD_2_0} 
)