mirror of https://github.com/YosysHQ/yosys.git
CMake: handle some conditional compiling
This commit is contained in:
parent
691fbf736a
commit
3900eadde0
|
@ -36,6 +36,11 @@ option(ENABLE_CCACHE "Enable building with CCACHE" OFF)
|
|||
option(ENABLE_SCCACHE "Enable building with SCCACHE" OFF)
|
||||
option(ENABLE_FUNCTIONAL_TESTS "Enable functional tests" OFF)
|
||||
|
||||
# Needed for environments that can't run executables (i.e. emscripten, wasm)
|
||||
option(DISABLE_SPAWN "Disable executable spawn" OFF)
|
||||
# Needed for environments that don't have proper thread support (i.e. emscripten, wasm--for now)
|
||||
option(DISABLE_ABC_THREADS "Disable ABC threading support" OFF)
|
||||
|
||||
set(CXXSTD 17 CACHE STRING "C++ standard to use for the build")
|
||||
|
||||
|
||||
|
@ -101,6 +106,7 @@ endif()
|
|||
|
||||
if (ENABLE_ZLIB)
|
||||
find_package(ZLIB REQUIRED)
|
||||
add_compile_definitions(YOSYS_ENABLE_ZLIB)
|
||||
target_link_libraries(yosys PRIVATE ZLIB::ZLIB)
|
||||
endif()
|
||||
|
||||
|
@ -146,6 +152,10 @@ if (ENABLE_PLUGINS)
|
|||
target_link_libraries(yosys PRIVATE ${LIBFFI_LIBRARY})
|
||||
endif()
|
||||
|
||||
if (DISABLE_SPAWN)
|
||||
add_compile_definitions(YOSYS_DISABLE_SPAWN)
|
||||
endif()
|
||||
|
||||
add_subdirectory(kernel)
|
||||
add_subdirectory(libs)
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
add_library(yosys_frontends_rpc INTERFACE)
|
||||
if (NOT DISABLE_SPAWN)
|
||||
add_library(yosys_frontends_rpc INTERFACE)
|
||||
|
||||
target_sources(yosys_frontends_rpc INTERFACE
|
||||
rpc_frontend.cc
|
||||
)
|
||||
target_sources(yosys_frontends_rpc INTERFACE
|
||||
rpc_frontend.cc
|
||||
)
|
||||
|
||||
target_link_libraries(yosys PRIVATE yosys_frontends_rpc)
|
||||
target_link_libraries(yosys PRIVATE yosys_frontends_rpc)
|
||||
endif()
|
||||
|
|
|
@ -44,8 +44,6 @@ target_sources(yosys_kernel INTERFACE
|
|||
ffmerge.h
|
||||
fmt.cc
|
||||
fmt.h
|
||||
fstdata.cc
|
||||
fstdata.h
|
||||
functional.cc
|
||||
functional.h
|
||||
hashlib.h
|
||||
|
@ -82,4 +80,11 @@ target_sources(yosys_kernel INTERFACE
|
|||
yw.h
|
||||
)
|
||||
|
||||
if (ENABLE_ZLIB)
|
||||
target_sources(yosys_kernel INTERFACE
|
||||
fstdata.cc
|
||||
fstdata.h
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(yosys PRIVATE yosys_kernel)
|
||||
|
|
|
@ -48,6 +48,14 @@ target_sources(yosys_libs INTERFACE
|
|||
minisat/Vec.h
|
||||
minisat/XAlloc.h
|
||||
|
||||
subcircuit/subcircuit.cc
|
||||
subcircuit/subcircuit.h
|
||||
|
||||
cxxopts/include/cxxopts.hpp
|
||||
)
|
||||
|
||||
if (ENABLE_ZLIB)
|
||||
target_sources(yosys_libs INTERFACE
|
||||
fst/config.h
|
||||
fst/fastlz.cc
|
||||
fst/fastlz.h
|
||||
|
@ -56,11 +64,7 @@ target_sources(yosys_libs INTERFACE
|
|||
fst/fst_win_unistd.h
|
||||
fst/lz4.cc
|
||||
fst/lz4.h
|
||||
|
||||
subcircuit/subcircuit.cc
|
||||
subcircuit/subcircuit.h
|
||||
|
||||
cxxopts/include/cxxopts.hpp
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(yosys PRIVATE yosys_libs)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
add_library(yosys_passes_cmds INTERFACE)
|
||||
|
||||
target_sources(yosys_passes_cmds INTERFACE
|
||||
exec.cc
|
||||
add.cc
|
||||
delete.cc
|
||||
design.cc
|
||||
|
@ -37,7 +36,6 @@ target_sources(yosys_passes_cmds INTERFACE
|
|||
chtype.cc
|
||||
blackbox.cc
|
||||
ltp.cc
|
||||
bugpoint.cc
|
||||
scratchpad.cc
|
||||
logger.cc
|
||||
printattrs.cc
|
||||
|
@ -53,4 +51,11 @@ target_sources(yosys_passes_cmds INTERFACE
|
|||
setenv.cc
|
||||
)
|
||||
|
||||
if (NOT DISABLE_SPAWN)
|
||||
target_sources(yosys_passes_cmds INTERFACE
|
||||
exec.cc
|
||||
bugpoint.cc
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(yosys PRIVATE yosys_passes_cmds)
|
||||
|
|
|
@ -4,7 +4,6 @@ target_sources(yosys_passes_sat INTERFACE
|
|||
sat.cc
|
||||
freduce.cc
|
||||
eval.cc
|
||||
sim.cc
|
||||
miter.cc
|
||||
expose.cc
|
||||
assertpmux.cc
|
||||
|
@ -17,9 +16,20 @@ target_sources(yosys_passes_sat INTERFACE
|
|||
cutpoint.cc
|
||||
fminit.cc
|
||||
recover_names.cc
|
||||
qbfsat.cc
|
||||
synthprop.cc
|
||||
|
||||
)
|
||||
|
||||
if (ENABLE_ZLIB)
|
||||
target_sources(yosys_passes_sat INTERFACE
|
||||
sim.cc
|
||||
)
|
||||
endif()
|
||||
|
||||
if (NOT DISABLE_SPAWN)
|
||||
target_sources(yosys_passes_sat INTERFACE
|
||||
qbfsat.cc
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(yosys PRIVATE yosys_passes_sat)
|
||||
|
|
|
@ -8,11 +8,6 @@ target_sources(yosys_passes_techmap INTERFACE
|
|||
maccmap.cc
|
||||
booth.cc
|
||||
libparse.cc
|
||||
abc.cc
|
||||
abc9.cc
|
||||
abc9_exe.cc
|
||||
abc9_ops.cc
|
||||
abc_new.cc
|
||||
iopadmap.cc
|
||||
clkbufmap.cc
|
||||
hilomap.cc
|
||||
|
@ -46,7 +41,19 @@ target_sources(yosys_passes_techmap INTERFACE
|
|||
clockgate.cc
|
||||
)
|
||||
|
||||
if (ENABLE_ABC)
|
||||
target_sources(yosys_passes_techmap INTERFACE
|
||||
abc.cc
|
||||
abc9.cc
|
||||
abc9_exe.cc
|
||||
abc9_ops.cc
|
||||
abc_new.cc
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(yosys PRIVATE yosys_passes_techmap)
|
||||
|
||||
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
|
||||
add_executable(yosys-filterlib filterlib.cc)
|
||||
if (NOT DISABLE_SPAWN)
|
||||
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
|
||||
add_executable(yosys-filterlib filterlib.cc)
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue