mirror of
https://github.com/YosysHQ/yosys
synced 2026-05-25 11:26:22 +00:00
Migrate build system to CMake
See #5895 for details. This commit does not include CI or documentation changes.
This commit is contained in:
parent
9d0cdb8551
commit
9b087b4aa7
207 changed files with 5202 additions and 2294 deletions
60
cmake/YosysConfigScript.cmake
Normal file
60
cmake/YosysConfigScript.cmake
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
# Syntax:
|
||||
#
|
||||
# yosys_config_script({BUILD|INSTALL})
|
||||
#
|
||||
# Generates a `yosys-config` executable with embedded paths for in-tree builds or after installation.
|
||||
#
|
||||
function(yosys_config_script scope)
|
||||
if (scope STREQUAL BUILD)
|
||||
set(BINDIR ${CMAKE_BINARY_DIR})
|
||||
set(LIBDIR ${CMAKE_BINARY_DIR})
|
||||
set(DATDIR ${CMAKE_BINARY_DIR}/share)
|
||||
set(suffix "")
|
||||
elseif (scope STREQUAL INSTALL)
|
||||
set(BINDIR ${YOSYS_INSTALL_FULL_BINDIR})
|
||||
set(LIBDIR ${YOSYS_INSTALL_FULL_LIBDIR})
|
||||
set(DATDIR ${YOSYS_INSTALL_FULL_DATADIR})
|
||||
set(suffix ".install")
|
||||
else()
|
||||
message(FATAL_ERROR "Invalid scope ${scope}")
|
||||
endif()
|
||||
|
||||
set(platform_link_flags)
|
||||
set(platform_libs)
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
set(platform_link_flags -undefined dynamic_lookup)
|
||||
endif()
|
||||
if (MINGW)
|
||||
set(platform_libs -l:yosys.exe.a)
|
||||
endif()
|
||||
|
||||
set(CXX ${CMAKE_CXX_COMPILER})
|
||||
string(JOIN " " CXXFLAGS
|
||||
-std=c++${CMAKE_CXX_STANDARD}
|
||||
${CMAKE_CXX_FLAGS}
|
||||
${CMAKE_CXX_COMPILE_OPTIONS_PIC}
|
||||
-D_YOSYS_
|
||||
"-DYOSYS_VER=\"${YOSYS_VERSION}\""
|
||||
"-DYOSYS_MAJOR=${YOSYS_VERSION_MAJOR}"
|
||||
"-DYOSYS_MINOR=${YOSYS_VERSION_MINOR}"
|
||||
"-DYOSYS_COMMIT=${YOSYS_VERSION_COMMIT}"
|
||||
-I${DATDIR}/include
|
||||
)
|
||||
string(JOIN " " LINKFLAGS
|
||||
${CMAKE_SHARED_LIBRARY_CXX_FLAGS}
|
||||
-L${LIBDIR}
|
||||
${platform_link_flags}
|
||||
)
|
||||
string(JOIN " " LIBS
|
||||
${platform_libs}
|
||||
)
|
||||
configure_file(${CMAKE_SOURCE_DIR}/misc/yosys-config.in
|
||||
${YOSYS_PROGRAM_PREFIX}yosys-config${suffix}
|
||||
USE_SOURCE_PERMISSIONS
|
||||
@ONLY
|
||||
)
|
||||
if (scope STREQUAL INSTALL)
|
||||
install(PROGRAMS ${CMAKE_BINARY_DIR}/${YOSYS_PROGRAM_PREFIX}yosys-config
|
||||
DESTINATION ${YOSYS_INSTALL_BINDIR})
|
||||
endif()
|
||||
endfunction()
|
||||
Loading…
Add table
Add a link
Reference in a new issue