[Patch 2.3.2] Scons: fixes for Windows and Linux


Reed Alpert <reed.alpert@...>
 

Hi,

These are against the next branch.

Fixes for Windows build using docs, testtools, and unittests.
Fixes for using DOS commands instead of GNU/Linux commands.
Remove reference to 'enterprise' in path names.
Add junit_home as a cmd line parm.
Add Visual Studio 11 and 12 as options (leave 10 as default).
Add MSVS_VERSION (along with existing MSVC_VERSION) to tell scons what Visual Studio version to use.

Thanks,

Reed.


diff --git a/mama/c_cpp/SConscript.win b/mama/c_cpp/SConscript.win
index 77e3157..ece0710 100644
--- a/mama/c_cpp/SConscript.win
+++ b/mama/c_cpp/SConscript.win
@@ -121,14 +121,13 @@ if env['with_testtools'] == True and 'dynamic' in env['build']:
 if (    not Media.has_key('mama/c_cpp/docs')
         and env['build'] == 'dynamic'
         and not env.GetOption('clean')
+        and env['product'] == 'mama'
         and env['with_docs'] == True ):
 
     cdoc = env.Doxygen('doxyconfig-c.in')
     cppdoc = env.Doxygen('doxyconfig-cpp.in')
 
-    env.Command( '$prefix/doc/mama/images', cdoc, 'mkdir $TARGET && cp -rf %s\mama\c_cpp\doc\images\* $TARGET' % ( env['TOPLEVEL'] ) )
-    env.Command( '$prefix/doc/mama/c/html', cdoc, 'mkdir $TARGET && cp -rf %s\mama\c_cpp\doc\c\html\* $TARGET' % ( env['TOPLEVEL'] ) )
-    env.Command( '$prefix/doc/mama/cpp/html', cppdoc, 'mkdir $TARGET && cp -rf %s\mama\c_cpp\doc\cpp\html\* $TARGET' % ( env['TOPLEVEL'] ) )
+    env.Command( '$prefix/doc/mama', '', 'mkdir $TARGET && xcopy /q /s /e /y %s\mama\c_cpp\doc\* $TARGET' % ( env['TOPLEVEL'] ) )
 
     env.Clean( cdoc, '%s/mama/c_cpp/doc/c' % (env['TOPLEVEL']) )
     env.Clean( cppdoc, '%s/mama/c_cpp/doc/cpp' % (env['TOPLEVEL']) )
diff --git a/mama/c_cpp/doxyconfig-c.in b/mama/c_cpp/doxyconfig-c.in
index 9e03518..b92b005 100644
--- a/mama/c_cpp/doxyconfig-c.in
+++ b/mama/c_cpp/doxyconfig-c.in
@@ -754,7 +754,7 @@ WARN_LOGFILE           =
 # spaces.
 # Note: If this tag is empty the current directory is searched.
 
-INPUT                  = ./src/c/mama ./src/enterprise/c/mama
+INPUT                  = ./src/c/mama ./src/c/mama
 
 # This tag can be used to specify the character encoding of the source files
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
diff --git a/mama/jni/SConscript b/mama/jni/SConscript
index 6d4173d..61a3570 100644
--- a/mama/jni/SConscript
+++ b/mama/jni/SConscript
@@ -20,6 +20,9 @@ testtools_source = Split("""
 
 testtools = []
 
+unittest_source = Glob('src/junittests')
+unittest = []
+
 jExamples = Glob('src/com/wombat/mama/examples/*java')
 
 version = env['versions']['mama']['releaseString']
@@ -43,14 +46,20 @@ if env['with_testtools'] == True:
     for t in testtools_source:
         testtools.append( env.Java( 'classes', t ) )
 
+if env['with_unittest'] == True:
+    for t in unittest_source:
+        unittest.append( env.Java( 'classes', t ) )
+        env.Append(JAVACLASSPATH = ('$junit_home/junit.jar'))
+
 env.Depends( mama_classes, common_classes )
 env.Depends( testtools, mama_classes )
+env.Depends( unittest, mama_classes )
 
 # Builds all of the header files which is unnecessary but no reason not to
 # do this
 headers = env.JavaH(target=Dir('src/c/mamajni').abspath,source= [ mama_classes, common_classes ])
 
-env.Depends( headers, [ mama_classes, common_classes, testtools ] )
+env.Depends( headers, [ mama_classes, common_classes, testtools, unittest ] )
 
 jar = env.Jar(target='mamajni.jar', source='classes', JARCHDIR = Dir('classes').abspath  )
 
diff --git a/mamda/c_cpp/SConscript.win b/mamda/c_cpp/SConscript.win
index 4c63b51..0a67d48 100644
--- a/mamda/c_cpp/SConscript.win
+++ b/mamda/c_cpp/SConscript.win
@@ -113,7 +113,7 @@ if env['with_unittest'] == True:
 if ( env['with_docs'] == True and not Media.has_key('mamda/c_cpp/docs') and env['build'] == 'dynamic' and not env.GetOption('clean') ):
    cppdoc = env.Doxygen('doxyconfig-cpp.in')
 
-   env.Command( '$prefix/doc/mamda/cpp/html', cppdoc, 'mkdir $TARGET && cp -rf %s\mamda\c_cpp\doc\cpp\html\* $TARGET' % ( env['TOPLEVEL'] ) )
+   env.Command( '$prefix/doc/mamda', cppdoc, 'mkdir $TARGET && xcopy /q /s /e /y  %s\mamda\c_cpp\doc\* $TARGET' % ( env['TOPLEVEL'] ) )
 
    env.Clean( cppdoc, '%s/mamda/c_cpp/doc/cpp' % (env['TOPLEVEL']) )
 
diff --git a/site_scons/community/command_line.py b/site_scons/community/command_line.py
index e1791e2..4bbacc5 100644
--- a/site_scons/community/command_line.py
+++ b/site_scons/community/command_line.py
@@ -26,6 +26,7 @@ def get_command_line_opts( host, products, VERSIONS ):
        BoolVariable('with_examples','Build with test tools',True),
        BoolVariable('entitled','Whether the build is entitled or unentitled',False),
        PathVariable('gtest_home','Path to Google Test home',None, PathVariable.PathIsDir),
+       PathVariable('junit_home','Path to Junit home',None, PathVariable.PathIsDir),
        ListVariable('middleware','Middleware(s) to be compiled in', 'avis', names = ['avis', 'qpid'] ),
        ('jobs', 'Number of scons threads to spawn, if n is passed the number of availabe cores is calculated and used', '1'),
 
@@ -39,7 +40,7 @@ def get_command_line_opts( host, products, VERSIONS ):
             PathVariable('qpid_home', 'Path to QPID Proton Libraries',
                           'c:\\proton', PathVariable.PathAccept),
             EnumVariable('vsver','Visual Studio Version to use', '10.0',
-                allowed_values=('8.0','9.0','10.0')),
+                allowed_values=('8.0','9.0','10.0','11.0','12.0')),
             EnumVariable('product', 'Product to be built', 'mamda',
                      allowed_values=( products )),
             EnumVariable('dotnet_version', 'Dotnet Version used to determine framework directory', '2.0',
@@ -63,6 +64,8 @@ def get_command_line_opts( host, products, VERSIONS ):
             EnumVariable('product', 'Product to be built', 'mamda',
                          #mamda all is a windows only build
                          allowed_values=( [ x for x in products if x != "mamdaall" ] )),
+            EnumVariable('target_arch', 'Specifies if the build should target 32 or 64 bit architectures.',
+                          host['arch'], allowed_values=['x86', 'x86_64']),
             EnumVariable( 'compiler', 'Compiler to use for building OpenMAMA',
                          'default', allowed_values=('default', 'gcc', 'clang', 'clang-analyzer')),
         )
diff --git a/site_scons/community/windows.py b/site_scons/community/windows.py
index 362f697..80c241d 100644
--- a/site_scons/community/windows.py
+++ b/site_scons/community/windows.py
@@ -64,8 +64,10 @@ class Windows:
             env = Environment(ENV={
                 'JAVA_HOME': '%s' % (optsEnv['java_home']),
                 'PATH': '%s:%s\\bin' % (os.environ['PATH'], optsEnv['java_home']),
-                'MSVC_VERSION' : '%s' %(optsEnv['vsver'])},
+                },
                 tools = tools,
+                MSVC_VERSION = optsEnv['vsver'],
+                MSVS_VERSION = optsEnv['vsver'],
                 TARGET_ARCH = optsEnv['target_arch'])
 
             #ConfigureJNI searches os.env for java_home not env['ENV']['JAVA_HOME'] 
@@ -78,7 +80,7 @@ class Windows:
             env['JAVAH'] = 'javah'
 
         else:
-            env = Environment(ENV={'PATH': '%s' % (os.environ['PATH'])}, MSVC_VERSION = optsEnv['vsver'], tools = tools, TARGET_ARCH = optsEnv['target_arch'])
+            env = Environment(ENV={'PATH': '%s' % (os.environ['PATH'])}, MSVC_VERSION = optsEnv['vsver'], MSVS_VERSION = optsEnv['vsver'], tools = tools, TARGET_ARCH = optsEnv['target_arch'])
 
         env['SPAWN'] = logger.log_output
         env['PRINT_CMD_LINE_FUNC'] = logger.log_command
@@ -196,7 +198,7 @@ class Windows:
     # Configures all of the appropriate environment variables for windows.
     def configure(self, env ):
         env.Append( CPPDEFINES = ['WIN32'] )
-        env.Append( CCFLAGS = ['-EHsc','/GR','/FIwombat\\targetsxs.h'] )
+        env.Append( CCFLAGS = ['/EHsc','/GR','/FIwombat\\targetsxs.h'] )
         env.Append( LINKFLAGS =['/MANIFEST'] )
         env.Append( CCPDBFLAGS = '/Fd${TARGET}.pdb' )
         env.Append( PDB = '${TARGET.base}.pdb')

Join Openmama-dev@lists.openmama.org to automatically receive all group messages.