-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
66 lines (55 loc) · 2.09 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
cmake_minimum_required( VERSION 3.22.0 )
project( vpr-extract )
set( CMAKE_CXX_STANDARD 20 )
set( CMAKE_CXX_STANDARD_REQUIRED 20 )
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin )
set( CXX_HEADER_DIR ${CMAKE_SOURCE_DIR}/include )
set( CXX_SOURCE_DIR ${CMAKE_SOURCE_DIR}/src )
if(MSVC)
else()
find_package(TBB REQUIRED)
endif()
include_directories( ${PROJECT_NAME} ${CXX_HEADER_DIR} )
set( CXX_HEADERS
${CXX_HEADER_DIR}/definitions.hpp
)
set( CXX_SOURCES
${CXX_SOURCE_DIR}/main.cpp
)
set( SOURCES ${CXX_HEADERS} ${CXX_SOURCES})
add_executable( ${PROJECT_NAME} ${SOURCES} )
if(MSVC)
else()
target_link_libraries(${PROJECT_NAME} PRIVATE TBB::tbb)
endif()
install(
TARGETS ${PROJECT_NAME}
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
)
if(MSVC)
target_compile_options(
${PROJECT_NAME} PRIVATE /W4 /WX
$<$<CONFIG:Debug>:/MTd>
$<$<CONFIG:Debug>:/EHa>
$<$<CONFIG:Release>:/arch:AVX512>
$<$<CONFIG:Release>:/EHs>
$<$<CONFIG:Release>:/MT>
$<$<CONFIG:Release>:/O2>
$<$<CONFIG:Release>:/DNDEBUG>
)
target_link_options( ${PROJECT_NAME} PRIVATE $<$<CONFIG:Release>:/MANIFEST:NO> )
else()
target_compile_options(
${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror -Wshadow -Wpedantic -Wconversion
$<$<CONFIG:Debug>:-O2>
$<$<CONFIG:Release>:-Ofast>
$<$<CONFIG:Release>:-m64>
$<$<CONFIG:Release>:-march=native>
$<$<CONFIG:Release>:-ffast-math>
$<$<CONFIG:Release>:-ffunction-sections>
$<$<CONFIG:Release>:-fPIE>
$<$<CONFIG:Release>:-fno-ident>
$<$<CONFIG:Release>:-fvisibility=hidden>
)
target_link_options( ${PROJECT_NAME} PRIVATE $<$<CONFIG:Release>:-s> )
endif()