From 21c7ae919ab4a6c405fcc2bdca725812274fff24 Mon Sep 17 00:00:00 2001
From: Erik Kooistra <kooistra@astron.nl>
Date: Fri, 17 Apr 2015 11:12:50 +0000
Subject: [PATCH] Fixed item 100 l) to store the modelsim_project_files.txt in
 the modelsim build dir instead of in SVN tools/modelsim.

---
 tools/hdltool_readme.txt               |  4 ++--
 tools/modelsim/commands.do             |  6 +++++-
 tools/oneclick/base/modelsim_config.py | 11 ++++-------
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/tools/hdltool_readme.txt b/tools/hdltool_readme.txt
index 1f0e711a5d..db367d6cae 100644
--- a/tools/hdltool_readme.txt
+++ b/tools/hdltool_readme.txt
@@ -748,8 +748,8 @@ k) Support multiple --technology
    where to build and which technologies are supported. The toolset name (eg. 'unb1', 'unb2', ...) then is used
    as command line option. This scheme also allows having mutliple build trees.
    
-l) Location of modelsim_project_files.txt
-   Default the modelsim_project_files.txt is now created in the SVN directory set by 'toolRootDir'/modelsim. Instead
+l) (FIXED - erko) Location of modelsim_project_files.txt
+   Default the modelsim_project_files.txt used to be created in the SVN directory set by 'toolRootDir'/modelsim. Instead
    the modelsim_project_files.txt should better be created in the build directory 'build_dir_sim'/modelsim/.
    
 m) (FIXED - erko) Issue exit error when a library name occurs double
diff --git a/tools/modelsim/commands.do b/tools/modelsim/commands.do
index 7b43eb44d7..a4bcea8e1f 100644
--- a/tools/modelsim/commands.do
+++ b/tools/modelsim/commands.do
@@ -54,6 +54,10 @@ proc hdl_env {} {
     return $env(RADIOHDL)
 }
 
+proc hdl_build {} {
+    global env
+    return $env(HDL_BUILD_DIR)
+}
 
 #-------------------------------------------------------------------------------
 # LP = Load project
@@ -320,7 +324,7 @@ proc mk_test {arg_lib} {
 #-------------------------------------------------------------------------------
 
 proc read_modelsim_project_files_file {} {
-    set fp [open [hdl_env]/tools/modelsim/modelsim_project_files.txt]
+    set fp [open [hdl_build]/modelsim/modelsim_project_files.txt]
     set data [read $fp]
     close $fp
     set lines [split $data \n]
diff --git a/tools/oneclick/base/modelsim_config.py b/tools/oneclick/base/modelsim_config.py
index 9d2a905bf5..bb93dfb1b6 100755
--- a/tools/oneclick/base/modelsim_config.py
+++ b/tools/oneclick/base/modelsim_config.py
@@ -277,18 +277,15 @@ class ModelsimConfig(hdl_config.HdlConfig):
                 fp.write('DefaultRadix = decimal\n')
                 #fp.write('DefaultRadixFlags = enumnumeric\n')
                 
-    def create_modelsim_project_files_file(self, filePath=None, lib_names=None):
+    def create_modelsim_project_files_file(self, lib_names=None):
         """Create file with list of the Modelsim project files for all HDL libraries.
         
            Arguments:
-           - filePath   : path to modelsim_project_files.txt, when None then the file is written in the default toolRootDir
            - lib_names  : one or more HDL libraries
         """
-        fileName = 'modelsim_project_files.txt'                                # use fixed file name
-        if filePath==None:
-            fileNamePath=os.path.join(self.toolRootDir, 'modelsim', fileName)  # default file path
-        else:
-            fileNamePath=os.path.join(filePath, fileName)                      # specified file path
+        fileName = 'modelsim_project_files.txt'                            # use fixed file name
+        build_maindir, build_tooldir = self.get_tool_build_dir('sim')
+        fileNamePath=os.path.join(build_maindir, build_tooldir, fileName)  # and use too build dir for file path
         if lib_names==None: lib_names=self.lib_names
         with open(fileNamePath, 'w') as fp:
             lib_dicts = self.libs.get_dicts('hdl_lib_name', lib_names)
-- 
GitLab