]> git.lyx.org Git - features.git/blobdiff - development/scons/SConstruct
Scons: config.h moves to BUILDDIR/common, boost_config.h moves to BUILDDIR/boost.
[features.git] / development / scons / SConstruct
index 5d6015e281529c88c5b69b6bfd359e5776114f28..723a9757293fa135b5730b17174ffa43f5d2a076 100644 (file)
@@ -254,7 +254,7 @@ if (not ARGUMENTS.has_key('load_option') or \
     and opt_cache.has_key('qt_dir'):
     opt_cache.pop('qt_dir')
   # some options will require full rebuild
-  # these are in general things that will change src/config.h
+  # these are in general things that will change config.h
   for arg in ['version_suffix', 'nls', 'boost', 'spell']:
     if ARGUMENTS.has_key(arg) and ((not opt_cache.has_key(arg)) or \
       ARGUMENTS[arg] != opt_cache[arg]):
@@ -648,10 +648,12 @@ if not fast_start:
 
 # now, if msvc2005 is used, we will need that QT_LIB_PATH/QT_LIB.manifest file
 if use_vc:
-  # glob file xxx.dll.manifest (msvc 2003 may not have it)
-  manifests = glob.glob(os.path.join(qt_lib_path, '*.dll.manifest'))
-  if manifests != []:
-    env['LINKCOM'] = [env['LINKCOM'], 'mt.exe /MANIFEST %s /outputresource:$TARGET;1' % manifests[0]]
+  if mode == 'debug':
+    manifest = os.path.join(qt_lib_path, 'QtGuid4.dll.manifest')
+  else:
+    manifest = os.path.join(qt_lib_path, 'QtGui4.dll.manifest')
+  if os.path.isfile(manifest):
+    env['LINKCOM'] = [env['LINKCOM'], 'mt.exe /MANIFEST %s /outputresource:$TARGET;1' % manifest]
 
 # check socket libs
 if not fast_start:
@@ -762,11 +764,83 @@ else:
 #----------------------------------------------------------
 aspell_lib = 'aspell'
 # assume that we use aspell, aspelld compiled for msvc
-if platform_name == 'win32' and mode == 'debug':
+if platform_name == 'win32' and mode == 'debug' and use_vc:
   aspell_lib = 'aspelld'
 
 if not fast_start:
-  print "Generating src/config.h..."
+  #
+  boost_config_h = os.path.join(env.Dir('$BUILDDIR/boost').path, 'config.h')
+  #
+  print "Creating %s..." % boost_config_h
+  #
+  utils.createConfigFile(conf,
+    config_file = boost_config_h,
+    config_pre = '''/* boost/config.h.  Generated by SCons.  */
+
+/* -*- C++ -*- */
+/*
+ * \file config.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * This is the compilation configuration file for LyX.
+ * It was generated by scon.
+ * You might want to change some of the defaults if something goes wrong
+ * during the compilation.
+ */
+
+#ifndef _BOOST_CONFIG_H
+#define _BOOST_CONFIG_H
+''',
+    headers = [
+      ('ostream', 'HAVE_OSTREAM', 'cxx'),
+      ('locale', 'HAVE_LOCALE', 'cxx'),
+      ('sstream', 'HAVE_SSTREAM', 'cxx'),
+      #('newapis.h', 'HAVE_NEWAPIS_H', 'c'),
+    ],
+    custom_tests = [
+      (env.has_key('assertions') and env['assertions'],
+        'ENABLE_ASSERTIONS',
+        'Define if you want assertions to be enabled in the code'
+      ),
+    ],
+    config_post = '''
+
+#define BOOST_USER_CONFIG <config.h>
+
+#if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
+#  define USE_BOOST_FORMAT 1
+#else
+#  define USE_BOOST_FORMAT 0
+#endif
+
+#if !defined(ENABLE_ASSERTIONS)
+#  define BOOST_DISABLE_ASSERTS 1
+#endif
+#define BOOST_ENABLE_ASSERT_HANDLER 1
+
+#define BOOST_DISABLE_THREADS 1
+#define BOOST_NO_WREGEX 1
+#define BOOST_NO_WSTRING 1
+
+#ifdef __CYGWIN__
+#  define BOOST_POSIX 1
+#endif
+
+#define BOOST_ALL_NO_LIB 1
+
+#if defined(HAVE_NEWAPIS_H)
+#  define WANT_GETFILEATTRIBUTESEX_WRAPPER 1
+#endif
+
+#endif
+'''
+  )
+  #
+  # config.h for each build
+  config_h = os.path.join(env.Dir('$BUILDDIR/common').path, 'config.h')
+  
+  print "\nGenerating %s..." % config_h
 
   # AIKSAURUS_H_LOCATION
   if (conf.CheckCXXHeader("Aiksaurus.h")):
@@ -805,7 +879,7 @@ if not fast_start:
   #
   # create config.h
   result = utils.createConfigFile(conf,
-    config_file = os.path.join(top_src_dir, 'src', 'config.h'),
+    config_file = config_h,
     config_pre = '''/* src/config.h.  Generated by SCons.  */
 
 /* -*- C++ -*- */
@@ -827,7 +901,6 @@ if not fast_start:
       ('io.h', 'HAVE_IO_H', 'c'),
       ('limits.h', 'HAVE_LIMITS_H', 'c'),
       ('locale.h', 'HAVE_LOCALE_H', 'c'),
-      ('locale', 'HAVE_LOCALE', 'cxx'),
       ('process.h', 'HAVE_PROCESS_H', 'c'),
       ('stdlib.h', 'HAVE_STDLIB_H', 'c'),
       ('sys/stat.h', 'HAVE_SYS_STAT_H', 'c'),
@@ -839,7 +912,6 @@ if not fast_start:
       ('utime.h', 'HAVE_UTIME_H', 'c'),
       ('direct.h', 'HAVE_DIRECT_H', 'c'),
       ('istream', 'HAVE_ISTREAM', 'cxx'),
-      ('ostream', 'HAVE_OSTREAM', 'cxx'),
       ('ios', 'HAVE_IOS', 'cxx'),
     ],
     functions = [
@@ -859,13 +931,13 @@ if not fast_start:
       ('mkstemp', 'HAVE_MKSTEMP', None),
       ('strerror', 'HAVE_STRERROR', None),
       ('count', 'HAVE_STD_COUNT', '''
-  #include <algorithm>
-  int count()
-  {
-    char a[] = "hello";
-    return std::count(a, a+5, 'l');
-  }
-  '''),
+#include <algorithm>
+int count()
+{
+  char a[] = "hello";
+  return std::count(a, a+5, 'l');
+}
+'''),
       ('getcwd', 'HAVE_GETCWD', None),
       ('setenv', 'HAVE_SETENV', None),
       ('putenv', 'HAVE_PUTENV', None),
@@ -900,10 +972,6 @@ if not fast_start:
         'Define if your <locale.h> file defines LC_MESSAGES.'
       ),
       (devel_version, 'DEVEL_VERSION', 'Whether or not a development version'),
-      (env.has_key('assertions') and env['assertions'],
-        'ENABLE_ASSERTIONS',
-        'Define if you want assertions to be enabled in the code'
-      ),
       (env.has_key('nls') and env['nls'],
         'ENABLE_NLS',
         "Define to 1 if translation of program messages to the user's native anguage is requested.",
@@ -916,7 +984,7 @@ if not fast_start:
         '_GLIBCXX_CONCEPT_CHECKS',
         'libstdc++ concept checking'
       ),
-      (os.name != 'nt', 'BOOST_POSIZ',
+      (os.name != 'nt', 'BOOST_POSIX',
         'Indicates to boost which API to use (posix or windows).'
       ),
       (spell_engine is not None, spell_engine,
@@ -968,30 +1036,7 @@ int mkstemp(char*);
 #endif
 #endif
 
-#if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
-#  define USE_BOOST_FORMAT 1
-#else
-#  define USE_BOOST_FORMAT 0
-#endif
-
-#define BOOST_USER_CONFIG <config.h>
-
-#if !defined(ENABLE_ASSERTIONS)
-#  define BOOST_DISABLE_ASSERTS 1
-#endif
-#define BOOST_ENABLE_ASSERT_HANDLER 1
-
-#define BOOST_DISABLE_THREADS 1
-#define BOOST_NO_WREGEX 1
-#define BOOST_NO_WSTRING 1
-
-#ifdef __CYGWIN__
-#  define BOOST_POSIX 1
-#endif
-
-#if defined(HAVE_NEWAPIS_H)
-#  define WANT_GETFILEATTRIBUTESEX_WRAPPER 1
-#endif
+#include <../boost/config.h>
 
 #endif
 '''
@@ -1040,7 +1085,7 @@ try:
     qt_libs = ['QtCore', 'QtGui']
     # set the right lib names
     if platform_name == 'win32':
-      if mode == 'debug':
+      if mode == 'debug' and use_vc:
         qt_lib_suffix = 'd4'
       else:
         qt_lib_suffix = '4'
@@ -1090,11 +1135,14 @@ if env['X11']:
   env.AppendUnique(LIBPATH = ['/usr/X11R6/lib'])
 
 #
-# boost is always in, src is needed for config.h
+# boost: for boost header files
+# BUILDDIR/common: for config.h
+# TOP_SRCDIR/src: for support/* etc
+#
+env['CPPPATH'] += ['$TOP_SRCDIR/boost', '$BUILDDIR/common', '$TOP_SRCDIR/src']
 #
 # QT_INC_PATH is not needed for *every* source file
 env['CPPPATH'].remove(qt_inc_path)
-env['CPPPATH'] += ['$TOP_SRCDIR/boost', '$TOP_SRCDIR/src']
 
 #
 # Customized builders
@@ -1286,131 +1334,9 @@ if build_boost:
 
   boostenv = env.Copy()
   #
-  boost_config_h = os.path.join(top_src_dir, 'boost', 'libs', 'config.h')
-  if not os.path.isfile(boost_config_h) or not fast_start:
-    #
-    print "Creating boost/config.h..."
-    #
-    # start another configuration session.
-    conf = Configure(boostenv, 
-      custom_tests = {'CheckMkdirOneArg' : utils.checkMkdirOneArg},
-    )      
-    #
-    # create config.h
-    result = utils.createConfigFile(conf,
-      config_file = boost_config_h,
-      config_pre = '''/* boost/libs/config.h.  Generated by SCons.  */
-
-/* -*- C++ -*- */
-/*
- * \file config.h
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * This is the compilation configuration file for LyX.
- * It was generated by scon.
- * You might want to change some of the defaults if something goes wrong
- * during the compilation.
- */
-
-#ifndef _CONFIG_H
-#define _CONFIG_H
-''',
-      headers = [
-        ('io.h', 'HAVE_IO_H', 'c'),
-        ('limits.h', 'HAVE_LIMITS_H', 'c'),
-        ('locale.h', 'HAVE_LOCALE_H', 'c'),
-        ('locale', 'HAVE_LOCALE', 'cxx'),
-        ('process.h', 'HAVE_PROCESS_H', 'c'),
-        ('stdlib.h', 'HAVE_STDLIB_H', 'c'),
-        ('sys/stat.h', 'HAVE_SYS_STAT_H', 'c'),
-        ('sys/time.h', 'HAVE_SYS_TIME_H', 'c'),
-        ('sys/types.h', 'HAVE_SYS_TYPES_H', 'c'),
-        ('sys/utime.h', 'HAVE_SYS_UTIME_H', 'c'),
-        ('sys/socket.h', 'HAVE_SYS_SOCKET_H', 'c'),
-        ('unistd.h', 'HAVE_UNISTD_H', 'c'),
-        ('utime.h', 'HAVE_UTIME_H', 'c'),
-        ('direct.h', 'HAVE_DIRECT_H', 'c'),
-        ('istream', 'HAVE_ISTREAM', 'cxx'),
-        ('ostream', 'HAVE_OSTREAM', 'cxx'),
-        ('ios', 'HAVE_IOS', 'cxx'),
-      ],
-      functions = [
-        ('open', 'HAVE_OPEN', None),
-        ('close', 'HAVE_CLOSE', None),
-        ('popen', 'HAVE_POPEN', None),
-        ('pclose', 'HAVE_PCLOSE', None),
-        ('_open', 'HAVE__OPEN', None),
-        ('_close', 'HAVE__CLOSE', None),
-        ('_popen', 'HAVE__POPEN', None),
-        ('_pclose', 'HAVE__PCLOSE', None),
-        ('getpid', 'HAVE_GETPID', None),
-        ('_getpid', 'HAVE__GETPID', None),
-        ('mkdir', 'HAVE_MKDIR', None),
-        ('_mkdir', 'HAVE__MKDIR', None),
-        ('mktemp', 'HAVE_MKTEMP', None),
-        ('mkstemp', 'HAVE_MKSTEMP', None),
-        ('strerror', 'HAVE_STRERROR', None),
-        ('getcwd', 'HAVE_GETCWD', None),
-        ('setenv', 'HAVE_SETENV', None),
-        ('putenv', 'HAVE_PUTENV', None),
-        ('fcntl', 'HAVE_FCNTL', None),
-      ],
-      custom_tests = [
-        (conf.CheckMkdirOneArg(),
-          'MKDIR_TAKES_ONE_ARG',
-          'Define if mkdir takes only one argument.'
-        ),
-        (env.has_key('assertions') and env['assertions'],
-          'ENABLE_ASSERTIONS',
-          'Define if you want assertions to be enabled in the code'
-        ),
-        (env.has_key('warnings') and env['warnings'],
-          'WITH_WARNINGS',
-          'Define this if you want to see the warning directives put here and there by the developpers to get attention'
-        ),
-        (env.has_key('concept_checks') and env['concept_checks'],
-          '_GLIBCXX_CONCEPT_CHECKS',
-          'libstdc++ concept checking'
-        ),
-        (os.name != 'nt', 'BOOST_POSIZ',
-          'Indicates to boost which API to use (posix or windows).'
-        ),
-      ],
-      extra_items = [
-        ('#define BOOST_ALL_NO_LIB 1',
-          'disable automatic linking of boost libraries.'),
-      ],
-      config_post = '''
-
-#if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
-#  define USE_BOOST_FORMAT 1
-#else
-#  define USE_BOOST_FORMAT 0
-#endif
-
-#define BOOST_USER_CONFIG <config.h>
-
-#if !defined(ENABLE_ASSERTIONS)
-#  define BOOST_DISABLE_ASSERTS 1
-#endif
-#define BOOST_ENABLE_ASSERT_HANDLER 1
-
-#define BOOST_DISABLE_THREADS 1
-#define BOOST_NO_WREGEX 1
-#define BOOST_NO_WSTRING 1
-
-#ifdef __CYGWIN__
-#  define BOOST_POSIX 1
-#endif
-
-#endif
-'''
-    )
-    conf.Finish()
   # 
   # boost use its own config.h
-  boostenv['CPPPATH'] = ['$TOP_SRCDIR/boost', '$TOP_SRCDIR/boost/libs'] + extra_inc_paths
+  boostenv['CPPPATH'] = ['$TOP_SRCDIR/boost', '$BUILDDIR/boost'] + extra_inc_paths
   boostenv.AppendUnique(CCFLAGS = ['-DBOOST_USER_CONFIG="<config.h>"'])
 
   for lib in boost_libs:
@@ -1429,10 +1355,10 @@ if build_intl:
   #
   intlenv = env.Copy()
   #
-  intl_config_h = os.path.join(top_src_dir, 'intl', 'config.h')
+  intl_config_h = os.path.join(intlenv.Dir('$BUILDDIR/intl').path, 'config.h')
   if not os.path.isfile(intl_config_h) or not fast_start:
     #
-    print "Creating intl/config.h..."
+    print "Creating %s..." % intl_config_h
     #
     # start another configuration session.
     conf = Configure(intlenv,
@@ -1557,7 +1483,7 @@ if build_intl:
   if use_vc:
     intlenv.Append(CCFLAGS=['/Dinline#', '/D__attribute__(x)#', '/Duintmax_t=UINT_MAX'])
   # intl does not use global config.h
-  intlenv['CPPPATH'] = ['intl'] + extra_inc_paths
+  intlenv['CPPPATH'] = ['$BUILDDIR/intl'] + extra_inc_paths
 
   intlenv.Append(CCFLAGS = [
     r'-DLOCALEDIR=\"' + env['LOCALEDIR'].replace('\\', '\\\\') + r'\"',
@@ -2040,7 +1966,7 @@ if build_tex2lyx:
   print "Processing files in src/tex2lyx..."
 
   tex2lyx_env = env.Copy()
-  # the order is important here.
+  #
   tex2lyx_env.Prepend(CPPPATH = ['$BUILDDIR/common/tex2lyx'])
   tex2lyx_env.AppendUnique(LIBPATH = ['#$LOCALLIBPATH'])