Merge pull request #424 from mmicko/program_prefix

Support custom PROGRAM_PREFIX
This commit is contained in:
David Shah 2020-04-10 14:00:00 +01:00 committed by GitHub
commit 3eff12a2a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,6 +43,8 @@ if (EXTERNAL_CHIPDB)
add_definitions("-DEXTERNAL_CHIPDB_ROOT=\"${EXTERNAL_CHIPDB_ROOT}\"")
endif()
set(PROGRAM_PREFIX "" CACHE STRING "Name prefix for executables")
# List of families to build
set(FAMILIES generic ice40 ecp5)
@ -226,9 +228,9 @@ foreach (family ${ARCH})
endif()
# Add the CLI binary target
add_executable(nextpnr-${family} ${COMMON_FILES} ${${ufamily}_FILES})
install(TARGETS nextpnr-${family} RUNTIME DESTINATION bin)
target_compile_definitions(nextpnr-${family} PRIVATE MAIN_EXECUTABLE)
add_executable(${PROGRAM_PREFIX}nextpnr-${family} ${COMMON_FILES} ${${ufamily}_FILES})
install(TARGETS ${PROGRAM_PREFIX}nextpnr-${family} RUNTIME DESTINATION bin)
target_compile_definitions(${PROGRAM_PREFIX}nextpnr-${family} PRIVATE MAIN_EXECUTABLE)
# Add any new per-architecture targets here
if (BUILD_TESTS)
@ -237,8 +239,8 @@ foreach (family ${ARCH})
set(COVERAGE_LCOV_EXCLUDES '/usr/include/*' '3rdparty/*' 'generated/*' 'bba/*' 'tests/*')
SETUP_TARGET_FOR_COVERAGE_LCOV(
NAME ${family}-coverage
EXECUTABLE nextpnr-${family}-test
DEPENDENCIES nextpnr-${family}-test
EXECUTABLE ${PROGRAM_PREFIX}nextpnr-${family}-test
DEPENDENCIES ${PROGRAM_PREFIX}nextpnr-${family}-test
)
endif()
@ -247,19 +249,19 @@ foreach (family ${ARCH})
aux_source_directory(tests/gui/ GUI_TEST_FILES)
endif()
add_executable(nextpnr-${family}-test ${${ufamily}_TEST_FILES}
add_executable(${PROGRAM_PREFIX}nextpnr-${family}-test ${${ufamily}_TEST_FILES}
${COMMON_FILES} ${${ufamily}_FILES} ${GUI_TEST_FILES})
target_link_libraries(nextpnr-${family}-test PRIVATE gtest_main)
add_sanitizers(nextpnr-${family}-test)
target_link_libraries(${PROGRAM_PREFIX}nextpnr-${family}-test PRIVATE gtest_main)
add_sanitizers(${PROGRAM_PREFIX}nextpnr-${family}-test)
add_test(${family}-test ${CMAKE_CURRENT_BINARY_DIR}/nextpnr-${family}-test)
endif()
# Set ${family_targets} to the list of targets being build for this family
set(family_targets nextpnr-${family})
set(family_targets ${PROGRAM_PREFIX}nextpnr-${family})
if (BUILD_TESTS)
set(family_targets ${family_targets} nextpnr-${family}-test)
set(family_targets ${family_targets} ${PROGRAM_PREFIX}nextpnr-${family}-test)
endif()
# Include the family-specific CMakeFile