diff options
author | Bob Summerwill <bob@summerwill.net> | 2016-08-01 13:25:37 +0800 |
---|---|---|
committer | Bob Summerwill <bob@summerwill.net> | 2016-08-01 16:45:11 +0800 |
commit | 4ee2114127f87b08b76b3ca94cde80a49cdc056a (patch) | |
tree | b680926d0da4aadfddae0db9567557802f2c2929 /cmake/EthExecutableHelper.cmake | |
parent | 56727d61a61e1485c8360f00700d766632ec7163 (diff) | |
download | dexon-solidity-4ee2114127f87b08b76b3ca94cde80a49cdc056a.tar.gz dexon-solidity-4ee2114127f87b08b76b3ca94cde80a49cdc056a.tar.zst dexon-solidity-4ee2114127f87b08b76b3ca94cde80a49cdc056a.zip |
Make the Solidity repository standalone.
This commit is the culmination of several months of work to decouple Solidity from the webthree-umbrella so that it can be developed in parallel with cpp-ethereum (the Ethereum C++ runtime) and so that even for the Solidity unit-tests there is no hard-dependency onto the C++ runtime.
The Tests-over-IPC refactoring was a major step in the same process which was already committed.
This commit contains the following changes:
- A subset of the CMake functionality in webthree-helpers was extracted and tailored for Solidity into ./cmake. Further cleanup is certainly possible.
- A subset of the libdevcore functionality in libweb3core was extracted and tailored for Solidity into ./libdevcore. Further cleanup is certainly possible
- The gas price constants in EVMSchedule were orphaned into libevmasm.
- Some other refactorings and cleanups were made to sever unnecessary EVM dependencies in the Solidity unit-tests.
- TravisCI and Appveyor support was added, covering builds and running of the unit-tests (Linux and macOS only for now)
- A bug-fix was made to get the Tests-over-IPC running on macOS.
- There are still reliability issues in the unit-tests, which need immediate attention. The Travis build has been flipped to run the unit-tests 5 times, to try to flush these out.
- The Emscripten automation which was previously in webthree-umbrella was merged into the TravisCI automation here.
- The development ZIP deployment step has been commented out, but we will want to read that ONLY for release branch.
Further iteration on these changes will definitely be needed, but I feel these have got to sufficient maturity than holding them back further isn't winning us anything. It is go time :-)
Diffstat (limited to 'cmake/EthExecutableHelper.cmake')
-rw-r--r-- | cmake/EthExecutableHelper.cmake | 185 |
1 files changed, 185 insertions, 0 deletions
diff --git a/cmake/EthExecutableHelper.cmake b/cmake/EthExecutableHelper.cmake new file mode 100644 index 00000000..921b37e7 --- /dev/null +++ b/cmake/EthExecutableHelper.cmake @@ -0,0 +1,185 @@ +# +# this function requires the following variables to be specified: +# ETH_VERSION +# PROJECT_NAME +# PROJECT_VERSION +# PROJECT_COPYRIGHT_YEAR +# PROJECT_VENDOR +# PROJECT_DOMAIN_SECOND +# PROJECT_DOMAIN_FIRST +# SRC_LIST +# HEADERS +# +# params: +# ICON +# + +macro(eth_add_executable EXECUTABLE) + set (extra_macro_args ${ARGN}) + set (options) + set (one_value_args ICON) + set (multi_value_args UI_RESOURCES WIN_RESOURCES) + cmake_parse_arguments (ETH_ADD_EXECUTABLE "${options}" "${one_value_args}" "${multi_value_args}" "${extra_macro_args}") + + if (APPLE) + + add_executable(${EXECUTABLE} MACOSX_BUNDLE ${SRC_LIST} ${HEADERS} ${ETH_ADD_EXECUTABLE_UI_RESOURCES}) + set(PROJECT_VERSION "${ETH_VERSION}") + set(MACOSX_BUNDLE_INFO_STRING "${PROJECT_NAME} ${PROJECT_VERSION}") + set(MACOSX_BUNDLE_BUNDLE_VERSION "${PROJECT_NAME} ${PROJECT_VERSION}") + set(MACOSX_BUNDLE_LONG_VERSION_STRING "${PROJECT_NAME} ${PROJECT_VERSION}") + set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION}") + set(MACOSX_BUNDLE_COPYRIGHT "${PROJECT_COPYRIGHT_YEAR} ${PROJECT_VENDOR}") + set(MACOSX_BUNDLE_GUI_IDENTIFIER "${PROJECT_DOMAIN_SECOND}.${PROJECT_DOMAIN_FIRST}") + set(MACOSX_BUNDLE_BUNDLE_NAME ${EXECUTABLE}) + set(MACOSX_BUNDLE_ICON_FILE ${ETH_ADD_EXECUTABLE_ICON}) + set_target_properties(${EXECUTABLE} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/EthereumMacOSXBundleInfo.plist.in") + set_source_files_properties(${EXECUTABLE} PROPERTIES MACOSX_PACKAGE_LOCATION MacOS) + set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${MACOSX_BUNDLE_ICON_FILE}.icns" PROPERTIES MACOSX_PACKAGE_LOCATION Resources) + + else () + add_executable(${EXECUTABLE} ${ETH_ADD_EXECUTABLE_UI_RESOURCES} ${ETH_ADD_EXECUTABLE_WIN_RESOURCES} ${SRC_LIST} ${HEADERS}) + endif() + +endmacro() + +macro(eth_simple_add_executable EXECUTABLE) + add_executable(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) + + # Apple does not support statically linked binaries on OS X. That means + # that we can only statically link against our external libraries, but + # we cannot statically link against the C++ runtime libraries and other + # platform libraries (as is possible on Windows and Alpine Linux) to produce + # an entirely transportable binary. + # + # See https://developer.apple.com/library/mac/qa/qa1118/_index.html for more info. + # + # GLIBC also appears not to support static linkage too, which probably means that + # Debian and Ubuntu will only be able to do partially-statically linked + # executables too, just like OS X. + # + # For OS X, at the time of writing, we are left with the following dynamically + # linked dependencies, of which curl and libz might still be fixable: + # + # /usr/lib/libc++.1.dylib + # /usr/lib/libSystem.B.dylib + # /usr/lib/libcurl.4.dylib + # /usr/lib/libz.1.dylib + # + if (STATIC_LINKING AND NOT APPLE) + set(CMAKE_EXE_LINKER_FLAGS "-static ${CMAKE_EXE_LINKER_FLAGS}") + set_target_properties(${EXECUTABLE} PROPERTIES LINK_SEARCH_START_STATIC 1) + set_target_properties(${EXECUTABLE} PROPERTIES LINK_SEARCH_END_STATIC 1) + endif() +endmacro() + +macro(eth_copy_dll EXECUTABLE DLL) + # dlls must be unsubstitud list variable (without ${}) in format + # optimized;path_to_dll.dll;debug;path_to_dlld.dll + if(DEFINED MSVC) + list(GET ${DLL} 1 DLL_RELEASE) + list(GET ${DLL} 3 DLL_DEBUG) + add_custom_command(TARGET ${EXECUTABLE} + PRE_BUILD + COMMAND ${CMAKE_COMMAND} ARGS + -DDLL_RELEASE="${DLL_RELEASE}" + -DDLL_DEBUG="${DLL_DEBUG}" + -DCONF="$<CONFIGURATION>" + -DDESTINATION="${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}" + -P "${ETH_SCRIPTS_DIR}/copydlls.cmake" + ) + endif() +endmacro() + +macro(eth_copy_dlls EXECUTABLE) + foreach(dll ${ARGN}) + eth_copy_dll(${EXECUTABLE} ${dll}) + endforeach(dll) +endmacro() + + +macro(eth_install_executable EXECUTABLE) + + if (APPLE) + + # TODO - Why is this different than the branch Linux below, which has the RUNTIME keyword too? + install(TARGETS ${EXECUTABLE} DESTINATION bin) + + elseif (DEFINED MSVC) + + set(COMPONENT ${EXECUTABLE}) + + install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Debug/" + DESTINATION . + CONFIGURATIONS Debug + COMPONENT ${COMPONENT} + ) + + install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Release/" + DESTINATION . + CONFIGURATIONS Release + COMPONENT ${COMPONENT} + ) + + install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/" + DESTINATION . + CONFIGURATIONS RelWithDebInfo + COMPONENT ${COMPONENT} + ) + + else() + install( TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin) + endif () + +endmacro() + +macro (eth_name KEY VALUE) + if (NOT (APPLE OR WIN32)) + string(TOLOWER ${VALUE} LVALUE ) + set(${KEY} ${LVALUE}) + else() + set(${KEY} ${VALUE}) + endif() +endmacro() + +macro(jsonrpcstub_client_create SPEC CLIENTNAME CLIENTDIR CLIENTFILENAME) + if (ETH_JSON_RPC_STUB) + add_custom_target(${SPEC}stub) + add_custom_command( + TARGET ${SPEC}stub + POST_BUILD + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${SPEC}" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ${CMAKE_COMMAND} -DETH_SPEC_PATH="${CMAKE_CURRENT_SOURCE_DIR}/${SPEC}" -DETH_SOURCE_DIR="${CMAKE_SOURCE_DIR}" -DETH_CMAKE_DIR="${ETH_CMAKE_DIR}" + -DETH_CLIENT_DIR="${CLIENTDIR}" + -DETH_CLIENT_NAME=${CLIENTNAME} + -DETH_CLIENT_FILENAME=${CLIENTFILENAME} + -DETH_JSON_RPC_STUB="${ETH_JSON_RPC_STUB}" + -P "${ETH_SCRIPTS_DIR}/jsonrpcstub.cmake" + ) + add_dependencies(${EXECUTABLE} ${SPEC}stub) + endif () +endmacro() + +macro(jsonrpcstub_create SPEC SERVERNAME SERVERDIR SERVERFILENAME CLIENTNAME CLIENTDIR CLIENTFILENAME) + if (ETH_JSON_RPC_STUB) + add_custom_target(${SPEC}stub) + add_custom_command( + TARGET ${SPEC}stub + POST_BUILD + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${SPEC}" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ${CMAKE_COMMAND} -DETH_SPEC_PATH="${CMAKE_CURRENT_SOURCE_DIR}/${SPEC}" -DETH_SOURCE_DIR="${CMAKE_SOURCE_DIR}" -DETH_CMAKE_DIR="${ETH_CMAKE_DIR}" + -DETH_CLIENT_DIR="${CLIENTDIR}" + -DETH_CLIENT_NAME=${CLIENTNAME} + -DETH_CLIENT_FILENAME=${CLIENTFILENAME} + -DETH_SERVER_DIR="${SERVERDIR}" + -DETH_SERVER_NAME=${SERVERNAME} + -DETH_SERVER_FILENAME=${SERVERFILENAME} + -DETH_JSON_RPC_STUB="${ETH_JSON_RPC_STUB}" + -P "${ETH_SCRIPTS_DIR}/jsonrpcstub.cmake" + ) + add_dependencies(${EXECUTABLE} ${SPEC}stub) + endif () +endmacro() + |