|
| 1 | +# |
| 2 | +# Copyright(c) 2025 Intel Corporation |
| 3 | +# |
| 4 | +# Permission is hereby granted, free of charge, to any person obtaining a copy |
| 5 | +# of this software and associated documentation files (the "Software"), to deal |
| 6 | +# in the Software without restriction, including without limitation the rights |
| 7 | +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 8 | +# copies of the Software, and to permit persons to whom the Software is |
| 9 | +# furnished to do so, subject to the following conditions: |
| 10 | +# |
| 11 | +# The above copyright notice and this permission notice shall be included in |
| 12 | +# all copies or substantial portions of the Software. |
| 13 | +# |
| 14 | +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 15 | +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 17 | +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 18 | +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 19 | +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 20 | +# SOFTWARE. |
| 21 | +# |
| 22 | + |
| 23 | +# Minimal cmake version |
| 24 | +cmake_minimum_required(VERSION 3.5) |
| 25 | + |
| 26 | +macro(define_plaform_settings) |
| 27 | + add_compile_options(/Zi) |
| 28 | + add_compile_options($<$<CONFIG:DEBUG>:/Od> $<$<NOT:$<CONFIG:DEBUG>>:/Ox>) |
| 29 | + add_compile_options(/Ob2) |
| 30 | + add_compile_options($<$<NOT:$<CONFIG:DEBUG>>:/Oi>) |
| 31 | + add_compile_options(/Ot) |
| 32 | + add_compile_options($<$<NOT:$<CONFIG:DEBUG>>:/GT>) |
| 33 | + add_compile_options(/GF) |
| 34 | + |
| 35 | + if( PLATFORM_WINDOWS AND RUNTIME_TYPE STREQUAL "mt") |
| 36 | + add_compile_options($<$<CONFIG:DEBUG>:/MTd> $<$<NOT:$<CONFIG:DEBUG>>:/MT>) |
| 37 | + elseif( PLATFORM_WINDOWS AND RUNTIME_TYPE STREQUAL "md") |
| 38 | + add_compile_options($<$<CONFIG:DEBUG>:/MDd> $<$<NOT:$<CONFIG:DEBUG>>:/MD>) |
| 39 | + endif() |
| 40 | + |
| 41 | + add_compile_options(/Gy) |
| 42 | + add_compile_options(/fp:fast) |
| 43 | + replace_compile_flags("/GR" "/GR-") |
| 44 | + |
| 45 | + add_compile_options(/W4) |
| 46 | + add_compile_options(/WX) |
| 47 | + |
| 48 | + add_exe_linker_flags(/DEBUG) |
| 49 | + add_exe_linker_flags(/MAP) |
| 50 | + replace_linker_flags("/INCREMENTAL" "/INCREMENTAL:NO" debug) |
| 51 | + add_compile_options(/MP) |
| 52 | + add_compile_options(-D_HAS_EXCEPTIONS=0) |
| 53 | + replace_linker_flags("/debug" "/DEBUG" debug) |
| 54 | + replace_linker_flags("/machine:x64" "/MACHINE:X64") |
| 55 | + add_compile_options(-D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE) |
| 56 | + add_compile_options(-DSECURITY_WIN32) |
| 57 | + |
| 58 | + set(CMAKE_CXX_STANDARD 20) |
| 59 | + set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 60 | + set(CMAKE_CXX_EXTENSIONS OFF) |
| 61 | +endmacro() |
0 commit comments