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_SCCACHE "Enable building with SCCACHE" OFF)
|
||||||
option(ENABLE_FUNCTIONAL_TESTS "Enable functional tests" 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")
|
set(CXXSTD 17 CACHE STRING "C++ standard to use for the build")
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,6 +106,7 @@ endif()
|
||||||
|
|
||||||
if (ENABLE_ZLIB)
|
if (ENABLE_ZLIB)
|
||||||
find_package(ZLIB REQUIRED)
|
find_package(ZLIB REQUIRED)
|
||||||
|
add_compile_definitions(YOSYS_ENABLE_ZLIB)
|
||||||
target_link_libraries(yosys PRIVATE ZLIB::ZLIB)
|
target_link_libraries(yosys PRIVATE ZLIB::ZLIB)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -146,6 +152,10 @@ if (ENABLE_PLUGINS)
|
||||||
target_link_libraries(yosys PRIVATE ${LIBFFI_LIBRARY})
|
target_link_libraries(yosys PRIVATE ${LIBFFI_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (DISABLE_SPAWN)
|
||||||
|
add_compile_definitions(YOSYS_DISABLE_SPAWN)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_subdirectory(kernel)
|
add_subdirectory(kernel)
|
||||||
add_subdirectory(libs)
|
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
|
target_sources(yosys_frontends_rpc INTERFACE
|
||||||
rpc_frontend.cc
|
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
|
ffmerge.h
|
||||||
fmt.cc
|
fmt.cc
|
||||||
fmt.h
|
fmt.h
|
||||||
fstdata.cc
|
|
||||||
fstdata.h
|
|
||||||
functional.cc
|
functional.cc
|
||||||
functional.h
|
functional.h
|
||||||
hashlib.h
|
hashlib.h
|
||||||
|
@ -82,4 +80,11 @@ target_sources(yosys_kernel INTERFACE
|
||||||
yw.h
|
yw.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (ENABLE_ZLIB)
|
||||||
|
target_sources(yosys_kernel INTERFACE
|
||||||
|
fstdata.cc
|
||||||
|
fstdata.h
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_link_libraries(yosys PRIVATE yosys_kernel)
|
target_link_libraries(yosys PRIVATE yosys_kernel)
|
||||||
|
|
|
@ -48,6 +48,14 @@ target_sources(yosys_libs INTERFACE
|
||||||
minisat/Vec.h
|
minisat/Vec.h
|
||||||
minisat/XAlloc.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/config.h
|
||||||
fst/fastlz.cc
|
fst/fastlz.cc
|
||||||
fst/fastlz.h
|
fst/fastlz.h
|
||||||
|
@ -56,11 +64,7 @@ target_sources(yosys_libs INTERFACE
|
||||||
fst/fst_win_unistd.h
|
fst/fst_win_unistd.h
|
||||||
fst/lz4.cc
|
fst/lz4.cc
|
||||||
fst/lz4.h
|
fst/lz4.h
|
||||||
|
|
||||||
subcircuit/subcircuit.cc
|
|
||||||
subcircuit/subcircuit.h
|
|
||||||
|
|
||||||
cxxopts/include/cxxopts.hpp
|
|
||||||
)
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_link_libraries(yosys PRIVATE yosys_libs)
|
target_link_libraries(yosys PRIVATE yosys_libs)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
add_library(yosys_passes_cmds INTERFACE)
|
add_library(yosys_passes_cmds INTERFACE)
|
||||||
|
|
||||||
target_sources(yosys_passes_cmds INTERFACE
|
target_sources(yosys_passes_cmds INTERFACE
|
||||||
exec.cc
|
|
||||||
add.cc
|
add.cc
|
||||||
delete.cc
|
delete.cc
|
||||||
design.cc
|
design.cc
|
||||||
|
@ -37,7 +36,6 @@ target_sources(yosys_passes_cmds INTERFACE
|
||||||
chtype.cc
|
chtype.cc
|
||||||
blackbox.cc
|
blackbox.cc
|
||||||
ltp.cc
|
ltp.cc
|
||||||
bugpoint.cc
|
|
||||||
scratchpad.cc
|
scratchpad.cc
|
||||||
logger.cc
|
logger.cc
|
||||||
printattrs.cc
|
printattrs.cc
|
||||||
|
@ -53,4 +51,11 @@ target_sources(yosys_passes_cmds INTERFACE
|
||||||
setenv.cc
|
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)
|
target_link_libraries(yosys PRIVATE yosys_passes_cmds)
|
||||||
|
|
|
@ -4,7 +4,6 @@ target_sources(yosys_passes_sat INTERFACE
|
||||||
sat.cc
|
sat.cc
|
||||||
freduce.cc
|
freduce.cc
|
||||||
eval.cc
|
eval.cc
|
||||||
sim.cc
|
|
||||||
miter.cc
|
miter.cc
|
||||||
expose.cc
|
expose.cc
|
||||||
assertpmux.cc
|
assertpmux.cc
|
||||||
|
@ -17,9 +16,20 @@ target_sources(yosys_passes_sat INTERFACE
|
||||||
cutpoint.cc
|
cutpoint.cc
|
||||||
fminit.cc
|
fminit.cc
|
||||||
recover_names.cc
|
recover_names.cc
|
||||||
qbfsat.cc
|
|
||||||
synthprop.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)
|
target_link_libraries(yosys PRIVATE yosys_passes_sat)
|
||||||
|
|
|
@ -8,11 +8,6 @@ target_sources(yosys_passes_techmap INTERFACE
|
||||||
maccmap.cc
|
maccmap.cc
|
||||||
booth.cc
|
booth.cc
|
||||||
libparse.cc
|
libparse.cc
|
||||||
abc.cc
|
|
||||||
abc9.cc
|
|
||||||
abc9_exe.cc
|
|
||||||
abc9_ops.cc
|
|
||||||
abc_new.cc
|
|
||||||
iopadmap.cc
|
iopadmap.cc
|
||||||
clkbufmap.cc
|
clkbufmap.cc
|
||||||
hilomap.cc
|
hilomap.cc
|
||||||
|
@ -46,7 +41,19 @@ target_sources(yosys_passes_techmap INTERFACE
|
||||||
clockgate.cc
|
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)
|
target_link_libraries(yosys PRIVATE yosys_passes_techmap)
|
||||||
|
|
||||||
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
|
if (NOT DISABLE_SPAWN)
|
||||||
add_executable(yosys-filterlib filterlib.cc)
|
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
|
||||||
|
add_executable(yosys-filterlib filterlib.cc)
|
||||||
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue