Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
cmake_minimum_required (VERSION 3.1)

project (mono)

if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set (DARWIN 1)
endif ()

## FIXME
# set (ANDROID )

include (CheckIncludeFile)
include (CheckLibraryExists)
include (CheckSymbolExists)
include (CheckFunctionExists)
include (CheckTypeSize)
include (CheckCSourceCompiles)

add_subdirectory (eglib)
93 changes: 93 additions & 0 deletions eglib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
project (eglib)

include_directories ("${CMAKE_CURRENT_SOURCE_DIR}")
include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/src")

set (PROJECT_VERSION "0.3")

set (PACKAGE "${PROJECT_NAME}")
set (PACKAGE_VERSION "${PROJECT_VERSION}")
set (PACKAGE_BUGREPORT "http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono")
set (PACKAGE_NAME "${PACKAGE}")
set (PACKAGE_STRING "${PACKAGE} ${PACKAGE_VERSION}")
set (PACKAGE_TARNAME "${PACKAGE}")
set (PACKAGE_URL "")

if (ANDROID)
set (PLATFORM_ANDROID 1)
elseif (DARWIN)
set (TARGET_MACH 1)

check_c_source_compiles (
"
#include <TargetConditionals.h>
#if TARGET_IPHONE_SIMULATOR == 1 || TARGET_OS_IPHONE == 1
#error fail this for ios
#endif
int main (void) { return 0; }
"
COMPILATION_SUCCESS
)

if (COMPILATION_SUCCESS)
set (TARGET_OSX 1)
else ()
set (TARGET_IOS 1)
endif ()
endif (ANDROID)

check_include_file ("dlfcn.h" HAVE_DLFCN_H)
check_include_file ("getopt.h" HAVE_GETOPT_H)
check_include_file ("iconv.h" HAVE_ICONV_H)
check_include_file ("inttypes.h" HAVE_INTTYPES_H)
check_include_file ("langinfo.h" HAVE_LANGINFO_H)
check_include_file ("localcharset.h" HAVE_LOCALCHARSET_H)
check_include_file ("memory.h" HAVE_MEMORY_H)
check_include_file ("pwd.h" HAVE_PWD_H)
check_include_file ("stdint.h" HAVE_STDINT_H)
check_include_file ("stdlib.h" HAVE_STDLIB_H)
check_include_file ("string.h" HAVE_STRING_H)
check_include_file ("strings.h" HAVE_STRINGS_H)
check_include_file ("sys/resource.h" HAVE_SYS_RESOURCE_H)
check_include_file ("sys/select.h" HAVE_SYS_SELECT_H)
check_include_file ("sys/stat.h" HAVE_SYS_STAT_H)
check_include_file ("sys/time.h" HAVE_SYS_TIME_H)
check_include_file ("sys/types.h" HAVE_SYS_TYPES_H)
check_include_file ("sys/wait.h" HAVE_SYS_WAIT_H)
check_include_file ("unistd.h" HAVE_UNISTD_H)

check_symbol_exists (getrlimit "sys/resource.h" HAVE_GETRLIMIT)
check_symbol_exists (rewinddir "dirent.h" HAVE_REWINDDIR)
check_symbol_exists (stpcpy "string.h" HAVE_STPCPY)
check_symbol_exists (strlcpy "string.h" HAVE_STRLCPY)
check_symbol_exists (strtok_r "string.h" HAVE_STRTOK_R)
check_symbol_exists (vasprintf "stdio.h" HAVE_VASPRINTF)

if (HAVE_ICONV_H)
check_library_exists (iconv iconv "-liconv" HAVE_ICONV)
endif ()

# Mono currently supports 10.6, but strndup is not available prior to 10.7; avoiding
# the detection of strndup on OS X so Mono built on 10.7+ still runs on 10.6. This can be
# removed once support for 10.6 is dropped.
#
# iOS detection of strndup and getpwuid_r is faulty for some reason so let's simply avoid it
if (TARGET_OSX)
check_function_exists (getpwuid_r HAVE_GETPWUID_R)
elseif (NOT TARGET_IOS)
check_function_exists (getpwuid_r HAVE_GETPWUID_R)
check_function_exists (strndup HAVE_STRNDUP)
endif ()

check_type_size ("int" SIZEOF_INT)
check_type_size ("long" SIZEOF_LONG)
check_type_size ("long long" SIZEOF_LONG_LONG)
check_type_size ("void*" SIZEOF_VOID_P)

configure_file (
"${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/config.h"
)

add_subdirectory (src)
add_subdirectory (test)
128 changes: 128 additions & 0 deletions eglib/config.h.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
/* Name of package */
#cmakedefine PACKAGE "${PROJECT_NAME}"

/* Define to the address where bug reports for this package should be sent. */
#cmakedefine PACKAGE_BUGREPORT "${PACKAGE_BUGREPORT}"

/* Define to the full name of this package. */
#cmakedefine PACKAGE_NAME "${PACKAGE_NAME}"

/* Define to the full name and version of this package. */
#cmakedefine PACKAGE_STRING "${PACKAGE_STRING}"

/* Define to the one symbol short name of this package. */
#cmakedefine PACKAGE_TARNAME "${PACKAGE_TARNAME}"

/* Define to the home page for this package. */
#cmakedefine PACKAGE_URL "${PACKAGE_URL}"

/* Define to the version of this package. */
#cmakedefine PACKAGE_VERSION "${PACKAGE_VERSION}"

/* Targeting the Android platform */
#cmakedefine PLATFORM_ANDROID 1

/* The JIT/AOT targets iOS */
#cmakedefine TARGET_IOS 1

/* The JIT/AOT targets Apple platforms */
#cmakedefine TARGET_MACH 1

/* The JIT/AOT targets OSX */
#cmakedefine TARGET_OSX 1

/* Define to 1 if you have the <dlfcn.h> header file. */
#cmakedefine HAVE_DLFCN_H 1

/* Define to 1 if you have the <getopt.h> header file. */
#cmakedefine HAVE_GETOPT_H 1

/* Define to 1 if you have the `getpwuid_r' function. */
#cmakedefine HAVE_GETPWUID_R 1

/* Define to 1 if you have the `getrlimit' function. */
#cmakedefine HAVE_GETRLIMIT 1

/* Define if you have the iconv() function and it works. */
#cmakedefine HAVE_ICONV 1

/* Define to 1 if you have the <iconv.h> header file. */
#cmakedefine HAVE_ICONV_H 1

/* Define to 1 if you have the <inttypes.h> header file. */
#cmakedefine HAVE_INTTYPES_H 1

/* Define to 1 if you have the <langinfo.h> header file. */
#cmakedefine HAVE_LANGINFO_H 1

/* Define to 1 if you have the <localcharset.h> header file. */
#cmakedefine HAVE_LOCALCHARSET_H 1

/* Define to 1 if you have the <memory.h> header file. */
#cmakedefine HAVE_MEMORY_H 1

/* Define to 1 if you have the <pwd.h> header file. */
#cmakedefine HAVE_PWD_H 1

/* Define to 1 if you have the `rewinddir' function. */
#cmakedefine HAVE_REWINDDIR 1

/* Define to 1 if you have the <stdint.h> header file. */
#cmakedefine HAVE_STDINT_H 1

/* Define to 1 if you have the <stdlib.h> header file. */
#cmakedefine HAVE_STDLIB_H 1

/* Define to 1 if you have the `stpcpy' function. */
#cmakedefine HAVE_STPCPY 1

/* Define to 1 if you have the <strings.h> header file. */
#cmakedefine HAVE_STRINGS_H 1

/* Define to 1 if you have the <string.h> header file. */
#cmakedefine HAVE_STRING_H 1

/* Define to 1 if you have the `strlcpy' function. */
#cmakedefine HAVE_STRLCPY 1

/* Define to 1 if you have the `strndup' function. */
#cmakedefine HAVE_STRNDUP 1

/* Define to 1 if you have the `strtok_r' function. */
#cmakedefine HAVE_STRTOK_R 1

/* Define to 1 if you have the <sys/resource.h> header file. */
#cmakedefine HAVE_SYS_RESOURCE_H 1

/* Define to 1 if you have the <sys/select.h> header file. */
#cmakedefine HAVE_SYS_SELECT_H 1

/* Define to 1 if you have the <sys/stat.h> header file. */
#cmakedefine HAVE_SYS_STAT_H 1

/* Define to 1 if you have the <sys/time.h> header file. */
#cmakedefine HAVE_SYS_TIME_H 1

/* Define to 1 if you have the <sys/types.h> header file. */
#cmakedefine HAVE_SYS_TYPES_H 1

/* Define to 1 if you have the <sys/wait.h> header file. */
#cmakedefine HAVE_SYS_WAIT_H 1

/* Define to 1 if you have the <unistd.h> header file. */
#cmakedefine HAVE_UNISTD_H 1

/* Define to 1 if you have the `vasprintf' function. */
#cmakedefine HAVE_VASPRINTF 1

/* The size of `int', as computed by sizeof. */
#cmakedefine SIZEOF_INT ${SIZEOF_INT}

/* The size of `long', as computed by sizeof. */
#cmakedefine SIZEOF_LONG ${SIZEOF_LONG}

/* The size of `long long', as computed by sizeof. */
#cmakedefine SIZEOF_LONG_LONG ${SIZEOF_LONG_LONG}

/* The size of `void *', as computed by sizeof. */
#cmakedefine SIZEOF_VOID_P ${SIZEOF_VOID_P}
73 changes: 73 additions & 0 deletions eglib/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@

list (APPEND SOURCES
eglib-remap.h
sort.frag.h
glib.h
garray.c
gbytearray.c
gerror.c
vasprintf.h
ghashtable.c
giconv.c
gmem.c
gmodule.h
goutput.c
gqsort.c
gstr.c
gslist.c
gstring.c
gptrarray.c
glist.c
gqueue.c
gpath.c
gshell.c
gspawn.c
gfile.c
gfile-posix.c
gpattern.c
gmarkup.c
gutf8.c
gunicode.c
unicode-data.h
)

if (NEED_VASPRINTF)
list (APPEND SOURCES vasprintf.c)
endif (NEED_VASPRINTF)

if (WIN32)
list (APPEND SOURCES
eglib-config.hw
gdate-win32.c
gdir-win32.c
gfile-win32.c
gmisc-win32.c
gmodule-win32.c
gtimer-win32.c
)
else ()
list (APPEND SOURCES
gdate-unix.c
gdir-unix.c
gfile-unix.c
gmisc-unix.c
gmodule-unix.c
gtimer-unix.c
)
endif (WIN32)

add_library (eglib-obj OBJECT ${SOURCES})
set_target_properties (eglib-obj PROPERTIES COMPILE_FLAGS "-g -Wall -D_FORTIFY_SOURCE=2")

add_library (eglib SHARED $<TARGET_OBJECTS:eglib-obj>)
add_library (eglib-static STATIC $<TARGET_OBJECTS:eglib-obj>)

if (WIN32)
set_target_properties (eglib PROPERTIES LINK_FLAGS "-lm -lpsapi ${LIBICONV}")
set_target_properties (eglib-static PROPERTIES LINK_FLAGS "-lm -lpsapi ${LIBICONV}")
elseif (ANDROID)
set_target_properties (eglib PROPERTIES LINK_FLAGS "-llog")
set_target_properties (eglib-static PROPERTIES LINK_FLAGS "-llog ${LIBICONV}")
else ()
set_target_properties (eglib-static PROPERTIES LINK_FLAGS "${LIBICONV}")
endif (WIN32)
34 changes: 34 additions & 0 deletions eglib/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

list (APPEND SOURCES
test.c
test.h
tests.h
driver.c
hashtable.c
string-util.c
string.c
slist.c
sizes.c
ptrarray.c
list.c
array.c
fake.c
path.c
queue.c
shell.c
spawn.c
timer.c
file.c
pattern.c
dir.c
markup.c
unicode.c
utf8.c
endian.c
module.c
memory.c
)

add_executable (test-eglib EXCLUDE_FROM_ALL ${SOURCES})
set_target_properties (test-eglib PROPERTIES COMPILE_FLAGS "-Wall -DEGLIB_TESTS=1 -D_FORTIFY_SOURCE=2 -DDRIVER_NAME=\\\"EGlib\\\"")
target_link_libraries (test-eglib eglib-static)