Create libraries for yul-phaser and solc to avoid compiling their sources again for soltest

This commit is contained in:
Kamil Śliwak 2021-06-22 17:42:44 +02:00
parent 9cf6021d8a
commit afb8fb4927
3 changed files with 14 additions and 25 deletions

View File

@ -1,11 +1,14 @@
set( set(libsolcli_sources
sources
CommandLineInterface.cpp CommandLineInterface.h 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}) add_executable(solc ${sources})
target_link_libraries(solc PRIVATE solidity Boost::boost Boost::program_options) target_link_libraries(solc PRIVATE solcli)
include(GNUInstallDirs) include(GNUInstallDirs)
install(TARGETS solc DESTINATION "${CMAKE_INSTALL_BINDIR}") install(TARGETS solc DESTINATION "${CMAKE_INSTALL_BINDIR}")

View File

@ -163,23 +163,6 @@ set(yul_phaser_sources
yulPhaser/ProgramCache.cpp yulPhaser/ProgramCache.cpp
yulPhaser/Selections.cpp yulPhaser/Selections.cpp
yulPhaser/SimulationRNG.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/") detect_stray_source_files("${yul_phaser_sources}" "yulPhaser/")
@ -193,7 +176,7 @@ add_executable(soltest ${sources}
${libsolidity_util_sources} ${libsolidity_util_sources}
${yul_phaser_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) # 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) include(GNUInstallDirs)
install(TARGETS solidity-upgrade DESTINATION "${CMAKE_INSTALL_BINDIR}") install(TARGETS solidity-upgrade DESTINATION "${CMAKE_INSTALL_BINDIR}")
add_executable(yul-phaser set(libphaser_sources
yulPhaser/main.cpp
yulPhaser/Common.h yulPhaser/Common.h
yulPhaser/Common.cpp yulPhaser/Common.cpp
yulPhaser/AlgorithmRunner.h yulPhaser/AlgorithmRunner.h
@ -43,6 +42,10 @@ add_executable(yul-phaser
yulPhaser/SimulationRNG.h yulPhaser/SimulationRNG.h
yulPhaser/SimulationRNG.cpp 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}") install(TARGETS yul-phaser DESTINATION "${CMAKE_INSTALL_BINDIR}")