-
Notifications
You must be signed in to change notification settings - Fork 16
Getting Started
To start a new project using the DACE, you first create a CMakeList.txt file for it. The DACE installer made sure to tell your CMake installation about where to find the DACE, so all you need in your CMakeList.txt file to get started is
cmake_minimum_required (VERSION 2.8.4)
project(MyProjectName CXX)
find_package(dace 2.0.0 REQUIRED)
add_executable(MyDAProject driver.cpp logic.cpp magic.cpp)
target_link_libraries(MyDAProject PUBLIC dace::dace_s)
This basic file tells CMake your project name (MyProjectName, you can of course change this) and adds an executable to it (MyDAProject, again you can change this name but don't include any file extensions such as .exe). This executable will be built from the listed source files. You only need to list the .cpp files, not any .h headers or other files. It then tells CMake to link your program with the static DACE library, meaning any DA code you use inside the DACE will be copied into your program while it is built and therefore can be run on any system without requiring a separate installation of the DACE.
In you code, say in driver.cpp
you start by including the DACE static library headers using the line
#include <dace/dace_s.h>
See DACE Headers for more information on the DACE header files to use in your project.
To see some examples of how this works, check out the tutorials in the Tutorials folder: they contain fully self-contained CMake projects that can be built against the DACE library.
To build your new CMake project, all you need to do is run CMake to generate the project files and then build it. On a Unix-like system (Linux, Mac OS X), you would issue the following commands from the command line, while on Windows you have to use the CMake GUI (see Windows Notes).
cd path/to/your/project
mkdir build
cd build
cmake ..
make
After everything is complete, you should have the executable(s) you defined in the CMakeList.txt file ready for testing in your build directory.
If you get compile errors in your code, you have to fix them and then simply re-issue the make
command in the build folder to restart the build process.
Now that you have mastered the technicalities of compiling and linking with the DACE on your system, it is time to learn about what DA can do for you. Head over to the tutorials in the Tutorials folder and have a look at the PDF file in each of the Tutorials. These give you a quick overview of various DA functionality and how to use it in the DACE.