Merge pull request #11571 from ethereum/libsolcli-and-libphaser

Create libs for yul-phaser and solc to avoid recompiling their sources for soltest
This commit is contained in:
chriseth 2021-06-23 09:21:33 +02:00 committed by GitHub
commit 829bf0c18a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 25 deletions

View File

@ -1,11 +1,14 @@
set(
sources
set(libsolcli_sources
CommandLineInterface.cpp CommandLineInterface.h
main.cpp
)
add_library(solcli ${libsolcli_sources})
target_link_libraries(solcli PUBLIC solidity Boost::boost Boost::program_options)
set(sources main.cpp)
add_executable(solc ${sources})
target_link_libraries(solc PRIVATE solidity Boost::boost Boost::program_options)
target_link_libraries(solc PRIVATE solcli)
include(GNUInstallDirs)
install(TARGETS solc DESTINATION "${CMAKE_INSTALL_BINDIR}")

View File

@ -163,23 +163,6 @@ set(yul_phaser_sources
yulPhaser/ProgramCache.cpp
yulPhaser/Selections.cpp
yulPhaser/SimulationRNG.cpp
# FIXME: yul-phaser is not a library so I can't just add it to target_link_libraries().
# My current workaround is just to include its source files here but this introduces
# unnecessary duplication. Create a library or find a way to reuse the list in both places.
../tools/yulPhaser/AlgorithmRunner.cpp
../tools/yulPhaser/Common.cpp
../tools/yulPhaser/Chromosome.cpp
../tools/yulPhaser/FitnessMetrics.cpp
../tools/yulPhaser/GeneticAlgorithms.cpp
../tools/yulPhaser/Mutations.cpp
../tools/yulPhaser/PairSelections.cpp
../tools/yulPhaser/Phaser.cpp
../tools/yulPhaser/Population.cpp
../tools/yulPhaser/Program.cpp
../tools/yulPhaser/ProgramCache.cpp
../tools/yulPhaser/Selections.cpp
../tools/yulPhaser/SimulationRNG.cpp
)
detect_stray_source_files("${yul_phaser_sources}" "yulPhaser/")
@ -193,7 +176,7 @@ add_executable(soltest ${sources}
${libsolidity_util_sources}
${yul_phaser_sources}
)
target_link_libraries(soltest PRIVATE libsolc yul solidity smtutil solutil Boost::boost yulInterpreter evmasm Boost::filesystem Boost::program_options Boost::unit_test_framework evmc)
target_link_libraries(soltest PRIVATE libsolc yul solidity smtutil solutil phaser Boost::boost yulInterpreter evmasm Boost::filesystem Boost::program_options Boost::unit_test_framework evmc)
# Special compilation flag for Visual Studio (version 2019 at least affected)

View File

@ -14,8 +14,7 @@ target_link_libraries(solidity-upgrade PRIVATE solidity Boost::boost Boost::prog
include(GNUInstallDirs)
install(TARGETS solidity-upgrade DESTINATION "${CMAKE_INSTALL_BINDIR}")
add_executable(yul-phaser
yulPhaser/main.cpp
set(libphaser_sources
yulPhaser/Common.h
yulPhaser/Common.cpp
yulPhaser/AlgorithmRunner.h
@ -43,6 +42,10 @@ add_executable(yul-phaser
yulPhaser/SimulationRNG.h
yulPhaser/SimulationRNG.cpp
)
target_link_libraries(yul-phaser PRIVATE solidity Boost::filesystem Boost::program_options)
add_library(phaser ${libphaser_sources})
target_link_libraries(phaser PUBLIC solidity Boost::boost Boost::program_options)
add_executable(yul-phaser yulPhaser/main.cpp)
target_link_libraries(yul-phaser PRIVATE phaser)
install(TARGETS yul-phaser DESTINATION "${CMAKE_INSTALL_BINDIR}")