-
Notifications
You must be signed in to change notification settings - Fork 894
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
158 lines (138 loc) · 3.93 KB
/
CMakeLists.txt
File metadata and controls
158 lines (138 loc) · 3.93 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2021-2025, The OpenROAD Authors
include("openroad")
# For Multithread
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_FFT2D_PTHREADS=1 -DFFT_2D_MAX_THREADS=16 -O3 ${OpenMP_CXX_FLAGS}")
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Eigen3 REQUIRED)
find_package(ortools REQUIRED)
find_package(LEMON NAMES LEMON lemon REQUIRED)
find_package(OpenMP REQUIRED)
message(STATUS "Found OR-Tools: ${ortools_DIR} (version: ${ortools_VERSION})")
swig_lib(NAME gpl
NAMESPACE gpl
I_FILE src/replace.i
SWIG_INCLUDES ${ODB_HOME}/src/swig/common
${ODB_HOME}/src/swig/tcl
${ODB_HOME}/include
SCRIPTS src/replace.tcl
)
add_library(gpl_lib
src/AbstractGraphics.cpp
src/replace.cpp
src/initialPlace.cpp
src/nesterovPlace.cpp
src/placerBase.cpp
src/nesterovBase.cpp
src/fft.cpp
src/fftsg.cpp
src/fftsg2d.cpp
src/routeBase.cpp
src/timingBase.cpp
src/graphicsNone.cpp
src/solver.cpp
src/mbff.cpp
)
# --- HPWL backend selection (link-time dispatch) ---
# Exactly one translation unit defines NesterovBaseCommon::getHpwl(): either
# the OpenMP loop in src/hpwl.cpp (default) or the Kokkos kernel in
# src/gpu/hpwl.cpp when ENABLE_GPU=ON. CMake enforces ODR; the
# consumer-facing headers and sources stay free of preprocessor branches.
# gpu/ is a file-layout subdirectory only (no nested CMakeLists.txt) so
# kernel build settings stay in this module's CMakeLists with the rest
# of gpl_lib.
if(ENABLE_GPU)
target_sources(gpl_lib PRIVATE src/gpu/hpwl.cpp)
# nesterovBase.h and other private gpl headers live in src/; sources
# under src/gpu/ need that on the include path explicitly because
# the compiler's default same-dir lookup points into src/gpu/ instead.
target_include_directories(gpl_lib PRIVATE src)
if(Kokkos_ENABLE_CUDA)
set_source_files_properties(src/gpu/hpwl.cpp PROPERTIES LANGUAGE CUDA)
elseif(Kokkos_ENABLE_HIP)
set_source_files_properties(src/gpu/hpwl.cpp PROPERTIES LANGUAGE HIP)
endif()
# Disable FP contraction for kernels that share gpl_lib's compile
# context so they stay bit-stable across compilers. Scoped to gpl_lib
# but the CXX flag is also harmless on the existing CPU TUs.
target_compile_options(gpl_lib PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:-ffp-contract=off>
$<$<COMPILE_LANGUAGE:CUDA>:--fmad=false>
$<$<COMPILE_LANGUAGE:HIP>:-ffp-contract=off>
)
target_link_libraries(gpl_lib Kokkos::kokkos)
if(Kokkos_ENABLE_CUDA)
# cuda runtime symbols are referenced from the CUDA TU; expose cudart
# so that gpl_lib (and the openroad binary) link against libcudart.
target_link_libraries(gpl_lib CUDA::cudart)
endif()
else()
target_sources(gpl_lib PRIVATE src/hpwl.cpp)
endif()
target_sources(gpl
PRIVATE
src/MakeReplace.cpp
src/graphicsImpl.cpp
)
messages(TARGET gpl)
messages(TARGET gpl_lib)
target_include_directories(gpl
PUBLIC
include
)
target_include_directories(gpl_lib
PUBLIC
include
${LEMON_INCLUDE_DIRS}
)
target_link_libraries(gpl_lib
utl_lib
Eigen3::Eigen
odb
OpenSTA
rsz_lib
grt_lib
ortools::ortools
Threads::Threads
OpenMP::OpenMP_CXX
)
target_link_libraries(gpl
PRIVATE
gpl_lib
utl_lib
Eigen3::Eigen
gui
odb
OpenSTA
rsz
grt
ortools::ortools
Threads::Threads
OpenMP::OpenMP_CXX
)
if (Python3_FOUND AND BUILD_PYTHON)
swig_lib(NAME gpl_py
NAMESPACE gpl
LANGUAGE python
I_FILE src/replace-py.i
SWIG_INCLUDES ${PROJECT_SOURCE_DIR}/include/gpl
SCRIPTS ${CMAKE_CURRENT_BINARY_DIR}/gpl_py.py
)
target_include_directories(gpl_py
PUBLIC
include
)
target_link_libraries(gpl_py
PUBLIC
utl_lib
Eigen3::Eigen
gui
odb
OpenSTA
rsz
grt
)
endif()
if(ENABLE_TESTS)
add_subdirectory(test)
endif()