Salome HOME
sat #20679 : maj doc pdf
[tools/sat.git] / src / compilation.py
index 4951c554ac6d9be7dea5b86327eecc05a99fe0d8..210eb522096ea9f2bec2747233ba93ed4bd5536b 100644 (file)
@@ -38,12 +38,14 @@ class Builder:
     def __init__(self,
                  config,
                  logger,
+                 product_name,
                  product_info,
                  options = src.options.OptResult(),
                  check_src=True):
         self.config = config
         self.logger = logger
         self.options = options
+        self.product_name = product_name
         self.product_info = product_info
         self.build_dir = src.Path(self.product_info.build_dir)
         self.source_dir = src.Path(self.product_info.source_dir)
@@ -83,6 +85,7 @@ class Builder:
 
         # add products in depend and opt_depend list recursively
         environ_info = src.product.get_product_dependencies(self.config,
+                                                            self.product_name,
                                                             self.product_info)
         #environ_info.append(self.product_info.name)
 
@@ -130,9 +133,8 @@ class Builder:
         # In case CMAKE_GENERATOR is defined in environment, 
         # use it in spite of automatically detect it
         if 'cmake_generator' in self.config.APPLICATION:
-            cmake_option += " -DCMAKE_GENERATOR=%s" \
+            cmake_option += " -DCMAKE_GENERATOR=\"%s\"" \
                                        % self.config.APPLICATION.cmake_generator
-        
         command = ("cmake %s -DCMAKE_INSTALL_PREFIX=%s %s" %
                             (cmake_option, self.install_dir, self.source_dir))
 
@@ -263,9 +265,9 @@ CC=\\"hack_libtool\\"%g" libtool'''
         command = 'msbuild'
         command = command + " /maxcpucount:" + str(nb_proc)
         if self.debug_mode:
-            command = command + " /p:Configuration=Debug"
+            command = command + " /p:Configuration=Debug  /p:Platform=x64 "
         else:
-            command = command + " /p:Configuration=Release"
+            command = command + " /p:Configuration=Release /p:Platform=x64 "
         command = command + " ALL_BUILD.vcxproj"
 
         self.log_command(command)
@@ -285,15 +287,14 @@ CC=\\"hack_libtool\\"%g" libtool'''
     ##
     # Runs 'make install'.
     def install(self):
-        if self.config.VARS.dist_name=="Win":
+        if src.architecture.is_windows():
             command = 'msbuild INSTALL.vcxproj'
             if self.debug_mode:
-                command = command + " /p:Configuration=Debug"
+                command = command + " /p:Configuration=Debug  /p:Platform=x64 "
             else:
-                command = command + " /p:Configuration=Release"
+                command = command + " /p:Configuration=Release  /p:Platform=x64 "
         else :
             command = 'make install'
-
         self.log_command(command)
 
         res = subprocess.call(command,
@@ -338,7 +339,7 @@ CC=\\"hack_libtool\\"%g" libtool'''
     # Runs 'make_check'.
     def check(self, command=""):
         if src.architecture.is_windows():
-            cmd = 'msbuild RUN_TESTS.vcxproj'
+            cmd = 'msbuild RUN_TESTS.vcxproj /p:Configuration=Release  /p:Platform=x64 '
         else :
             if self.product_info.build_source=="autotools" :
                 cmd = 'make check'
@@ -454,6 +455,7 @@ CC=\\"hack_libtool\\"%g" libtool'''
         assert self.build_environ is not None
         # pass additional variables to environment 
         # (may be used by the build script)
+        self.build_environ.set("APPLICATION_NAME", self.config.APPLICATION.name)
         self.build_environ.set("SOURCE_DIR", str(self.source_dir))
         self.build_environ.set("INSTALL_DIR", str(self.install_dir))
         self.build_environ.set("PRODUCT_INSTALL", str(self.install_dir))
@@ -468,6 +470,11 @@ CC=\\"hack_libtool\\"%g" libtool'''
         # in order for the compilation script to take it into account
         if src.product.product_is_hpc(self.product_info):
             self.build_environ.set("SAT_HPC", "1")
+        if self.debug_mode:
+            self.build_environ.set("SAT_DEBUG", "1")
+        if self.verbose_mode:
+            self.build_environ.set("SAT_VERBOSE", "1")
+
 
     def do_batch_script_build(self, script, nb_proc):