Kosim‎ > ‎

CMake

CMake is the build system used by Kosim.

Kosim is built by running in kosim/src dir:
$ ./build.sh


The directory structure of kosim includes the following types of dirs:
  • - main         : where the final lib imported by python script is generated
  • - examples : where the examples are located; currently examples form systemc, scv and Doulos TLM2.0 examples are present
  • - lib_dir       : where specific libs will be build (e.g. hierarchy_scanner. generic_cpu, etc)
CMake uses the CMakeLists.txt files to generate the Makefiles needed for building the project. The main CMakeLists.txt is located in kosim/src dir and contains info like:
  1. project name
  2. build type (debug, release)
  3. include and link directory paths to the used libs (e.g. systemc, scv, TLM)
  4. a list of all directories the CMake will recurse into
The examples and lib_dir kind of directories contain each a CMakeLists.txt that specifies:
  1. the path to the headers that need to be included
  2. the name of the the lib generated and  the source files that are part of the lib
The subdirectories of main directory contain each a CMakeLists.txt that specifies:
  1. the path to the headers that need to be included
  2. path to extra libs needed
  3. the name of the the lib generated and  the source files that are part of the lib
  4. the names of the extra libraries used
The script build.sh does the following actions:
  1. exports environment variables related to include and libraries paths
  2. calls python scripts related to program options feature
  3.  calls cmake/make commands to clean and build the system
How to run a test
Once the system was properly build, the simple_fifo example can be run:
$ cd kosim/src/main/sc/simple_fifo
$ python simple_fifo.py

Once the framework is built using build.sh script, as long as only the source files are modified, the library affected can be build using the commands make and/or make clean. The script build.sh must be called only if new files or other changes in the directory structure happened so that new Makefiles are generated to reflect the changes.