Skip to content

Commit

Permalink
Make sure all $ are in ticks
Browse files Browse the repository at this point in the history
  • Loading branch information
lukemartinlogan committed Dec 13, 2024
1 parent 926296d commit 4398e44
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ this file there are two options.
g++ src/database_lib.cc -I${PWD}/include -fpic -c -o build/database_lib.o
```

-I${PWD}/include will ensure the compiler searches the include directory
``-I${PWD}/include`` will ensure the compiler searches the include directory
for headers

### Fix 2: Environment Variables
Expand Down Expand Up @@ -234,7 +234,7 @@ g++ src/grocery_db.cc -I${PWD}/include -L${PWD}/build -ldatabase_lib -o build/gr
g++ src/movies_db.cc -I${PWD}/include -L${PWD}/build -ldatabase_lib -o build/movies_db
```

-L${PWD}/build tells the compiler to search this directory for shared objects.
``-L${PWD}/build`` tells the compiler to search this directory for shared objects.

### Fix 2: Environment Variables

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY

CMAKE_BINARY_DIR is automatically provided by CMake. This is the absolute
path to the directory which contains the root CMake. In our case, this would
be "cd ${GRC_TUTORIAL}/cpp/03-cpp-build-with-cmake".
be ``cd ${GRC_TUTORIAL}/cpp/03-cpp-build-with-cmake``.

In this example, we output all executables and shared objects to the bin
directory.
Expand Down Expand Up @@ -259,14 +259,14 @@ include_directories(${CMAKE_SOURCE_DIR}/include)
```

*include_directories* will ensure that header files can be discovered
by the C++ compiler. This is analagous to the "-I" flag in the gcc
by the C++ compiler. This is analagous to the ``-I`` flag in the gcc
compiler. Here we ensure that the compiler will search the directory
${CMAKE_SOURCE_DIR}/include for header files.
``${CMAKE_SOURCE_DIR}/include`` for header files.

CMAKE_SOURCE_DIR is provided automatically by CMake. It represents
the absolute path to the directory containing the root CMakeLists.txt.
In our case, this constant would expand to
"cd ${GRC_TUTORIAL}/cpp/03-cpp-build-with-cmake/".
``cd ${GRC_TUTORIAL}/cpp/03-cpp-build-with-cmake/``.

### Creating a Shared Library
```cmake
Expand All @@ -283,12 +283,12 @@ target_link_libraries(database_lib
input the path to all source files related to the build. The SHARED indicates
this library is shared (as opposed to static). Here, there is only one source
file, datbase_lib.cc. The output of this command will be "libdatabase_lib.so" in
the "build/lib" directory.
the ``build/lib`` directory.

CMAKE_CURRENT_SOURCE_DIR is provided automatically by CMake. It represents
the absolute path to the directory containing the CMakeLists.txt currently
being processed. In our case, this constant would expand to
"cd ${GRC_TUTORIAL}/cpp/03-cpp-build-with-cmake/src".
``cd ${GRC_TUTORIAL}/cpp/03-cpp-build-with-cmake/src``.

*target_link_libraries* will link all necessary libraries necessary to compile the target database_lib.
This is analagous to the "-l" flag in gcc. In our case, we link against the
Expand Down Expand Up @@ -339,14 +339,14 @@ install(

*install* defines what happens when a user calls "make install". In this
case we specify that our targets database_lib, grocery_db, and movies_db
should be installed into one of LIBRARY, ARCHIVE, or RUNTIME depending
should be installed into one of ``LIBRARY``, ``ARCHIVE``, or ``RUNTIME`` depending
on its type. For example, database_lib will be installed to LIBRARY
(since we used add_library), whereas grocery_db and movies_db will be installed
to RUNTIME (since we used add_executable).
to ``RUNTIME`` (since we used add_executable).

CMAKE_INSTALL_PREFIX is a constant provided by CMake which represents
``CMAKE_INSTALL_PREFIX`` is a constant provided by CMake which represents
where files should be installed. This can be configured by users by passing
-DCMAKE_INSTALL_PREFIX to their CMake build. By default, the value of this
``-DCMAKE_INSTALL_PREFIX`` to their CMake build. By default, the value of this
constant is /usr.

### Installing Header Files
Expand All @@ -364,8 +364,8 @@ install(
```

In this case, we use *install* to specify
that the specific file ${CMAKE_SOURCE_DIR}/include/database_lib.h should be
installed to ${CMAKE_INSTALL_PREFIX}/include. Here, we use the keyword
that the specific file ``${CMAKE_SOURCE_DIR}/include/database_lib.h`` should be
installed to ``${CMAKE_INSTALL_PREFIX}/include``. Here, we use the keyword
FILES instead of the keyword TARGET. Targets are defined using a CMake
function such as add_executable or add_library. Files are just the way
they are with no modification.
Expand All @@ -386,18 +386,18 @@ set_property(TEST test_movies_db PROPERTY ENVIRONMENT
```

*add_test* creates a CTest case. Here we create two tests: test_grocery_db
and test_movies_db. The test will execute the command ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/grocery_db.
and test_movies_db. The test will execute the command ``${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/grocery_db``.

CMAKE_RUNTIME_OUTPUT_DIRECTORY is a constant provided by CMake. It
is the location where an executable is installed after performing the
"make" command.

*set_property* sets some sort of property about a target. In this
case the target is the test case test_movies_db. We are setting
an environment variable LD_LIBRARY_PATH. From section 3.2, we
an environment variable ``LD_LIBRARY_PATH``. From section 3.2, we
saw that we needed to be very careful about ensuring the OS
knows where shared libraries are located. In this case, we
ensure the OS will check the path ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}.
ensure the OS will check the path ``${CMAKE_LIBRARY_OUTPUT_DIRECTORY}``.

CMAKE_LIBRARY_OUTPUT_DIRECTORY is a constant provided by CMake. It
is the location where a shared library is installed after performing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ Average CO: 280
```

Your Objectives:
1. Create a file called my_analyze_kitchen_fire.cc in the ${GRC_TUTORIAL}/cpp/04-cpp-basic-syntax directory
1. Create a file called my_analyze_kitchen_fire.cc in the ``${GRC_TUTORIAL}/cpp/04-cpp-basic-syntax`` directory
2. Edit the CMakeLists.txt in that directory to compile your code. Feel free to look at how the other sources in that directory were compiled.
3. How do you read "kitchen_fire.bin" and interpret its contents?
4. How do you analyze its contents to determine the start, end, and average
Expand Down
2 changes: 1 addition & 1 deletion docs/02-hpc-tutorials/05-docker/01-docker-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ sudo docker build -t [IMAGE_NAME] [DOCKERFILE_DIR, can be a github link] -f [DOC
2. DOCKERFILE_DIR: the directory containing the Dockerfile.
3. DOCKERFILE_NAME: the name of the dockerfile in that directory. This is optional. Default: Dockerfile.

Let's say that our Dockerfile is located at ${HOME}/MyDockerfiles/Dockerfile.
Let's say that our Dockerfile is located at ``${HOME}/MyDockerfiles/Dockerfile``.
We could build the image two ways:
```
# Option 1: a single command
Expand Down
8 changes: 4 additions & 4 deletions docs/02-hpc-tutorials/05-docker/02-docker-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ is a subdirectory of the current working directory.
```bash
ssh-keygen -t rsa -f ${PWD}/id_rsa -N "" -q
```
**-t rsa** uses RSA for the algorithm.
**-f ${PWD}/id_rsa** defines the output for the private key to be in this directory.
**-N ""** indicates no password should be generated.
**-q** disables interactive prompts.
* ``-t rsa`` uses RSA for the algorithm.
* ``-f ${PWD}/id_rsa`` defines the output for the private key to be in this directory.
* ``-N ""`` indicates no password should be generated.
* ``-q`` disables interactive prompts.

## OpenSSH-Server Dockerfile

Expand Down

0 comments on commit 4398e44

Please sign in to comment.