-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
103 lines (87 loc) · 2.05 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
cmake_minimum_required( VERSION 3.16 )
project( "simschd"
LANGUAGES CXX )
find_program( CCACHE_FOUND ccache )
if( CCACHE_FOUND )
set( CMAKE_CXX_COMPILER_LAUNCHER ccache )
endif()
# Directories with project components
set(
CMP_DIRS
"schd_common"
"schd_core"
"schd_dump"
"schd_report"
"schd_systemc"
"schd_trace"
"schd_pref"
"schd_time"
)
# Include directories
message( "Boost home: $ENV{BOOST_HOME}" )
message( "SystemC home: $ENV{SYSTEMC_HOME}" )
message( "matio home: $ENV{MATIO_HOME}" )
# Initialize lists of source files and include directories
set( PRIVATE_CXX "" )
set( PRIVATE_INC_DIR "" )
# Parse directories
foreach( SRC_DIR ${CMP_DIRS} )
include(
"${CMAKE_CURRENT_LIST_DIR}/${SRC_DIR}/CMakeLists.txt"
)
endforeach()
add_executable( "${PROJECT_NAME}" )
target_sources( "${PROJECT_NAME}"
PRIVATE
"${PRIVATE_CXX}"
)
target_include_directories( "${PROJECT_NAME}"
PRIVATE
"$ENV{SYSTEMC_HOME}/include"
"$ENV{SYSTEMC_HOME}/include/sysc/utils"
"$ENV{SYSTEMC_HOME}/include/sysc/kernel"
"$ENV{BOOST_HOME}/include"
"$ENV{MATIO_HOME}/include"
"${PRIVATE_INC_DIR}"
)
target_link_directories( "${PROJECT_NAME}"
PRIVATE
"$ENV{LD_LIBRARY_PATH}"
"$ENV{BOOST_HOME}/lib"
"$ENV{SYSTEMC_HOME}/lib-linux64"
"$ENV{MATIO_HOME}/lib"
)
target_link_libraries( "${PROJECT_NAME}"
PRIVATE
"stdc++"
"m"
"pthread"
"systemc"
"boost_system"
"boost_regex"
"matio"
)
set_target_properties( "${PROJECT_NAME}"
PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS YES
)
if( CMAKE_COMPILER_IS_GNUCXX )
# Compiler
target_compile_options( "${PROJECT_NAME}"
PRIVATE
-Wall -Wpedantic -fexceptions -fPIC
)
set( CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -O0"
)
set( CMAKE_CXX_FLAGS_RELEASE
"${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer"
)
# Linker
target_link_options( "${PROJECT_NAME}"
PRIVATE
-w -Wl,--no-undefined
)
endif()