xbuild: Collect and dump timing information.
[mono.git] / CMakeLists.txt
index f895008dc4ba3978dd816dfaee17a85f3d420436..f2f2089f386f44bc72cfab7ec4344a3e5b76de6c 100644 (file)
@@ -1,10 +1,15 @@
 cmake_minimum_required(VERSION 2.6.4)
 
+# To keep this in sync with the autoconf based system:
+# git log -n --format=oneline CMakeLists.txt
+# git diff <commit displayed by previous line>..HEAD configure.in Makefile.am
+
 # FIXME: Sanitize the variables, no need for the duplicate am conditionals
 # - It would be nice to rename 'CMakeFiles' to something like '.cmake'
 # - It would be nice to have a per-target VERBOSE setting
 # - or a way to change the setting name to 'V' and the output to CC <src>
 #   to be similar to the current build output
+# - Add a cache to the manual checks
 
 # We use lowercase commands as advocated by the kde cmake coding style
 
@@ -132,9 +137,8 @@ endfunction()
 
 # The lines commented out using ### are the stuff from configure.in which still 
 # need to be ported to cmake
-# The svn revision of the configure.in used is r132691
 
-set(VERSION 2.5)
+set(VERSION 2.7)
 ac_define_unquoted(VERSION ${VERSION} "Version number of package")
 set(API_VER 1.0)
 ###
@@ -222,7 +226,8 @@ endif()
 ###case "$host" in
 ###    *-*-mingw*|*-*-cygwin*)
 ###            set(platform_win32 yes)
-###            ac_define(PLATFORM_WIN32,1,[Platform is Win32])
+###            AC_DEFINE(PLATFORM_WIN32,1,[Host Platform is Win32])
+###            AC_DEFINE(TARGET_WIN32,1,[Target OS is Win32])
 ###            ac_define(DISABLE_PORTABILITY,1,[Disable the io-portability layer])
 ###            ac_define(PLATFORM_NO_SYMLINKS,1,[This platform does not support symlinks])
 ###            if test "x$cross_compiling" = "xno"; then
@@ -374,7 +379,8 @@ if(use_sigposix)
   set(PLATFORM_SIGPOSIX 1)
 endif()
 if(platform_win32)
-  set(PLATFORM_WIN32 yes)
+  set(HOST_WIN32 yes)
+  set(TARGET_WIN32 yes)
 endif()
 if(${target_os} MATCHES "*linux*")
   set(PLATFORM_LINUX yes)
@@ -497,19 +503,22 @@ check_c_source_compiles("
 void main () {}
 " GCC)
 
-ac_msg_checking("for isinf")
-set(compiles)
-check_c_source_compiles("
+if(NOT HAVE_ISINF)
+  ac_msg_checking("for isinf")
+  set(compiles)
+  check_c_source_compiles("
 #include <math.h>
 void main () {
 int f = isinf (1);
 }
 " compiles)
-if(compiles)
-  ac_msg_result(yes)
-  ac_define(HAVE_ISINF 1 "isinf available")
-else()
-  ac_msg_result(no)
+  if(compiles)
+       ac_msg_result(yes)
+       ac_define(HAVE_ISINF 1 "isinf available")
+       set(HAVE_ISINF 1 CACHE BOOL "Have the isinf function")
+  else()
+       ac_msg_result(no)
+  endif()
 endif()
 
 # not 64 bit clean in cross-compile
@@ -559,12 +568,16 @@ endif()
 # A sanity check to catch cases where the package was unpacked
 # with an ancient tar program (Solaris)
 #
-ac_msg_checking("integrity of package")
-if(EXISTS ${srcdir}/${mcsdir}/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapTypeMapper.cs)
-  ac_msg_result(ok)
-else()
-  set(errorm "Your mono distribution is incomplete;  if unpacking from a tar file, make sure you use GNU tar;  see http://www.mono-project.com/IncompletePackage for more details")
-  ac_msg_error(${errorm})
+set(solaris-tar-check yes CACHE BOOL "Enable/disable solaris tar check")
+
+if(solaris-tar-check)
+  ac_msg_checking("integrity of package")
+  if(EXISTS ${srcdir}/${mcsdir}/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapTypeMapper.cs)
+       ac_msg_result(ok)
+  else()
+       set(errorm "Your mono distribution is incomplete;  if unpacking from a tar file, make sure you use GNU tar;  see http://www.mono-project.com/IncompletePackage for more details")
+       ac_msg_error(${errorm})
+  endif()
 endif()
 
 set(mcs_topdir ${top_srcdir}/${mcsdir})
@@ -772,7 +785,8 @@ set(DISABLED_FEATURES none)
 ac_define_unquoted(DISABLED_FEATURES "${DISABLED_FEATURES}" "String of disabled features")
 ###
 ###if test "x$mono_feature_disable_aot" = "xyes"; then
-###    ac_define(DISABLE_AOT, 1, [Disable AOT support])
+###    AC_DEFINE(DISABLE_AOT_COMPILER, 1, [Disable AOT Compiler])
+###    AC_MSG_NOTICE([Disabled AOT compiler])
 ###fi
 ###
 ###if test "x$mono_feature_disable_profiler" = "xyes"; then
@@ -2063,11 +2077,12 @@ set(enable_llvm ${llvm})
 
 ###   set(LLVM_CXXFLAGS `$LLVM_CONFIG --cflags`)
 ###   set(LLVM_LDFLAGS `$LLVM_CONFIG --ldflags`)
-###   set(LLVM_LIBS `$LLVM_CONFIG --libs core engine`)
+###   LLVM_LIBS=`$LLVM_CONFIG --libs core bitwriter jit x86codegen`
 ###   set(LLVM_LIBS "$LLVM_LDFLAGS $LLVM_LIBS -lstdc++")
 
 ###   AC_SUBST(LLVM_CXXFLAGS)
 ###   AC_SUBST(LLVM_LIBS)
+###   AC_SUBST(LLVM_LDFLAGS)
 ###   ac_define(ENABLE_LLVM, 1, [Enable the LLVM back end])
 ###fi
 
@@ -2105,6 +2120,26 @@ elseif(host MATCHES "arm.*-linux.*")
   set(ACCESS_UNALIGNED no)
   set(JIT_SUPPORTED yes)
   set(jit_wanted true)
+elseif(host MATCHES "mips.*")
+  set(TARGET MIPS)
+  set(arch_target mips)
+  set(ACCESS_UNALIGNED no)
+  set(JIT_SUPPORTED yes)
+  set(jit_wanted true)
+###            ac_msg_checking(for mips n32)
+###            AC_TRY_COMPILE([], [
+###            void main () {
+###            #if _MIPS_SIM != _ABIN32
+###            #error Not mips n32
+###            #endif
+###            }
+###            ],[
+###            ac_msg_result(yes)
+###            set(sizeof_register 8)
+###            ],[
+###            ac_msg_result(no)
+###            ])
+###            ;;
 else()
   message(FATAL_ERROR "Host ${host} not yet supported by the cmake build.")
 endif()
@@ -2123,27 +2158,6 @@ endif()
 #              set(TARGET MIPS;)
 #              set(ACCESS_UNALIGNED "no")
 #              ;;
-###    mips*)
-###            set(TARGET MIPS;)
-###            set(arch_target mips;)
-###            set(ACCESS_UNALIGNED "no")
-###            set(JIT_SUPPORTED yes)
-###            set(jit_wanted true)
-
-###            ac_msg_checking(for mips n32)
-###            AC_TRY_COMPILE([], [
-###            void main () {
-###            #if _MIPS_SIM != _ABIN32
-###            #error Not mips n32
-###            #endif
-###            }
-###            ],[
-###            ac_msg_result(yes)
-###            set(sizeof_register 8)
-###            ],[
-###            ac_msg_result(no)
-###            ])
-###            ;;
 ###    i*86-*-*)
 ###            set(TARGET X86;)
 ###            set(arch_target x86;)
@@ -2293,6 +2307,14 @@ else()
    ac_define(SIZEOF_REGISTER SIZEOF_VOID_P "size of machine integer registers")
 endif()
 
+###if test "x$target_byte_order" = "xG_BIG_ENDIAN"; then
+###   AC_DEFINE(TARGET_BYTE_ORDER,G_BIG_ENDIAN,[byte order of target])
+###elif test "x$target_byte_order" = "xG_LITTLE_ENDIAN"; then
+###   AC_DEFINE(TARGET_BYTE_ORDER,G_LITTLE_ENDIAN,[byte order of target])
+###else
+###   AC_DEFINE(TARGET_BYTE_ORDER,G_BYTE_ORDER,[byte order of target])
+###fi
+
 ###if (${have_visibility_hidden" = "xyes"; then
 ###   ac_define(HAVE_VISIBILITY_HIDDEN, 1, [Support for the visibility ("hidden") attribute])
 ###fi
@@ -2404,6 +2426,9 @@ if(${TARGET} STREQUAL "AMD64" OR ${TARGET} STREQUAL "X86")
        if (host MATCHES ".*-.*-.*linux.*")
          set(mono_debugger_supported yes)
        endif()
+       if (host MATCHES ".*86-apple-darwin.*")
+         set(mono_debugger_supported yes)
+       endif()
   endif()
 endif()
 
@@ -2492,13 +2517,12 @@ endif()
 ###            ;;
 ###esac
 
-set(preview yes CACHE BOOL "If you want to install the 2.0 FX preview (defaults to yes)")
-set(PREVIEW ${preview})
-set(moonlight yes CACHE BOOL "If you want to build the Moonlight 2.1 assemblies (defaults to yes)")
-set(MOONLIGHT ${moonlight})
-set(OPROFILE no)
-set(oprofile no CACHE STRING "<oprofile install dir> or 'no' to disable oprofile support (defaults to no)")
-if (NOT oprofile STREQUAL no)
+set(with_moonlight yes CACHE BOOL "If you want to build the Moonlight 2.1 assemblies (defaults to yes)")
+set(with_profile4 no CACHE BOOL "If you want to install the 4.0 FX (defaults to no)")
+set(with_monotouch no CACHE BOOL "If you want to build the raw MonoTouch 2.1 assemblies (defaults to no)")
+set(with_oprofile no)
+set(with_oprofile no CACHE STRING "<oprofile install dir> or 'no' to disable oprofile support (defaults to no)")
+if (NOT with_oprofile STREQUAL no)
 ###    if test x$with_oprofile != xno; then
 ###        set(oprofile_include $with_oprofile/include)
 ###        if test ! -f $oprofile_include/opagent.h; then
@@ -2526,7 +2550,7 @@ set(mcs_docs yes CACHE STRING "If you want to build the documentation under mcs
 if(NOT mcs_docs)
   set(DISABLE_MCS_DOCS yes)
 endif()
-if(OPROFILE)
+if(with_oprofile)
   set(HAVE_OPROFILE yes)
 endif()
 ###AC_SUBST(OPROFILE_CFLAGS)
@@ -2545,6 +2569,10 @@ if(MOONLIGHT)
   set(INSTALL_2_1 yes)
 endif()
 
+###AM_CONDITIONAL(INSTALL_2_1, [test "x$with_moonlight" = xyes])
+###AM_CONDITIONAL(INSTALL_4_0, [test "x$with_profile4" = xyes])
+###AM_CONDITIONAL(INSTALL_MONOTOUCH, [test "x$with_monotouch" = xyes])
+
 ###AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
 ###AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
 # Define a variable for the target
@@ -2667,6 +2695,36 @@ execute_process (COMMAND chmod a+x runtime/mono-wrapper runtime/monodis-wrapper)
 ###    cd $depth
 ###],[set(LN_S '$LN_S']))
 
+###AC_CONFIG_COMMANDS([runtime/etc/mono/4.0/machine.config],
+###[   depth=../../../..
+###    case $srcdir in
+###    [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;;
+###    .) reldir=$depth ;;
+###    *) reldir=$depth/$srcdir ;;
+###    esac
+###    $ac_aux_dir/install-sh -d runtime/etc/mono/4.0
+###    cd runtime/etc/mono/4.0
+###    rm -f machine.config
+###    $LN_S $reldir/data/net_4_0/machine.config machine.config
+###    cd $depth
+###],[LN_S='$LN_S'])
+###
+###AC_CONFIG_COMMANDS([runtime/etc/mono/4.0/web.config],
+###[   depth=../../../..
+###    case $srcdir in
+###    [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;;
+###    .) reldir=$depth ;;
+###    *) reldir=$depth/$srcdir ;;
+###    esac
+###    $ac_aux_dir/install-sh -d runtime/etc/mono/4.0
+###    cd runtime/etc/mono/4.0
+###    rm -f web.config
+###    $LN_S $reldir/data/net_4_0/web.config web.config
+###    cd $depth
+###],[LN_S='$LN_S'])
+###
+
 ###if test x$enable_quiet_build = xyes; then
 ###   AC_CONFIG_COMMANDS([quiet], [for i in `find mono libgc support -name Makefile.in | sed -e 's/Makefile.in/Makefile/g'`; do if test -f $i; then $srcdir/scripts/patch-quiet.sh $i; fi; done], [set(shell $SHELL]))
 ###   AC_CONFIG_COMMANDS([quiet-libtool], [sed -e 's/$echo "copying selected/$show "copying selected/g' < libtool > libtool.tmp && mv libtool.tmp libtool && chmod a+x libtool; sed -e 's/$ECHO "copying selected/# "copying selected/g' < libtool > libtool.tmp && mv libtool.tmp libtool && chmod a+x libtool])
@@ -2743,6 +2801,7 @@ data/config
 )
 
 ###AC_OUTPUT([
+###mono-core.spec
 ###mono-uninstalled.pc
 ###scripts/mono-find-provides
 ###scripts/mono-find-requires
@@ -2779,8 +2838,8 @@ data/config
 ###web/Makefile
 ###docs/Makefile
 ###data/Makefile
-###data/net_1_1/Makefile
 ###data/net_2_0/Makefile
+###data/net_4_0/Makefile
 ###data/net_2_0/Browsers/Makefile
 ###data/mint.pc
 ###data/mono.pc
@@ -2895,12 +2954,13 @@ message(STATUS
        TLS:           ${with_tls}
        SIGALTSTACK:   ${with_sigaltstack}
        Engine:        ${jit_status}
-       2.0 Beta:      ${PREVIEW}
-       2.1 Alpha:     ${MOONLIGHT}
+       Moon Profile:  ${with_moonlight}
+       4.0 Alpha:     ${with_profile4}
+       MonoTouch:     ${with_monotouch}
        JNI support:   ${jdk_headers_found}
        libgdiplus:    ${libgdiplus_msg}
        zlib:          ${zlib_msg}
-       oprofile:      ${OPROFILE}
+       oprofile:      ${with_oprofile}
        BigArrays:     ${enable_big_arrays}
        DTrace:        ${enable_dtrace}
        Parallel Mark: ${enable_parallel_mark}
@@ -2956,8 +3016,7 @@ endif()
 #### Distribute the 'mcs' tree too
 ###dist-hook:
 ###    test -d $(distdir)/mcs || mkdir $(distdir)/mcs
-###    d=`cd $(distdir)/mcs && pwd`; cd $(mcs_topdir) && $(MAKE) PROFILE=net_1_1 distdir=$$d dist-recursive
-###    d=`cd $(distdir)/mcs && pwd`; cd $(mcs_topdir) && $(MAKE) PROFILE=net_2_0 distdir=$$d dist-recursive
+### d=`cd $(distdir)/mcs && pwd`; cd $(mcs_topdir) && $(MAKE) distdir=$$d dist-recursive
 
 ###pkgconfigdir = $(libdir)/pkgconfig
 ###noinst_DATA = mono-uninstalled.pc