2009-05-24 Zoltan Varga <vargaz@gmail.com>
[mono.git] / support / CMakeLists.txt
1
2 # Source code which helps implement the ANSI C standards, and thus *should* be
3 # portable to any platform having a C compiler.
4 set(MPH_C_SOURCE
5         errno.c
6         map.c
7         map.h
8         mph.h
9         signal.c
10         stdio.c
11         string.c
12         stdlib.c)
13
14 # Source code which helps implement POSIX and other related Unix standards,
15 # and *may* be portable between Unix platforms.
16 set(MPH_UNIX_SOURCE
17         dirent.c
18         fcntl.c
19         fstab.c
20         grp.c
21         macros.c
22         old-map.c
23         old-map.h
24         pwd.c
25         serial.c
26         sys-mman.c
27         sys-sendfile.c
28         sys-stat.c
29         sys-statvfs.c
30         sys-time.c
31         sys-utsname.c
32         sys-wait.c
33         sys-xattr.c
34         syslog.c
35         time.c
36         unistd.c
37         utime.c
38         x-struct-str.c)
39
40 if(PLATFORM_WIN32)
41 set(MPH_SOURCE ${MPH_C_SOURCE})
42 set(MPH_LIBS)
43 else()
44 set(MPH_SOURCE ${MPH_C_SOURCE} ${MPH_UNIX_SOURCE})
45 set(MPH_LIBS ${GLIB_LIBS})
46 endif()
47
48 set(MINIZIP_SOURCE 
49         minizip/crypt.h
50         minizip/ioapi.c
51         minizip/ioapi.h
52         minizip/unzip.c
53         minizip/unzip.h
54         minizip/zip.c
55         minizip/zip.h)
56
57 set(ZLIB_SOURCES 
58         adler32.c
59         compress.c
60         crc32.c 
61         gzio.c  
62         uncompr.c
63         deflate.c
64         trees.c 
65         zutil.c 
66         inflate.c
67         infback.c
68         inftrees.c
69         inffast.c
70         crc32.h 
71         deflate.h  
72         inffast.h  
73         inffixed.h  
74         inflate.h  
75         inftrees.h  
76         trees.h  
77         zconf.h  
78         zlib.h  
79         zutil.h)
80
81 if(HAVE_ZLIB)
82 set(Z_SOURCE  zlib_macros.c)
83 set(Z_LIBS  -lz)
84 else()
85 set(Z_SOURCE  zlib_macros.c ${ZLIB_SOURCES})
86 set(Z_LIBS)
87 endif()
88
89 set(libMonoPosixHelper_la_SOURCES
90         ${MPH_SOURCE}
91         ${Z_SOURCE}
92         ${MINIZIP_SOURCE})
93
94 set(libMonoPosixHelper_la_LIBADD
95         ${MPH_LIBS}
96         ${Z_LIBS}
97         ${XATTR_LIB})
98
99 # set(libMonoPosixHelper_la_LDFLAGS  -no-undefined -version-info 1:0:1
100 ###set(libMonoPosixHelper_la_LDFLAGS  -no-undefined -avoid-version)
101 ###set(libMonoSupportW_la_LDFLAGS  -no-undefined -avoid-version)
102
103 set(libMonoSupportW_la_SOURCES
104                 supportw.c
105                 support-heap.c
106                 supportw.h)
107
108 set(libMonoSupportW_la_LIBADD
109                 ${GLIB_LIBS})
110
111 include_directories(${top_srcdir})
112 include_directories(${GLIB2_INCLUDE_DIRS})
113 set(CMAKE_C_FLAGS "${CFLAGS} ${CPPFLAGS}")
114 link_directories(../mini)
115
116 add_library(MonoPosixHelper SHARED ${libMonoPosixHelper_la_SOURCES})
117 target_link_libraries(MonoPosixHelper ${libMonoPosixHelper_la_LIBADD})
118
119 if(PLATFORM_WIN32)
120 else()
121 ###set(lib_LTLIBRARIES
122 ###     libMonoPosixHelper.la
123 ###     ${SUPPORT})
124 endif()
125
126
127 # Use this target to refresh the values in map.[ch]
128 #
129 add_custom_target(refresh
130   COMMAND cp `pkg-config --variable=Programs create-native-map` .
131   COMMAND ${top_builddir}/runtime/mono-wrapper create-native-map.exe 
132         --autoconf-member=d_off                               
133         --autoconf-member=d_reclen                            
134         --autoconf-member=d_type                              
135         --exclude-native-symbol=Mono_Posix_Stdlib_snprintf    
136         --impl-macro=_GNU_SOURCE --impl-macro=_XOPEN_SOURCE   
137         --impl-header="<sys/types.h>"                         
138         --impl-header="<sys/stat.h>"                          
139         --autoconf-header="<sys/time.h>"                      
140         --autoconf-header="<sys/poll.h>"                      
141         --autoconf-header="<sys/wait.h>"                      
142         --autoconf-header="<sys/statvfs.h>"                   
143         --autoconf-header="<sys/xattr.h>"                     
144         --autoconf-header="<sys/mman.h>"                      
145         --autoconf-header="<unistd.h>"                        
146         --impl-header="<fcntl.h>"                             
147         --impl-header="<signal.h>"                            
148         --autoconf-header="<poll.h>"                          
149         --autoconf-header="<grp.h>"                           
150         --impl-header="<errno.h>"                             
151         --autoconf-header="<syslog.h>"                        
152         --autoconf-header="<dirent.h>"                        
153         --autoconf-header="<utime.h>"                         
154         --impl-header="<time.h>"                              
155         --impl-header=""mph.h""                             
156         --rename-member=st_atime=st_atime_                    
157         --rename-member=st_ctime=st_ctime_                    
158         --rename-member=st_mtime=st_mtime_                    
159         --rename-namespace=Mono.Unix.Native=Mono.Posix        
160         --library=MonoPosixHelper                             
161         ${mcs_topdir}/class/lib/net_2_0/Mono.Posix.dll map
162 )