aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2018-07-11 10:23:23 +0200
committerMiodrag Milanovic <mmicko@gmail.com>2018-07-11 10:23:23 +0200
commitd5be9ff5845e17f17a22fb11cdb5099a84a6bb4d (patch)
tree3cbd7d91e8bae0fb3ca3f322f349aa841a55730b
parent2ad355ebeb00d9698efe2bb910a500e401f5d50b (diff)
downloadnextpnr-d5be9ff5845e17f17a22fb11cdb5099a84a6bb4d.tar.gz
nextpnr-d5be9ff5845e17f17a22fb11cdb5099a84a6bb4d.tar.bz2
nextpnr-d5be9ff5845e17f17a22fb11cdb5099a84a6bb4d.zip
Added cmake parameter ARCH to specify architecture to build
-rw-r--r--CMakeLists.txt34
-rw-r--r--README.md3
2 files changed, 32 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b4493486..dc4e2a4f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,6 +8,29 @@ option(BUILD_TESTS "Build GUI" OFF)
# List of families to build
set(FAMILIES generic ice40)
+set(ARCH "" CACHE STRING "Architecture family for nextpnr build")
+set_property(CACHE ARCH PROPERTY STRINGS ${FAMILIES})
+
+if (NOT ARCH)
+ message(STATUS "Architecture needs to be set, set desired one with -DARCH=xxx")
+ message(STATUS "Supported architectures are :")
+ message(STATUS " all")
+ foreach(item ${FAMILIES})
+ message(STATUS " ${item}")
+ endforeach()
+ message(FATAL_ERROR "Architecture setting is mandatory")
+endif ()
+
+if (ARCH STREQUAL "all")
+ SET(ARCH ${FAMILIES})
+endif()
+
+foreach(item ${ARCH})
+ if (NOT item IN_LIST FAMILIES)
+ message(FATAL_ERROR "Architecture '${item}' not in list of supported architectures")
+ endif()
+endforeach()
+
set(CMAKE_CXX_STANDARD 11)
if (MSVC)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
@@ -62,7 +85,7 @@ if (BUILD_TESTS)
endif()
if (BUILD_GUI)
- add_subdirectory(3rdparty/QtPropertyBrowser ${CMAKE_CURRENT_BINARY_DIR}/generated/3rdparty/QtPropertyBrowser)
+ add_subdirectory(3rdparty/QtPropertyBrowser ${CMAKE_CURRENT_BINARY_DIR}/generated/3rdparty/QtPropertyBrowser EXCLUDE_FROM_ALL)
endif()
add_definitions("-DGIT_COMMIT_HASH=${GIT_COMMIT_HASH}")
@@ -132,22 +155,23 @@ if(MINGW)
add_definitions("-Wa,-mbig-obj")
endif(MINGW)
-foreach (family ${FAMILIES})
+foreach (family ${ARCH})
+ message(STATUS "Configuring architecture : ${family}")
string(TOUPPER ${family} ufamily)
aux_source_directory(${family}/ ${ufamily}_FILES)
if (BUILD_GUI)
- add_subdirectory(gui ${CMAKE_CURRENT_BINARY_DIR}/generated/gui/${family})
+ add_subdirectory(gui ${CMAKE_CURRENT_BINARY_DIR}/generated/gui/${family} EXCLUDE_FROM_ALL)
endif()
# Add the CLI binary target
- add_executable(nextpnr-${family} ${COMMON_FILES} ${${ufamily}_FILES} )
+ add_executable(nextpnr-${family} ${COMMON_FILES} ${${ufamily}_FILES})
install(TARGETS nextpnr-${family} RUNTIME DESTINATION bin)
target_compile_definitions(nextpnr-${family} PRIVATE MAIN_EXECUTABLE)
if (BUILD_PYTHON)
# Add the importable Python module target
- PYTHON_ADD_MODULE(nextpnrpy_${family} EXCLUDE_FROM_ALL ${COMMON_FILES} ${${ufamily}_FILES})
+ PYTHON_ADD_MODULE(nextpnrpy_${family} ${COMMON_FILES} ${${ufamily}_FILES})
endif()
# Add any new per-architecture targets here
diff --git a/README.md b/README.md
index 195f08c3..7fe49328 100644
--- a/README.md
+++ b/README.md
@@ -27,6 +27,9 @@ Prequisites
Building
--------
+ - Specifying target architecture is mandatory use ARCH parameter to set it. It is semicolon separated list.
+ - Use `cmake . -DARCH=all` to build all supported targets
+ - For example `cmake . -DARCH=ice40` would build just ICE40 support
- Use CMake to generate the Makefiles (only needs to be done when `CMakeLists.txt` changes)
- For a debug build, run `cmake -DCMAKE_BUILD_TYPE=Debug .`
- For a debug build with HX1K support only, run ` cmake -DCMAKE_BUILD_TYPE=Debug -DICE40_HX1K_ONLY=1 .`