aod6060 / dsge

This is a simple 2D engine for my projects.
MIT License
0 stars 0 forks source link

Scons Build system setup #8

Open aod6060 opened 4 hours ago

aod6060 commented 4 hours ago

Basically this issue covers how to construct a build script.

  1. There is the main SConstruct which is at the root directory. It will contain everything that you'll need to setup for compiling for any platform. For now I'm only supporting windows but I will be supporting other platforms such as Linux as well as OSX in the future so this file will allow.
  2. All directories in the src directory will have a SConscript file. This is were the source files will be added that need to be compiled. If there is a platform specific stuff that needs to be compiled it will be placed in a platform_[plat].py file in the same directory and will be called if there are system specific files that need to be included.

Note I'll add additional things in the future but for now this is how it. I'm going to add in examples to how to create a SConscript file for a given folder.

aod6060 commented 4 hours ago

Here is an example of creating a SConscript with out addition directories.

This is example is from SConscript in the glw directory.

Import("env")

def source(file):
   return "#/src/engine/render/glw/" + file

env["source_files"] += [
    source("program.cpp"),
    source("shader.cpp"),
    source("uniform.cpp"),
    source("vertex_array.cpp"),
    source("vertex_buffer.cpp"),
    source("index_buffer.cpp"),
    source("texture2d.cpp")
]

Here is an example of a SConscript with additional directories.

This example is from SConscript in the render directory.

Import("env")

def source(file):
    return "#/src/engine/render/" + file

env["source_files"] += [
    source("render.cpp"),
    source("main_shader.cpp")
]

SConscript("#/src/engine/render/glw/SConscript", exports="env")