Skip to content

Commit 1ef3482

Browse files
committed
finish "step6":exercise 1
1 parent fcd34d4 commit 1ef3482

3 files changed

Lines changed: 11 additions & 0 deletions

File tree

‎Step6/CMakePresets.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
"description": "Preset to use with the tutorial",
88
"binaryDir": "${sourceDir}/build",
99
"cacheVariables": {
10+
"CMAKE_CXX_COMPILER":"g++-13",
11+
"CMAKE_EXPORT_COMPILE_COMMANDS":"ON",
12+
1013
"TUTORIAL_USE_STD_SQRT": "OFF"
1114
}
1215
}

‎Step6/MathFunctions/CMakeLists.txt‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,15 @@ endif()
2828

2929
# TODO1: Include the CheckIncludeFiles module and use it to check for
3030
# the emmintrin.h header.
31+
include(CheckIncludeFiles)
32+
CHECK_INCLUDE_FILES(emmintrin.h HAS_EMMINTRIN LANGUAGE CXX)
3133

3234
# TODO2: If emmintrin.h is available, add a compile definition to MathFunctions
3335
# named TUTORIAL_USE_SSE2. This will only be needed by the MathFunctions
3436
# implementation file.
37+
if(HAS_EMMINTRIN)
38+
target_compile_definitions(MathFunctions PRIVATE TUTORIAL_USE_SSE2)
39+
endif()
3540

3641
# TODO4: Include the CheckSourceCompiles module and use it to check if the
3742
# following program compiles:

‎Step6/MathFunctions/MathFunctions.cxx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
// TODO3: If the TUTORIAL_USE_SSE2 definition is set, include
77
// the <emmintrin.h> header
8+
#ifdef TUTORIAL_USE_SSE2
9+
#include "emmintrin.h"
10+
#endif
811

912
namespace {
1013

0 commit comments

Comments
 (0)