ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
How to create a sub project for ETISS

This tutorial is intended for the creation of a plugin for ETISS (etiss::CPUArch,etiss::JIT,etiss::Plugin).

Refer to this page for information about how to use ETISS in a simulation.

ETISS plugins can be put into 4 folders. etiss::CPUArch,etiss::JIT and etiss::Plugin implementtions should be put into ArchImpl,JITImple and PluginImpl respectively and general projects that don't fit into that category can be put into the projects folder.

CMake is used to build ETISS and sub projects. By default the CMakeLists.txt files will scan the ArchImpl,JITImple,PluginImpl and projects folders for subfolders and will add those folders to the current build if they contain a CMakeLists.txt file. If you are familiar with CMake then the next section can be skipped.

ETISS's CMakeLists.txt.template

To speed up sub project creation a CMakeLists.txt helper file is provided. With that file and these step by step instructions it is possible to compile C++ code without knowing cmake. Furthermore the template file allows to use a Makefile instead of cmake. For instructions to use a Makefile see Using a Makefile.

Step 1:

Create a project folder in the ArchImpl,JITImple,PluginImpl or projects folder (e.g. ArchImpl/OR1K).

Step 2:

In the project folde create a CMakeLists.txt file (e.g. ArchImpl/OR1K/CMakeLists.txt). Copy the following text into the created file and replace the YOURPROJECT% token with the name of your project (e.g. OR1KArch)

set(ETISS_PROJECT_NAME %YOURPROJECT% )
set(ETISS_PROJECT_PATH ${CMAKE_CURRENT_LIST_DIR})
include(../../CMakeLists.txt.project.template)

Step 3:

If all source files (*.ccp) are located in your project directory (e.g. ArchImpl/OR1K/*.cpp) and project header files are located in your project directory or a subfolder called include within your project directory then no further actions are required an the project was successfully created. In that case you can skip to Step 4. Otherwise it is neccessary to add source/header files to the project manually.

Source files can be added to the "${ETISS_PROJECT_NAME}_ADDITIONAL_PROJECT_FILES" variable. The command file(GLOB_RECURSE ${ETISS_PROJECT_NAME}_ADDITIONAL_PROJECT_FILES src/*.cpp) can be used for example to add any *.cpp file in the src sub folder.

To include header paths simply add the line include_directories("/path/to/header/directory").

Example:

set(ETISS_PROJECT_NAME %YOURPROJECT% )
set(ETISS_PROJECT_PATH ${CMAKE_CURRENT_LIST_DIR})
file(GLOB_RECURSE ${ETISS_PROJECT_NAME}_ADDITIONAL_PROJECT_FILES src/*.cpp) # add all *.cpp in the src folder and its sub folders
set(${ETISS_PROJECT_NAME}_ADDITIONAL_PROJECT_FILES ${${ETISS_PROJECT_NAME}_ADDITIONAL_PROJECT_FILES} /some/additional/source/file.cpp) # adds the "/some/additional/source/file.cpp" file to the list of source files
include_directories("/path/to/header/directory") # add a custom header search path
include(../../CMakeLists.txt.project.template)

Step 4:

If there is already a build directoy where the command "$cmake /path/to/ETISS" has been executed in, then it is neccessary to clean that directory and run the command again.

Otherwise simply create a build directory (e.g. path/to/ETISS/install).
In a console window run:

$cd path/to/ETISS/install
$cmake path/to/ETISS
Attention
due to some legacy Makefiles that are used it is strongly recommended to not use a directoy called build within the ETISS project folder (e.g. path/to/ETISS/build).

Using a Makefile

To use a Makefile with your project follow Step 1 and Step 2. Then add the line set(${ETISS_PROJECT_NAME}_MAKEFILE Makefile) to the CMakeLists.txt file. In case the makefile is not called Makefile that part need to be changed.

set(ETISS_PROJECT_NAME %YOURPROJECT%)
set(ETISS_PROJECT_PATH ${CMAKE_CURRENT_LIST_DIR})
set(${ETISS_PROJECT_NAME}_MAKEFILE Makefile) #usually this is right but if your makefile has a special name then this needs to be changed
include(../../CMakeLists.txt.project.template)

In this case it is expected that the sub project creates a shared library in its project folder named after of the project name and the platform dependent default library prefix and sufix strings (e.g project name is "test" then on linux a libtest.so file is expected).

The makefile will be executed with these 3 variables set:

Variable Description
INCLUDE_ARGS arguments that should be passed to compiler invections for files that include etiss headers.
INCLUDE_DIRS list of directories that contain header files needed for/by ETISS
BUILD_DIR a build directory where the makefile should put compilation results into

Project files should be added to the ${ETISS_PROJECT_NAME}_MAKEFILE_PROJECTFILES variable to show them in genereated IDE projects (e.g. set(${ETISS_PROJECT_NAME}_MAKEFILE_PROJECTFILES main.cpp). Files added to this variable will NOT be compiled/processed in any way by cmake.