| 1 |
if (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR) |
| 2 |
message(FATAL_ERROR "In-tree builds are not supported. Instead, run:\ncmake . -B build <options> && cmake --build build") |
| 3 |
endif() |
| 4 |
|
| 5 |
cmake_minimum_required(VERSION 3.25) |
| 6 |
project(nextpnr CXX) |
| 7 |
|
| 8 |
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) |
| 9 |
|
| 10 |
include(CheckCXXCompilerFlag) |
| 11 |
include(CheckCXXCompilerHashEmbed) |
| 12 |
|
| 13 |
if (NOT DEFINED CMAKE_SUPPRESS_DEVELOPER_WARNINGS) |
| 14 |
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE INTERNAL "No dev warnings") |
| 15 |
endif() |
| 16 |
|
| 17 |
# We want to explictly include all include directories when generating the |
| 18 |
# compilation database as not all clang/gcc share the same implicit includes |
| 19 |
# leading to essentially non-working compile_commands.json |
| 20 |
if (CMAKE_EXPORT_COMPILE_COMMANDS) |
| 21 |
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES |
| 22 |
${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}) |
| 23 |
endif() |
| 24 |
|
| 25 |
option(BUILD_GUI "Build GUI" OFF) |
| 26 |
option(BUILD_PYTHON "Build Python integration" ON) |
| 27 |
option(BUILD_RUST "Build Rust integration" OFF) |
| 28 |
option(BUILD_TESTS "Build tests" OFF) |
| 29 |
option(USE_OPENMP "Use OpenMP to accelerate analytic placer" OFF) |
| 30 |
option(STATIC_BUILD "Create static build" OFF) |
| 31 |
option(EXTERNAL_CHIPDB "Create build with pre-built chipdb binaries" OFF) |
| 32 |
option(WERROR "pass -Werror to compiler (used for CI)" OFF) |
| 33 |
option(PROFILER "Link against libprofiler" OFF) |
| 34 |
option(USE_IPO "Compile nextpnr with IPO" ON) |
| 35 |
|
| 36 |
set(PROGRAM_PREFIX "" CACHE STRING "Name prefix for executables") |
| 37 |
|
| 38 |
if (BUILD_GUI AND NOT BUILD_PYTHON) |
| 39 |
message(FATAL_ERROR "GUI requires Python to build") |
| 40 |
endif() |
| 41 |
|
| 42 |
if (NOT CMAKE_BUILD_TYPE) |
| 43 |
set(CMAKE_BUILD_TYPE Release) |
| 44 |
endif() |
| 45 |
|
| 46 |
if (USE_IPO) |
| 47 |
include(CheckIPOSupported) |
| 48 |
check_ipo_supported(RESULT ipo_supported) |
| 49 |
if (ipo_supported) |
| 50 |
message(STATUS "Building with IPO") |
| 51 |
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) |
| 52 |
else() |
| 53 |
message(STATUS "IPO is not supported with this compiler") |
| 54 |
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION FALSE) |
| 55 |
endif() |
| 56 |
else() |
| 57 |
message(STATUS "Building without IPO") |
| 58 |
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION FALSE) |
| 59 |
endif() |
| 60 |
|
| 61 |
check_cxx_compiler_hash_embed(HAS_HASH_EMBED CXX_FLAGS_HASH_EMBED) |
| 62 |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_FLAGS_HASH_EMBED}") |
| 63 |
if (EXTERNAL_CHIPDB) |
| 64 |
set(BBASM_MODE "binary") |
| 65 |
elseif (HAS_HASH_EMBED) |
| 66 |
set(BBASM_MODE "embed") |
| 67 |
elseif (WIN32 AND NOT HAS_HASH_EMBED) |
| 68 |
set(BBASM_MODE "resource") |
| 69 |
add_definitions(-DBBAS_ARE_RESOURCES) |
| 70 |
else() |
| 71 |
set(BBASM_MODE "string") |
| 72 |
endif() |
| 73 |
|
| 74 |
if (CMAKE_SYSTEM_NAME STREQUAL "Linux") |
| 75 |
include(CheckCXXSourceCompiles) |
| 76 |
|
| 77 |
check_cxx_source_compiles(" |
| 78 |
#include <gnu/libc-version.h> |
| 79 |
int main() { return 0; } |
| 80 |
" HAVE_GLIBC) |
| 81 |
|
| 82 |
if (HAVE_GLIBC) |
| 83 |
set(USE_LIBUNWIND OFF) |
| 84 |
else() |
| 85 |
set(USE_LIBUNWIND ON) |
| 86 |
find_library(LIBUNWIND_LIBRARY NAMES unwind) |
| 87 |
find_path(LIBUNWIND_INCLUDE_DIR NAMES libunwind.h) |
| 88 |
|
| 89 |
if(LIBUNWIND_LIBRARY) |
| 90 |
find_library(LIBUNWIND_LIBRARY_ARCH NAMES "unwind-${CMAKE_SYSTEM_PROCESSOR}") |
| 91 |
if(LIBUNWIND_LIBRARY_ARCH) |
| 92 |
set(LIBUNWIND_LIBRARY "${LIBUNWIND_LIBRARY};${LIBUNWIND_LIBRARY_ARCH}") |
| 93 |
endif() |
| 94 |
endif() |
| 95 |
|
| 96 |
if(NOT LIBUNWIND_LIBRARY OR NOT LIBUNWIND_INCLUDE_DIR) |
| 97 |
message(FATAL_ERROR "libunwind not found. Install libunwind-dev") |
| 98 |
endif() |
| 99 |
endif() |
| 100 |
else() |
| 101 |
set(USE_LIBUNWIND OFF) |
| 102 |
endif() |
| 103 |
|
| 104 |
find_package(Threads) |
| 105 |
if (NOT Threads_FOUND) |
| 106 |
add_definitions(-DNPNR_DISABLE_THREADS) |
| 107 |
endif() |
| 108 |
|
| 109 |
if (WASI) |
| 110 |
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lwasi-emulated-mman") |
| 111 |
add_definitions( |
| 112 |
-DBOOST_EXCEPTION_DISABLE |
| 113 |
-DBOOST_NO_EXCEPTIONS |
| 114 |
) |
| 115 |
if (NOT Threads_FOUND) |
| 116 |
add_definitions(-DBOOST_NO_CXX11_HDR_MUTEX) |
| 117 |
endif() |
| 118 |
endif() |
| 119 |
|
| 120 |
if (STATIC_BUILD) |
| 121 |
set(Boost_USE_STATIC_LIBS ON) |
| 122 |
set(Python_USE_STATIC_LIBS ON) |
| 123 |
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
| 124 |
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows") |
| 125 |
if (MSVC) |
| 126 |
set(CMAKE_CXX_FLAGS_RELEASE "/MT") |
| 127 |
set(CMAKE_CXX_FLAGS_DEBUG "/MTd") |
| 128 |
endif() |
| 129 |
else() |
| 130 |
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") |
| 131 |
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static") |
| 132 |
if (BUILD_PYTHON) |
| 133 |
find_package(ZLIB) |
| 134 |
find_package(EXPAT) |
| 135 |
endif() |
| 136 |
endif() |
| 137 |
endif() |
| 138 |
|
| 139 |
if (EXTERNAL_CHIPDB) |
| 140 |
set(EXTERNAL_CHIPDB_ROOT "${CMAKE_INSTALL_PREFIX}/share/nextpnr" CACHE STRING |
| 141 |
"External chipdb path") |
| 142 |
message(STATUS "Using external chipdb path: ${EXTERNAL_CHIPDB_ROOT}") |
| 143 |
add_definitions("-DEXTERNAL_CHIPDB_ROOT=\"${EXTERNAL_CHIPDB_ROOT}\"") |
| 144 |
endif() |
| 145 |
|
| 146 |
# List of families to build |
| 147 |
set(FAMILIES generic ice40 ecp5 nexus machxo2 mistral himbaechel) |
| 148 |
set(STABLE_FAMILIES generic ice40 ecp5) |
| 149 |
set(EXPERIMENTAL_FAMILIES nexus machxo2 mistral himbaechel) |
| 150 |
|
| 151 |
set(ARCH "" CACHE STRING "Architecture family for nextpnr build") |
| 152 |
set_property(CACHE ARCH PROPERTY STRINGS ${FAMILIES}) |
| 153 |
|
| 154 |
if (NOT ARCH) |
| 155 |
message(STATUS "Architecture needs to be set, set desired one with -DARCH=xxx") |
| 156 |
message(STATUS "Supported architectures are :") |
| 157 |
message(STATUS " all") |
| 158 |
message(STATUS " all+alpha") |
| 159 |
foreach (item ${FAMILIES}) |
| 160 |
message(STATUS " ${item}") |
| 161 |
endforeach() |
| 162 |
message(FATAL_ERROR "Architecture setting is mandatory") |
| 163 |
endif() |
| 164 |
|
| 165 |
if (ARCH STREQUAL "all+alpha") |
| 166 |
set(ARCH ${STABLE_FAMILIES} ${EXPERIMENTAL_FAMILIES}) |
| 167 |
elseif (ARCH STREQUAL "all") |
| 168 |
set(ARCH ${STABLE_FAMILIES}) |
| 169 |
endif() |
| 170 |
|
| 171 |
foreach (item ${ARCH}) |
| 172 |
if (NOT item IN_LIST FAMILIES) |
| 173 |
message(FATAL_ERROR "Architecture '${item}' not in list of supported architectures") |
| 174 |
endif() |
| 175 |
endforeach() |
| 176 |
|
| 177 |
set(CMAKE_CXX_STANDARD 17) |
| 178 |
if (MSVC) |
| 179 |
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE) |
| 180 |
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_DEBUG /W4 /wd4100 /wd4244 /wd4125 /wd4800 /wd4456 /wd4458 /wd4305 /wd4459 /wd4121 /wd4996") |
| 181 |
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /W4 /wd4100 /wd4244 /wd4125 /wd4800 /wd4456 /wd4458 /wd4305 /wd4459 /wd4121 /wd4996 /wd4127") |
| 182 |
else() |
| 183 |
# N.B. the -Wno-array-bounds is to work around a false positive in GCC 9 |
| 184 |
set(WARN_FLAGS "-Wall -Wextra") |
| 185 |
foreach (TRY_WARN_FLAG no-unused-parameter no-missing-field-initializers no-array-bounds no-format-truncation) |
| 186 |
check_cxx_compiler_flag("-W${TRY_WARN_FLAG}" HAS_W${TRY_WARN_FLAG}) |
| 187 |
if (HAS_W${TRY_WARN_FLAG}) |
| 188 |
set(WARN_FLAGS "${WARN_FLAGS} -W${TRY_WARN_FLAG}") |
| 189 |
endif() |
| 190 |
endforeach() |
| 191 |
if (WERROR) |
| 192 |
set(WARN_FLAGS "${WARN_FLAGS} -Werror") |
| 193 |
endif() |
| 194 |
set(CMAKE_CXX_FLAGS_DEBUG "${WARN_FLAGS} -fPIC -ggdb -pipe") |
| 195 |
if (USE_OPENMP) |
| 196 |
set(CMAKE_CXX_FLAGS_RELEASE "${WARN_FLAGS} -fPIC -O3 -g -pipe -fopenmp") |
| 197 |
else() |
| 198 |
set(CMAKE_CXX_FLAGS_RELEASE "${WARN_FLAGS} -fPIC -O3 -g -pipe") |
| 199 |
endif() |
| 200 |
endif() |
| 201 |
|
| 202 |
set(boost_libs program_options iostreams) |
| 203 |
if (Threads_FOUND) |
| 204 |
list(APPEND boost_libs thread) |
| 205 |
endif() |
| 206 |
find_package(Boost REQUIRED COMPONENTS ${boost_libs}) |
| 207 |
|
| 208 |
if (BUILD_PYTHON) |
| 209 |
# TODO: sensible minimum Python version |
| 210 |
find_package(Python3 3.5 REQUIRED COMPONENTS Interpreter Development.Embed) |
| 211 |
find_package(pybind11 CONFIG) |
| 212 |
if (NOT pybind11_FOUND) |
| 213 |
message(STATUS "Using built-in pybind11") |
| 214 |
add_subdirectory(3rdparty/pybind11 EXCLUDE_FROM_ALL) |
| 215 |
endif() |
| 216 |
include_directories(${Python3_INCLUDE_DIRS}) |
| 217 |
else() |
| 218 |
find_package(Python3 3.5 REQUIRED COMPONENTS Interpreter) |
| 219 |
add_definitions("-DNO_PYTHON") |
| 220 |
endif() |
| 221 |
|
| 222 |
if (BUILD_RUST) |
| 223 |
add_subdirectory(3rdparty/corrosion) |
| 224 |
corrosion_import_crate(MANIFEST_PATH rust/Cargo.toml PROFILE "release" IMPORTED_CRATES RUST_CRATES) |
| 225 |
else() |
| 226 |
add_definitions("-DNO_RUST") |
| 227 |
endif() |
| 228 |
|
| 229 |
if (BUILD_GUI) |
| 230 |
# Find the Qt6/5 libraries |
| 231 |
find_package(Qt6 COMPONENTS Core Widgets OpenGL OpenGLWidgets QUIET) |
| 232 |
if (Qt6_FOUND) |
| 233 |
message(STATUS "Using Qt6") |
| 234 |
else() |
| 235 |
message(STATUS "Using Qt5") |
| 236 |
find_package(Qt5 COMPONENTS Core Widgets OpenGL REQUIRED) |
| 237 |
endif() |
| 238 |
|
| 239 |
# For higher quality backtraces |
| 240 |
set(CMAKE_ENABLE_EXPORTS ON) |
| 241 |
|
| 242 |
add_subdirectory(3rdparty/QtPropertyBrowser EXCLUDE_FROM_ALL) |
| 243 |
else() |
| 244 |
add_definitions(-DNO_GUI) |
| 245 |
endif() |
| 246 |
|
| 247 |
find_package(Eigen3 REQUIRED NO_MODULE) |
| 248 |
|
| 249 |
add_subdirectory(3rdparty/json11) |
| 250 |
|
| 251 |
add_subdirectory(3rdparty/oourafft) |
| 252 |
|
| 253 |
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/3rdparty/sanitizers-cmake/cmake" ${CMAKE_MODULE_PATH}) |
| 254 |
find_package(Sanitizers) |
| 255 |
|
| 256 |
if (BUILD_TESTS) |
| 257 |
# Disable unneeded parts |
| 258 |
set(BUILD_GMOCK OFF CACHE BOOL "" FORCE) |
| 259 |
set(INSTALL_GTEST OFF CACHE BOOL "" FORCE) |
| 260 |
add_subdirectory(3rdparty/googletest EXCLUDE_FROM_ALL) |
| 261 |
enable_testing() |
| 262 |
endif() |
| 263 |
|
| 264 |
if (CMAKE_CROSSCOMPILING) |
| 265 |
set(BBA_IMPORT "IMPORTFILE-NOTFOUND" CACHE FILEPATH |
| 266 |
"Path to the `bba-export.cmake` export file from a native build") |
| 267 |
include(${BBA_IMPORT}) |
| 268 |
else() |
| 269 |
add_subdirectory(bba) |
| 270 |
endif() |
| 271 |
|
| 272 |
include(BBAsm) |
| 273 |
|
| 274 |
add_subdirectory(common) |
| 275 |
add_subdirectory(common/kernel) |
| 276 |
add_subdirectory(common/place) |
| 277 |
add_subdirectory(common/route) |
| 278 |
add_subdirectory(frontend) |
| 279 |
add_subdirectory(json) |
| 280 |
add_subdirectory(rust) |
| 281 |
|
| 282 |
if (BUILD_TESTS) |
| 283 |
add_subdirectory(tests/gui) |
| 284 |
endif() |
| 285 |
|
| 286 |
add_custom_target(nextpnr-all-bba) |
| 287 |
|
| 288 |
function(add_nextpnr_architecture target) |
| 289 |
cmake_parse_arguments(arg "" "MAIN_SOURCE" "CORE_SOURCES;TEST_SOURCES;CURRENT_SOURCE_DIR;CURRENT_BINARY_DIR" ${ARGN}) |
| 290 |
|
| 291 |
if (NOT arg_CURRENT_SOURCE_DIR) |
| 292 |
set(arg_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) |
| 293 |
endif() |
| 294 |
if (NOT arg_CURRENT_BINARY_DIR) |
| 295 |
set(arg_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) |
| 296 |
endif() |
| 297 |
|
| 298 |
set(arg_MAIN_SOURCE "${arg_CURRENT_SOURCE_DIR}/${arg_MAIN_SOURCE}") |
| 299 |
list(TRANSFORM arg_CORE_SOURCES PREPEND ${arg_CURRENT_SOURCE_DIR}/) |
| 300 |
list(TRANSFORM arg_TEST_SOURCES PREPEND ${arg_CURRENT_SOURCE_DIR}/) |
| 301 |
|
| 302 |
# Defs library: used by everything |
| 303 |
# |
| 304 |
# This library doesn't include any code, and is used to share compiler options. |
| 305 |
|
| 306 |
add_library(nextpnr-${target}-defs INTERFACE) |
| 307 |
|
| 308 |
target_include_directories(nextpnr-${target}-defs INTERFACE |
| 309 |
${CMAKE_SOURCE_DIR}/common/kernel |
| 310 |
${arg_CURRENT_SOURCE_DIR} |
| 311 |
) |
| 312 |
|
| 313 |
string(TOUPPER ${family} family_upper) |
| 314 |
target_compile_definitions(nextpnr-${target}-defs INTERFACE |
| 315 |
NEXTPNR_NAMESPACE=nextpnr_${family} |
| 316 |
ARCHNAME=${family} |
| 317 |
ARCH_${family_upper} |
| 318 |
) |
| 319 |
|
| 320 |
# Core library: used by both CLI/GUI and tests |
| 321 |
|
| 322 |
add_library(nextpnr-${target}-core INTERFACE) |
| 323 |
|
| 324 |
target_sources(nextpnr-${target}-core INTERFACE |
| 325 |
${arg_CORE_SOURCES} |
| 326 |
) |
| 327 |
|
| 328 |
target_link_libraries(nextpnr-${target}-core INTERFACE |
| 329 |
nextpnr-${target}-defs |
| 330 |
nextpnr_kernel |
| 331 |
nextpnr_place |
| 332 |
nextpnr_route |
| 333 |
nextpnr_frontend |
| 334 |
nextpnr_json |
| 335 |
) |
| 336 |
|
| 337 |
target_link_libraries(nextpnr-${target}-core INTERFACE |
| 338 |
Boost::headers |
| 339 |
${Boost_LIBRARIES} |
| 340 |
Eigen3::Eigen |
| 341 |
oourafft |
| 342 |
) |
| 343 |
|
| 344 |
if (Threads_FOUND) |
| 345 |
target_link_libraries(nextpnr-${target}-core INTERFACE Threads::Threads) |
| 346 |
endif() |
| 347 |
|
| 348 |
if (BUILD_GUI) |
| 349 |
add_subdirectory(${CMAKE_SOURCE_DIR}/gui ${arg_CURRENT_BINARY_DIR}/gui) |
| 350 |
|
| 351 |
# Upsettingly, there is a cyclic dependency between `common/kernel` and `gui`, so these |
| 352 |
# two libraries have to be added separately to all executable targets. |
| 353 |
endif() |
| 354 |
|
| 355 |
if (BUILD_PYTHON) |
| 356 |
target_link_libraries(nextpnr-${target}-core INTERFACE ${Python3_LIBRARIES}) |
| 357 |
if (STATIC_BUILD) |
| 358 |
target_link_libraries(nextpnr-${target}-core INTERFACE ZLIB::ZLIB EXPAT::EXPAT) |
| 359 |
endif() |
| 360 |
endif() |
| 361 |
|
| 362 |
if (BUILD_RUST) |
| 363 |
foreach (crate ${RUST_CRATES}) |
| 364 |
target_link_libraries(nextpnr-${target}-core INTERFACE ${crate}) |
| 365 |
endforeach() |
| 366 |
endif() |
| 367 |
|
| 368 |
if (PROFILER) |
| 369 |
target_link_libraries(nextpnr-${target}-core INTERFACE profiler) |
| 370 |
endif() |
| 371 |
|
| 372 |
add_sanitizers(nextpnr-${target}-core) |
| 373 |
|
| 374 |
# Chip database |
| 375 |
|
| 376 |
add_library(nextpnr-${target}-bba INTERFACE EXCLUDE_FROM_ALL) |
| 377 |
|
| 378 |
add_dependencies(nextpnr-all-bba nextpnr-${target}-bba) |
| 379 |
|
| 380 |
add_library(nextpnr-${target}-chipdb INTERFACE EXCLUDE_FROM_ALL) |
| 381 |
|
| 382 |
target_link_libraries(nextpnr-${target}-core INTERFACE nextpnr-${target}-chipdb) |
| 383 |
|
| 384 |
# CLI/GUI runner |
| 385 |
|
| 386 |
add_executable(nextpnr-${target} ${arg_MAIN_SOURCE}) |
| 387 |
set_property(TARGET nextpnr-${target} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) |
| 388 |
set_property(TARGET nextpnr-${target} PROPERTY OUTPUT_NAME ${PROGRAM_PREFIX}nextpnr-${target}) |
| 389 |
if (WASI) |
| 390 |
# set(CMAKE_EXECUTABLE_SUFFIX) breaks CMake tests for some reason |
| 391 |
set_property(TARGET nextpnr-${target} PROPERTY SUFFIX ".wasm") |
| 392 |
endif() |
| 393 |
|
| 394 |
target_link_libraries(nextpnr-${target} PRIVATE nextpnr-${target}-core) |
| 395 |
if (BUILD_GUI) |
| 396 |
target_link_libraries(nextpnr-${target} PRIVATE nextpnr-${target}-gui) |
| 397 |
if (USE_LIBUNWIND) |
| 398 |
target_include_directories(nextpnr-${target} PRIVATE ${LIBUNWIND_INCLUDE_DIR}) |
| 399 |
target_link_libraries(nextpnr-${target} PRIVATE ${LIBUNWIND_LIBRARY}) |
| 400 |
endif() |
| 401 |
endif() |
| 402 |
|
| 403 |
install(TARGETS nextpnr-${target} RUNTIME DESTINATION bin) |
| 404 |
|
| 405 |
# Test runner |
| 406 |
|
| 407 |
if (BUILD_TESTS) |
| 408 |
add_test(NAME nextpnr-${target}-test COMMAND nextpnr-${target}-test) |
| 409 |
|
| 410 |
add_executable(nextpnr-${target}-test ${arg_TEST_SOURCES}) |
| 411 |
set_property(TARGET nextpnr-${target}-test PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) |
| 412 |
|
| 413 |
target_include_directories(nextpnr-${target}-test PRIVATE ${CMAKE_SOURCE_DIR}/3rdparty/googletest/googletest/include) |
| 414 |
|
| 415 |
target_link_libraries(nextpnr-${target}-test PRIVATE gtest_main nextpnr-${target}-core) |
| 416 |
if (BUILD_GUI) |
| 417 |
target_link_libraries(nextpnr-${target}-test PRIVATE nextpnr-${target}-gui) |
| 418 |
target_link_libraries(nextpnr-${target}-test PRIVATE nextpnr_test_gui) |
| 419 |
if (USE_LIBUNWIND) |
| 420 |
target_include_directories(nextpnr-${target}-test PRIVATE ${LIBUNWIND_INCLUDE_DIR}) |
| 421 |
target_link_libraries(nextpnr-${target}-test PRIVATE ${LIBUNWIND_LIBRARY}) |
| 422 |
endif() |
| 423 |
endif() |
| 424 |
endif() |
| 425 |
|
| 426 |
endfunction() |
| 427 |
|
| 428 |
foreach (family ${ARCH}) |
| 429 |
message(STATUS "Configuring architecture: ${family}") |
| 430 |
add_subdirectory(${family}) |
| 431 |
endforeach() |
| 432 |
|
| 433 |
file(GLOB_RECURSE CLANGFORMAT_FILES *.cc *.h) |
| 434 |
string(REGEX REPLACE "[^;]*/ice40/chipdb/chipdb-[^;]*.cc" "" CLANGFORMAT_FILES "${CLANGFORMAT_FILES}") |
| 435 |
string(REGEX REPLACE "[^;]*/ecp5/chipdb/chipdb-[^;]*.cc" "" CLANGFORMAT_FILES "${CLANGFORMAT_FILES}") |
| 436 |
string(REGEX REPLACE "[^;]*/nexus/chipdb/chipdb-[^;]*.cc" "" CLANGFORMAT_FILES "${CLANGFORMAT_FILES}") |
| 437 |
string(REGEX REPLACE "[^;]*/machxo2/chipdb/chipdb-[^;]*.cc" "" CLANGFORMAT_FILES "${CLANGFORMAT_FILES}") |
| 438 |
string(REGEX REPLACE "[^;]*/3rdparty/[^;]*" "" CLANGFORMAT_FILES "${CLANGFORMAT_FILES}") |
| 439 |
string(REGEX REPLACE "[^;]*/libmistral/[^;]*" "" CLANGFORMAT_FILES "${CLANGFORMAT_FILES}") |
| 440 |
|
| 441 |
add_custom_target(clangformat |
| 442 |
COMMAND clang-format |
| 443 |
-style=file |
| 444 |
-i |
| 445 |
${CLANGFORMAT_FILES} |
| 446 |
) |