How must I call scons? Could you please post a complete command
which I can use (after fixing the paths)?
Do I have to add all the qt_* settings to the command?
This I have done but then it asks for extra_inc_path1.

Hi, Peter,

Thank you very much for the info. Here is what I get right now.

Step 1: install scons-0.96.92

Step 2: add
boost/boost/type_traits/detail/is_function_ptr_tester.hpp
boost/boost/type_traits/detail/is_mem_fun_pointer_tester.hpp
boost/boost/detail/interlocked.hpp
boost/boost/regex/v4/w32_regex_traits.hpp
I do not add these to the patch because they are too big.

Step 3: download the official zlib dll package, unzip to (for example)
d:\msvc-libs . copy zdll.lib to z.lib (cheating)

Step 4: apply the attached patch. Note that many of the changes are
temporary and might break scons on other systems.

Step 5: run command:

scons -f development/scons/SConstruct frontend=qt4 qt_dir=d:/qt/4.1.3-vc2005 
use_vc=yes extra_inc_path=d:/MSVC-Libs/include extra_lib_path=d:/MSVC-Libs/lib 
boost=included nls=no

I come to the last linking step, and a strange error saying
libboost_filesystem-vc80-mt-s-1_33.1.lib does not exist, while the
command line asks to link to included_boost_filesystem.lib.

Bo
Index: development/scons/SConscript
===================================================================
--- development/scons/SConscript	(revision 13941)
+++ development/scons/SConscript	(working copy)
@@ -95,6 +95,7 @@
   intlenv = env.Copy()
   # we need the original C compiler for these files
   intlenv['CC'] = intlenv['C_COMPILER']
+  intlenv['CCFLAGS'] = intlenv['C_CCFLAGS']
   intlenv['CPPPATH'] += ['intl']
   
   intlenv.Append(CCFLAGS = [
@@ -452,7 +453,6 @@
       ControlVSpace.C
       ControlWrap.C
       helper_funcs.C
-      helper_funcs.h
     ''')]
     )
   Alias('controllers', controllers)
@@ -734,7 +734,7 @@
     '-DQT_GENUINE_STR',
     '-DQT_NO_STL',
     '-DQT3_SUPPORT',
-    '-Winvalid-pch']
+    ]
   )
 
   qt4_ui_files = ['$BUILDDIR/common/frontends/qt4/ui/%s' % x for x in Split('''
@@ -1175,7 +1175,7 @@
   #
   lyx = env.Program(
     target = '$BUILDDIR/$frontend/lyx',
-    source = [],
+    source = ['$BUILDDIR/common/main.C'],
     LIBS = [
       'lyxbase_pre',
       'mathed',
Index: development/scons/SConstruct
===================================================================
--- development/scons/SConstruct	(revision 13941)
+++ development/scons/SConstruct	(working copy)
@@ -256,7 +256,9 @@
   BoolOption('std_debug', '(NA) Whether or not turn on stdlib debug', False),
   # using x11?
   BoolOption('X11', 'Use x11 windows system', default_with_x),
-  # 
+  # use MS VC++ to build lyx
+  BoolOption('use_vc', 'Use MS VC++ to build lyx', False),
+  #
   PathOption('qt_dir', 'Path to qt directory', None),
   #
   PathOption('qt_include_path', 'Path to qt include directory', None),
@@ -332,7 +334,7 @@
 # Setting up environment
 #---------------------------------------------------------
 
-env = Environment(options = opts)
+env = Environment(options = opts, ENV=os.environ)
 
 # Determine the frontend to use, which may be loaded
 # from option cache
@@ -341,11 +343,14 @@
 env['frontend'] = frontend
 #
 use_X11 = env.get('X11', default_with_x)
+use_vc = env.get('use_vc', False)
 
 
 # set individual variables since I do not really like ENV = os.environ
 env['ENV']['PATH'] = os.environ.get('PATH')
 env['ENV']['HOME'] = os.environ.get('HOME')
+env['ENV']['LIB'] = os.environ.get('LIB')
+env['ENV']['INCLUDE'] = os.environ.get('INCLUDE')
 env['TOP_SRC_DIR'] = TOP_SRC_DIR
 env['SCONS_DIR'] = SCONS_DIR
 # install to default_prefix by default
@@ -373,9 +378,12 @@
 # this is a bit out of place (after auto-configration) but 
 # it is required to do the tests. Since Tool('mingw') will 
 # reset CCFLAGS etc, this should be before getEnvVariable
-if platform_name == 'win32':
+if platform_name == 'win32' and not use_vc:
   env.Tool('mingw')
   env.AppendUnique(CPPPATH = ['#c:/MinGW/include'])
+elif use_vc:
+  env.Tool('msvc')
+  env.Tool('mslink')
 
 
 # speed up source file processing
@@ -482,12 +490,20 @@
 #
 # save the old c compiler
 env['C_COMPILER'] = env['CC']
-if env.has_key('CXX') and env['CXX']:
-  env['CC'] = env['CXX']
-  env['LINK'] = env['CXX']
-else:
-  env['CC'] = 'g++'
-  env['LINK'] = 'g++'
+env['C_CCFLAGS'] = env.subst('$CCFLAGS')
+# if we use ms vc, the commands are fine (cl.exe and link.exe)
+if not use_vc:
+  if env.has_key('CXX') and env['CXX']:
+    env['CC'] = env.subst('$CXX')
+    env['LINK'] = env.subst('$CXX')
+  else:
+    env['CC'] = 'g++'
+    env['LINK'] = 'g++'
+else: 
+  # C4819: The file contains a character that cannot be represented 
+  #   in the current code page (number)
+  # C4996: foo was decleared deprecated
+  env.Append(CCFLAGS=['/TP', '/EHsc', '/wd4819', '/wd4996'])
 
 
 #----------------------------------------------------------
@@ -502,6 +518,7 @@
     'CheckSelectArgType' : utils.checkSelectArgType,
     'CheckBoostLibraries' : utils.checkBoostLibraries,
     'CheckCommand' : utils.checkCommand,
+    'CheckCXXGlobalCstd' : utils.checkCXXGlobalCstd,
   }
 )
 
@@ -610,8 +627,7 @@
   env['INCLUDED_BOOST'] = env_cache['INCLUDED_BOOST']
 
 
-if not env.has_key('nls') or env['nls']:
-  env['ENABLE_NLS'] = True
+env['ENABLE_NLS'] = not env.has_key('nls') or env['nls']
 
 if not fast_start:
   if not env['ENABLE_NLS']:
@@ -884,7 +900,18 @@
       utils.addToConfig('#define %s 1' % t[1])
     else:
       utils.addToConfig('/* #undef %s */' % t[1])
+
+  # windows/msvc sys/types.h does not have pid_t
+  # FIXME: #include <windows.h> is the right way?
+  if not conf.CheckType('pid_t', includes='#include <sys/types.h>'):
+    utils.addToConfig('#define pid_t int')
   
+  # determine the use of std::tolower or tolower
+  if conf.CheckCXXGlobalCstd():
+    utils.addToConfig('#define CXX_GLOBAL_CSTD 1')
+  else:
+    utils.addToConfig('/* #undef CXX_GLOBAL_CSTD')
+
   # PACKAGE
   # PACKAGE_VERSION
   # DEVEL_VERSION
@@ -1072,7 +1099,9 @@
 if platform_name in ['win32', 'cygwin']:
   # the final link step needs stdc++ to succeed under mingw
   # FIXME: shouldn't g++ automatically link to stdc++?
-  env['SYSTEM_LIBS'] = ['shlwapi', 'z', 'stdc++']
+  env['SYSTEM_LIBS'] = ['shlwapi', 'z']
+  if not use_vc:
+    env['SYSTEM_LIBS'].append('stdc++')
 else:
   env['SYSTEM_LIBS'] = ['z']
 
Index: development/scons/scons_utils.py
===================================================================
--- development/scons/scons_utils.py	(revision 13941)
+++ development/scons/scons_utils.py	(working copy)
@@ -56,8 +56,12 @@
   contents = source_file.read()
   for k, v in env.items():
     try:
-      contents = re.sub('@'+k+'@', env.subst('$'+k).replace('\n',r'\\n\\\n'), contents)
-      contents = re.sub('%'+k+'%', env.subst('$'+k).replace('\n',r'\\n\\\n'), contents)
+      val = env.subst('$'+k)
+      # temporary fix for the \Resource backslash problem
+      val = val.replace('\\', '/')
+      val = val.replace('\n',r'\\n\\\n')
+      contents = re.sub('@'+k+'@', val, contents)
+      contents = re.sub('%'+k+'%', val, contents)
     except:
       pass
   target_file.write(contents + "\n")
@@ -180,7 +184,8 @@
 """
   conf.Message('Checking for the number of args for mkdir... ')
   ret = conf.TryLink(check_mkdir_one_arg_source, '.c') or \
-    conf.TryLink('#include <unistd.h>' + check_mkdir_one_arg_source, '.c')
+    conf.TryLink('#include <unistd.h>' + check_mkdir_one_arg_source, '.c') or \
+    conf.TryLink('#include <direct.h>' + check_mkdir_one_arg_source, '.c')
   if ret:
     conf.Result('one')
   else:
@@ -188,6 +193,23 @@
   return ret
 
 
+# CXX_GLOBAL_CSTD
+def checkCXXGlobalCstd(conf):
+  ''' Check the use of std::tolower or tolower '''
+  check_global_cstd_source = '''
+#include <cctype>
+using std::tolower;
+int main()
+{
+  return 0;
+}
+'''
+  conf.Message('Check for the use of global cstd... ')
+  ret = conf.TryLink(check_global_cstd_source, '.c')
+  conf.Result(ret)
+  return ret
+
+
 # SELECT_TYPE_ARG1
 # SELECT_TYPE_ARG234
 # SELECT_TYPE_ARG5
Index: src/frontends/qt4/BulletsModule.C
===================================================================
--- src/frontends/qt4/BulletsModule.C	(revision 13941)
+++ src/frontends/qt4/BulletsModule.C	(working copy)
@@ -250,6 +250,7 @@
 	default:
 		return standard_->pixmap(row,col);
 	}*/
+return QPixmap();
 }
 
 
Index: src/support/lyxsum.C
===================================================================
--- src/support/lyxsum.C	(revision 13941)
+++ src/support/lyxsum.C	(working copy)
@@ -122,6 +122,7 @@
 }
 #else
 
+using std::ifstream;
 using std::istream_iterator;
 using std::ios;
 
Index: src/support/forkedcall.C
===================================================================
--- src/support/forkedcall.C	(revision 13941)
+++ src/support/forkedcall.C	(working copy)
@@ -44,6 +44,7 @@
 # define SIGKILL 9
 # include <process.h>
 # include <windows.h>
+# include <cerrno>
 
 #else
 # include <cerrno>
Index: src/support/mkdir.C
===================================================================
--- src/support/mkdir.C	(revision 13941)
+++ src/support/mkdir.C	(working copy)
@@ -24,6 +24,7 @@
 #endif
 #ifdef _WIN32
 # include <windows.h>
+# include <direct.h>
 #endif
 
 int lyx::support::mkdir(std::string const & pathname, unsigned long int mode)
Index: src/support/tempname.C
===================================================================
--- src/support/tempname.C	(revision 13941)
+++ src/support/tempname.C	(working copy)
@@ -38,6 +38,11 @@
 # endif
 #endif
 
+#if (!defined S_IRUSR)
+   #define S_IRUSR   S_IREAD
+   #define S_IWUSR   S_IWRITE
+#endif
+
 using boost::scoped_array;
 
 using std::string;
Index: src/support/package.C.in
===================================================================
--- src/support/package.C.in	(revision 13941)
+++ src/support/package.C.in	(working copy)
@@ -26,7 +26,11 @@
 
 #if defined (USE_WINDOWS_PACKAGING)
 # include "support/os_win32.h"
+// PATH_MAX is not defined? (msvc)
+#ifndef PATH_MAX
+#define PATH_MAX 512
 #endif
+#endif
 
 #include <boost/filesystem/operations.hpp>
 #include <boost/tuple/tuple.hpp>

Reply via email to