Skip to content

Commit

Permalink
himbaechel/gowin: recognize -DAPYCULA_INSTALL_PREFIX=.../virtualenv.
Browse files Browse the repository at this point in the history
This option can be empty, in which case the virtualenv is left
exactly as it was in the build environment.
  • Loading branch information
whitequark committed Aug 31, 2023
1 parent f22c7e3 commit 4964b05
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion himbaechel/uarch/gowin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@ if(HIMBAECHEL_GOWIN_DEVICES STREQUAL "all")
endif()
message(STATUS "Enabled Himbaechel-Gowin devices: ${HIMBAECHEL_GOWIN_DEVICES}")

if(DEFINED ENV{APYCULA_INSTALL_PREFIX})
set(apycula_default_install_prefix $ENV{APYCULA_INSTALL_PREFIX})
endif()
set(APYCULA_INSTALL_PREFIX ${apycula_default_install_prefix} CACHE STRING
"Apycula install prefix (virtualenv directory)")
if(NOT APYCULA_INSTALL_PREFIX STREQUAL "")
message(STATUS "Apycula install prefix: ${APYCULA_INSTALL_PREFIX}")
set(apycula_Python3_EXECUTABLE ${APYCULA_INSTALL_PREFIX}/bin/python)
else()
message(STATUS "Apycula install prefix: (using system Python)")
set(apycula_Python3_EXECUTABLE ${Python3_EXECUTABLE})
endif()

set(chipdb_binaries)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/chipdb)
foreach(device ${HIMBAECHEL_GOWIN_DEVICES})
Expand All @@ -22,7 +35,7 @@ foreach(device ${HIMBAECHEL_GOWIN_DEVICES})
set(device_bin chipdb/chipdb-${device}.bin)
add_custom_command(
OUTPUT ${device_bin}
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/gowin_arch_gen.py -d ${device} -o ${device_bba}
COMMAND ${apycula_Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/gowin_arch_gen.py -d ${device} -o ${device_bba}
COMMAND bbasm ${BBASM_ENDIAN_FLAG} ${device_bba} ${device_bin}.new
# atomically update
COMMAND ${CMAKE_COMMAND} -E rename ${device_bin}.new ${device_bin}
Expand Down

0 comments on commit 4964b05

Please sign in to comment.