Difference between revisions of "Alternative file layout"

From MSX Game Library

 
Line 34: Line 34:
  
 
For example, if you use the files from the template project on Windows, you have to make those changes in the <tt>build.bat</tt> file:
 
For example, if you use the files from the template project on Windows, you have to make those changes in the <tt>build.bat</tt> file:
 
+
<syntaxhighlight lang="txt">
..\..\tools\build\Node\node.exe ..\..\engine\script\js\build.js target=%1
+
..\..\tools\build\Node\node.exe ..\..\engine\script\js\build.js target=%1
 
+
</syntaxhighlight>
 
to:
 
to:
 
+
<syntaxhighlight lang="txt">
MSXgl\tools\build\Node\node.exe MSXgl\engine\script\js\build.js target=%1
+
MSXgl\tools\build\Node\node.exe MSXgl\engine\script\js\build.js target=%1
 +
</syntaxhighlight>

Latest revision as of 09:42, 28 November 2024

By default, projects using MSXGL are placed inside the library tree in the projects directory. This allows all projects to share the same library source and data, and common build options (in /projects/default_config.js).

Default layout:

📁 MSXgl
├─📁 engine
├─📁 projects
│ └─📁 MyProject
│   ├─🗎 build.bat|sh
│   ├─🗎 main.c
│   ├─🗎 msxgl_config.h
│   └─🗎 project_config.js
└─📁 tools

Having said that, some users might prefer the opposite: to have one directory per project and the MSXgl directory inside (which is more classic and doesn't generate duplication if you only have one MSXgl project).

Alternative layout:

📁 MyProject
├─🗎 build.bat|sh
├─🗎 main.c
├─🗎 msxgl_config.h
├─🗎 project_config.js
└─📁 MSXgl
  ├─📁 engine
  ├─📁 projects
  └─📁 tools

Here are the steps to follow:

  • Create your MyProject directory wherever you want.
  • Install MSXgl in it (in MyProject/MSXgl for example).
  • Create your source files in the MyProject directory. For example, copy all the files from the MSXgl/projects/template directory to the root of your project.
  • Modify the build.bat (Windows) or build.sh (Linux/macOS) to indicate the path to Node.js (in MSXgl/tools/build/Node) and to the build script (MSXgl/engine/script/js).
  • You are done! You can now build your project from the root of your directory.

For example, if you use the files from the template project on Windows, you have to make those changes in the build.bat file:

..\..\tools\build\Node\node.exe ..\..\engine\script\js\build.js target=%1

to:

MSXgl\tools\build\Node\node.exe MSXgl\engine\script\js\build.js target=%1