File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed
Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ . *
12* .o
23* .exe
4+ /BUILD *
Original file line number Diff line number Diff line change 1+ cmake_minimum_required (VERSION 3.13)
2+
3+ project (stream)
4+
5+ include (CheckLanguage)
6+
7+ check_language(C)
8+ if (CMAKE_C_COMPILER)
9+ enable_language (C)
10+ endif ()
11+
12+ check_language(Fortran)
13+ if (CMAKE_Fortran_COMPILER)
14+ enable_language (Fortran)
15+ endif ()
16+
17+ find_package (OpenMP COMPONENTS C Fortran)
18+
19+ if (NOT CMAKE_BUILD_TYPE )
20+ set (CMAKE_BUILD_TYPE Release)
21+ endif ()
22+
23+ set (STREAM_UNIX_RELEASE_FLAGS "-O2" )
24+ set (STREAM_MSVC_RELEASE_FLAGS "/O2" )
25+
26+ if (CMAKE_C_COMPILER)
27+ add_executable (stream_c stream.c)
28+ target_link_libraries (stream_c PRIVATE $<$<BOOL :${OpenMP_C_FOUND} >:OpenMP::OpenMP_C>)
29+ if (CMAKE_C_COMPILER_ID MATCHES "(GNU|Clang|Intel)" )
30+ target_compile_options (stream_c PUBLIC "$<$<CONFIG:RELEASE>:${STREAM_UNIX_RELEASE_FLAGS} >" )
31+ elseif (CMAKE_C_COMPILER_ID MATCHES "MSVC" )
32+ target_compile_options (stream_c PUBLIC "$<$<CONFIG:RELEASE>:${STREAM_MSVC_RELEASE_FLAGS} >" )
33+ endif ()
34+ endif ()
35+
36+ if (CMAKE_Fortran_COMPILER)
37+ add_executable (stream_f stream.f mysecond.c)
38+ target_link_libraries (stream_f PRIVATE $<$<BOOL :${OpenMP_Fortran_FOUND} >:OpenMP::OpenMP_Fortran>)
39+ if (CMAKE_Fortran_COMPILER_ID MATCHES "(GNU|Clang|Intel)" )
40+ target_compile_options (stream_f PUBLIC "$<$<CONFIG:RELEASE>:${STREAM_UNIX_RELEASE_FLAGS} >" )
41+ endif ()
42+ endif ()
You can’t perform that action at this time.
0 commit comments