diff --git a/content/dependencies.rst b/content/dependencies.rst index 288ea8f..fa5f505 100644 --- a/content/dependencies.rst +++ b/content/dependencies.rst @@ -128,9 +128,9 @@ A complete list of ``Find.cmake`` can be found from the command-lin We can configure and build verbosely. [#verbose]_ Notice that compiler flags, include directories, and link libraries are properly resolved by CMake. - You can find the complete working example in ``content/code/09_taskloop/solution``. + You can find the complete working example in ``content/code/10_taskloop/solution``. -.. exercise:: Exercise 10: Using MPI +.. exercise:: Exercise 11: Using MPI In this exercise, you will attempt compiling a "Hello, world" program that uses the message passing interface (MPI). @@ -144,7 +144,7 @@ A complete list of ``Find.cmake`` can be found from the command-lin .. tab:: C++ - The scaffold project is in ``content/code/10_mpi-cxx``. + The scaffold project is in ``content/code/11_mpi-cxx``. #. Compile the source file to an executable. #. Link against the MPI imported target. @@ -154,7 +154,7 @@ A complete list of ``Find.cmake`` can be found from the command-lin .. tab:: Fortran - The scaffold project is in ``content/code/10_mpi-f``. + The scaffold project is in ``content/code/11_mpi-f``. #. Compile the source file to an executable. #. Link against the MPI imported target. diff --git a/content/index.rst b/content/index.rst index f720bd1..d309442 100644 --- a/content/index.rst +++ b/content/index.rst @@ -42,8 +42,8 @@ In this workshop, you will learn hello-cmake cmake-syntax - hello-ctest targets + .. hello-ctest .. dependencies .. fetch-content .. python-bindings @@ -68,9 +68,9 @@ In this workshop, you will learn 20 min ; :doc:`hello-cmake` 30 min ; :doc:`cmake-syntax` + 50 min ; :doc:`targets` 30 min ; :doc:`probing` 20 min ; :doc:`dependencies` - 40 min ; :doc:`targets` 10 min ; :doc:`tips-and-tricks` 10 min ; :doc:`additional-topics` diff --git a/content/probing.rst b/content/probing.rst index 0d3ac95..63a5eae 100644 --- a/content/probing.rst +++ b/content/probing.rst @@ -60,7 +60,7 @@ command. You **should not** rely on ``execute_process`` to update any artifacts **build-time**. -.. exercise:: Exercise 05: Find a Python module +.. exercise:: Exercise 06: Find a Python module In this exercise, we'll use `execute_process `_ to check whether the `cffi `_ Python module is @@ -71,7 +71,7 @@ command. You **should not** rely on ``execute_process`` to update any artifacts $ python -c "import cffi; print(cffi.__version__)" Your goal is to replicate the same in CMake. - The scaffold code is in ``content/code/05_find_cffi``. + The scaffold code is in ``content/code/06_find_cffi``. You will have to modify the call to ``execute_process`` to run the command above. A working example is in the ``solution`` subfolder. @@ -118,7 +118,7 @@ instances. and ``PRE_LINK``) or after (with ``POST_BUILD``) -.. exercise:: Exercise 06: Before and after build +.. exercise:: Exercise 07: Before and after build We want to perform some action before and after building a target, in this case a Fortran executable: @@ -127,7 +127,7 @@ instances. - After building, we want to check the size of the static allocations in the binary, by invoking the ``size`` command. We use the ``static-size.py`` Python script. - The scaffold code is in ``content/code/06_pre_post-f``. + The scaffold code is in ``content/code/07_pre_post-f``. #. Add CMake commands to build the ``example`` executable from the Fortran sources. Find the text file with the link line under the build folder. @@ -154,13 +154,13 @@ CMake provides modules and commands for these purposes: In all cases, ```` can be one of ``CXX``, ``C`` or ``Fortran``. -.. exercise:: Exercise 07: Check that a compiler accepts a compiler flag +.. exercise:: Exercise 08: Check that a compiler accepts a compiler flag Compilers evolve: they add and/or remove flags and sometimes you will face the need to test whether some flags are available before using them in your build. - The scaffold code is in ``content/code/07_check_compiler_flag``. + The scaffold code is in ``content/code/08_check_compiler_flag``. #. Implement a ``CMakeLists.txt`` to build an executable from the ``asan-example.cpp`` source file. @@ -178,13 +178,13 @@ In all cases, ```` can be one of ``CXX``, ``C`` or ``Fortran``. A working example is in the ``solution`` subfolder. -.. exercise:: Exercise 08: Testing runtime capabilities +.. exercise:: Exercise 09: Testing runtime capabilities Testing that some features will work properly for your code requires not only compiling an object files, but also linking an executable and running it successfully. - The scaffold code is in ``content/code/08_check_source_runs``. + The scaffold code is in ``content/code/09_check_source_runs``. #. Create an executable target from the source file ``use-uuid.cpp``. #. Add a check that linking against the library produces working executables. diff --git a/content/targets.rst b/content/targets.rst index 593d63d..3f98324 100644 --- a/content/targets.rst +++ b/content/targets.rst @@ -97,7 +97,7 @@ Why it is robust to use targets and properties than using variables? Given a tar Visibility levels ``PRIVATE``, ``PUBLIC``, or ``INTERFACE`` are very powerful and herein we will briefly demonstrate their difference. - In this demo, we split the source code into 3 libraries and all files are available in the ``content/code/xx_visibility-levels/`` folder. + In this demo, we split the source code into 3 libraries and all files are available in the ``content/code/04_visibility-levels/`` folder. .. code-block:: bash @@ -232,13 +232,13 @@ Typically, you only need to pass the first argument: the folder within the build -.. exercise:: Exercise 04: Cellular automata +.. exercise:: Exercise 05: Cellular automata Let's work with a project spanning multiple folders. We will implement a relatively simple code to compute and print to screen elementary `cellular automata `_. We separate the sources into ``src`` and ``external`` to simulate a nested project which reuses an external project. Your goal is to: - - 1. Build the main executable at ``content/code/04_automata-cxx/`` for C++ and ``content/code/04_automata-f/`` for Fortran. + - 1. Build the main executable at ``content/code/05_automata-cxx/`` for C++ and ``content/code/05_automata-f/`` for Fortran. - 2. Where are the obtained executables located in the build tree? Remember that CMake generates a build tree mirroring the source tree. - 3. The executable will accept 3 arguments: the length, number of steps, and automaton rule. You can run it with: