| 1 |
add_library(MathFunctions) |
| 2 |
add_library(Tutorial::MathFunctions ALIAS MathFunctions) |
| 3 |
|
| 4 |
target_sources(MathFunctions |
| 5 |
PRIVATE |
| 6 |
MathFunctions.cxx |
| 7 |
|
| 8 |
PUBLIC |
| 9 |
FILE_SET HEADERS |
| 10 |
FILES |
| 11 |
MathFunctions.h |
| 12 |
) |
| 13 |
|
| 14 |
target_link_libraries(MathFunctions |
| 15 |
PRIVATE |
| 16 |
MathLogger |
| 17 |
SqrtTable |
| 18 |
|
| 19 |
PUBLIC |
| 20 |
OpAdd |
| 21 |
OpMul |
| 22 |
OpSub |
| 23 |
) |
| 24 |
|
| 25 |
target_compile_features(MathFunctions PRIVATE cxx_std_20) |
| 26 |
|
| 27 |
if(TUTORIAL_USE_STD_SQRT) |
| 28 |
target_compile_definitions(MathFunctions PRIVATE TUTORIAL_USE_STD_SQRT) |
| 29 |
endif() |
| 30 |
|
| 31 |
include(CheckIncludeFiles) |
| 32 |
check_include_files(emmintrin.h HAS_EMMINTRIN LANGUAGE CXX) |
| 33 |
|
| 34 |
if(HAS_EMMINTRIN) |
| 35 |
target_compile_definitions(MathFunctions PRIVATE TUTORIAL_USE_SSE2) |
| 36 |
endif() |
| 37 |
|
| 38 |
include(CheckSourceCompiles) |
| 39 |
check_source_compiles(CXX |
| 40 |
[=[ |
| 41 |
typedef double v2df __attribute__((vector_size(16))); |
| 42 |
int main() { |
| 43 |
__builtin_ia32_sqrtsd(v2df{}); |
| 44 |
} |
| 45 |
]=] |
| 46 |
HAS_GNU_BUILTIN |
| 47 |
) |
| 48 |
|
| 49 |
if(HAS_GNU_BUILTIN) |
| 50 |
target_compile_definitions(MathFunctions PRIVATE TUTORIAL_USE_GNU_BUILTIN) |
| 51 |
endif() |
| 52 |
|
| 53 |
add_subdirectory(MathLogger) |
| 54 |
add_subdirectory(MathExtensions) |
| 55 |
add_subdirectory(MakeTable) |