From 9953012154f18ea51ff9216529089715ba79fb41 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 12 Jun 2018 19:56:03 +0200 Subject: reveresed logic for enabling main file, and made tests link arch files --- CMakeLists.txt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index b0976d9a..83221f9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,33 +82,35 @@ set(CMAKE_BUILD_TYPE Debug) foreach (family ${FAMILIES}) string(TOUPPER ${family} ufamily) aux_source_directory(${family}/ ${ufamily}_FILES) + aux_source_directory(tests/${family}/ ${ufamily}_TEST_FILES) # Add the CLI binary target add_executable(nextpnr-${family} ${COMMON_FILES} ${${ufamily}_FILES} ${GUI_SOURCE_FILES}) + target_compile_definitions(nextpnr-${family} PRIVATE MAIN_EXECUTABLE) + # Add the importable Python module target PYTHON_ADD_MODULE(nextpnrpy_${family} ${COMMON_FILES} ${${ufamily}_FILES}) - target_compile_definitions(nextpnrpy_${family} PRIVATE PYTHON_MODULE) # Add any new per-architecture targets here + add_executable(nextpnr-${family}-test ${${ufamily}_TEST_FILES} ${COMMON_FILES} ${${ufamily}_FILES}) + target_link_libraries(nextpnr-${family}-test PRIVATE gtest_main) + add_test(${family}-test ${CMAKE_CURRENT_BINARY_DIR}/nextpnr-${family}-test) + # Set ${family_targets} to the list of targets being build for this family - set(family_targets nextpnr-${family} nextpnrpy_${family}) + set(family_targets nextpnr-${family} nextpnrpy_${family} nextpnr-${family}-test) # Include the family-specific CMakeFile include(${family}/family.cmake) foreach (target ${family_targets}) # Include family-specific source files to all family targets and set defines appropriately target_include_directories(${target} PRIVATE ${family}/) - target_compile_definitions(${target} PRIVATE NEXTPNR_NAMESPACE=nextpnr_${family} ARCH_${ufamily} ARCHNAME=${family} -DQT_NO_KEYWORDS) + target_compile_definitions(${target} PRIVATE NEXTPNR_NAMESPACE=nextpnr_${family} ARCH_${ufamily} ARCHNAME=${family} QT_NO_KEYWORDS) target_link_libraries(${target} LINK_PUBLIC ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} ${GUI_LIBRARY_FILES}) endforeach (target) - - add_executable(nextpnr-${family}-test "") - target_sources(nextpnr-${family}-test PRIVATE tests/${family}/main.cpp) - target_link_libraries(nextpnr-${family}-test PRIVATE gtest_main) - add_test(${family}-test ${CMAKE_CURRENT_BINARY_DIR}/nextpnr-${family}-test) endforeach (family) file(GLOB_RECURSE CLANGFORMAT_FILES *.cc *.h) string(REGEX REPLACE "[^;]*/ice40/chipdbs/chipdb-[^;]*.cc" "" CLANGFORMAT_FILES "${CLANGFORMAT_FILES}") string(REGEX REPLACE "[^;]*/3rdparty[^;]*" "" CLANGFORMAT_FILES "${CLANGFORMAT_FILES}") +string(REGEX REPLACE "[^;]*/generated[^;]*" "" CLANGFORMAT_FILES "${CLANGFORMAT_FILES}") add_custom_target( clangformat -- cgit v1.2.3