Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use add_custom_target to generate egenesis files #2250

Merged
merged 1 commit into from
Aug 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions libraries/egenesis/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
message( STATUS "Generating egenesis" )

if( GRAPHENE_EGENESIS_JSON )
set( embed_genesis_args "${GRAPHENE_EGENESIS_JSON}" )
else( GRAPHENE_EGENESIS_JSON )
set( embed_genesis_args "genesis.json" )
endif( GRAPHENE_EGENESIS_JSON )

add_custom_command(
OUTPUT
add_custom_target( build_egenesis_cpp
BYPRODUCTS
"${CMAKE_CURRENT_BINARY_DIR}/egenesis_brief.cpp"
"${CMAKE_CURRENT_BINARY_DIR}/egenesis_full.cpp"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
Expand All @@ -16,6 +14,7 @@ add_custom_command(
-DINIT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
-Dembed_genesis_args=${embed_genesis_args}
-P ${CMAKE_CURRENT_SOURCE_DIR}/embed_genesis.cmake
COMMENT "Generating egenesis"
DEPENDS
"${GRAPHENE_EGENESIS_JSON}"
"${CMAKE_CURRENT_SOURCE_DIR}/egenesis_brief.cpp.tmpl"
Expand All @@ -26,8 +25,10 @@ add_library( graphene_egenesis_none egenesis_none.cpp
include/graphene/egenesis/egenesis.hpp )
add_library( graphene_egenesis_brief "${CMAKE_CURRENT_BINARY_DIR}/egenesis_brief.cpp"
include/graphene/egenesis/egenesis.hpp )
add_dependencies( graphene_egenesis_brief build_egenesis_cpp )
add_library( graphene_egenesis_full "${CMAKE_CURRENT_BINARY_DIR}/egenesis_full.cpp"
include/graphene/egenesis/egenesis.hpp )
add_dependencies( graphene_egenesis_full build_egenesis_cpp )

target_link_libraries( graphene_egenesis_none graphene_chain fc )
target_link_libraries( graphene_egenesis_brief graphene_chain fc )
Expand Down