Building the project - Xorgon/DEMOranges GitHub Wiki
Building the project
Step-by-step instructions
This project uses CMake to easily build and compile. Building and compiling has been tested with the following systems:
- Windows, MSVC, AMD
- Windows, gcc, AMD
- Windows, MSVC, NVIDIA
- Windows, gcc, NVIDIA
- Linux, gcc, NVIDIA
I would recommend using JetBrain's CLion IDE if you haven't already chosen an IDE. It is a well designed IDE that makes it even easier to work with CMake. For example, it is easy to choose a compiler (gcc through MinGW or Cygwin, MSVC, etc.). It's also free for students!
For Linux systems CMake should be able to find the OpenCL SDK with find_package(OpenCL REQUIRED)
however on Windows an Environment Variable OCL_ROOT
should be set that points to the diretory containing the lib and include directories.
Again, Windows compilation has only been tested with the AMD OpenCL SDK installed so the NVIDIA OpenCL SDK may need slight modifications to CMakeLists.txt
.
There are targets for each verification test case and simulation as well as a unit test runner. You can see a full list of targets here.
To add a new simulation simply add the following code to CMakeLists.txt
and replace the name and main file (indicated by <>):
file(GLOB_RECURSE <target_name>_SOURCE_FILES <simulation .c file location>)
add_executable(<target_name> ${<target_name>_SOURCE_FILES} ${sim_SOURCE_FILES})
target_link_libraries(<target_name> ${OpenCL_LIBRARY})
if (NOT(WIN32))
target_link_libraries(<target_name> m)
endif()
The preprocessor macro PROJECT_DIR
has been defined to allow for variation in build directory structures (e.g. CLion vs Visual Studio). This is designed to replace any relative directory strings used at runtime. For example, PROJECT_DIR "/util/kernelUtils.cl"
instead of "../util/kernelUtils.cl"
. This is defined in CMakeLists.txt and is just a string containing the project root directory path (note that the compiler concatenates adjacent strings, "a" "b"
= "ab"
).