diff --git a/CMakeLists.txt b/CMakeLists.txt index d070ccc1e..3aad38f71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,7 @@ function(createDefaultCacheConfig) set(LANGUAGES OFF CACHE BOOL "Limit build to Serpent/LLL tools") set(VMTRACE OFF CACHE BOOL "VM tracing and run-time checks (useful for cross-implementation VM debugging)") set(PARANOIA OFF CACHE BOOL "Additional run-time checks") + set(JSONRPC ON CACHE BOOL "Build with jsonprc. default on") endfunction() @@ -85,7 +86,7 @@ cmake_policy(SET CMP0015 NEW) createDefaultCacheConfig() configureProject() -message("-- LANGUAGES: ${LANGUAGES}; VMTRACE: ${VMTRACE}; PARANOIA: ${PARANOIA}; HEADLESS: ${HEADLESS}") +message("-- LANGUAGES: ${LANGUAGES}; VMTRACE: ${VMTRACE}; PARANOIA: ${PARANOIA}; HEADLESS: ${HEADLESS}; JSONRPC: ${JSONRPC}") # Default TARGET_PLATFORM to "linux". @@ -107,23 +108,27 @@ include(EthDependencies) createBuildInfo() -add_subdirectory(libdevcore) -add_subdirectory(libevmcore) -add_subdirectory(liblll) -add_subdirectory(libserpent) -add_subdirectory(libsolidity) +# TODO discuss that during PR. are we still using that? + if(NOT APPLE) if(PYTHON_LS) add_subdirectory(libpyserpent) endif() endif() +add_subdirectory(libdevcore) +add_subdirectory(libevmcore) +add_subdirectory(liblll) +add_subdirectory(libserpent) +add_subdirectory(libsolidity) add_subdirectory(lllc) add_subdirectory(solc) add_subdirectory(sc) -if (JSON_RPC_CPP_FOUND) + +if (JSONRPC) add_subdirectory(libweb3jsonrpc) endif() + if (NOT LANGUAGES) add_subdirectory(secp256k1) add_subdirectory(libp2p) @@ -133,6 +138,8 @@ if (NOT LANGUAGES) add_subdirectory(libethcore) add_subdirectory(libevm) add_subdirectory(libethereum) + +# TODO is this 'TODO remove' still valid? # add_subdirectory(libethereumx) # TODO remove add_subdirectory(libwebthree) @@ -141,38 +148,39 @@ if (NOT LANGUAGES) if("x${CMAKE_BUILD_TYPE}" STREQUAL "xDebug") add_subdirectory(exp) endif () + + # TODO check msvc if(NOT ("${TARGET_PLATFORM}" STREQUAL "w64")) add_subdirectory(neth) endif () - if(QTQML) - add_definitions(-DETH_QTQML) - endif() - if(NOT HEADLESS) + # TODO discuss that during PR. are we still using that? + #if(QTQML) + #add_definitions(-DETH_QTQML) + #endif() + + if (NOT HEADLESS) + + # TODO move that somewhere else! if ("${TARGET_PLATFORM}" STREQUAL "w64") cmake_policy(SET CMP0020 NEW) endif () - if (NOT JSON_RPC_CPP_FOUND) - message(FATAL_ERROR "Alethzero requires jsonrpc.") - endif() - + add_subdirectory(libjsqrc) add_subdirectory(libqethereum) - if (NOT JSON_RPC_CPP_FOUND) - message (FATAL_ERROR "AlethZero requires json-rpc-cpp!") - else() - add_subdirectory(alethzero) - endif() + add_subdirectory(alethzero) add_subdirectory(third) add_subdirectory(mix) - if(QTQML) + + # TODO discuss that during PR. are we still using that? + #if(QTQML) #add_subdirectory(iethxi) #add_subdirectory(walleth) // resurect once we want to submit ourselves to QML. - endif() + #endif() + endif() endif() - enable_testing() add_test(NAME alltests WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test COMMAND testeth) diff --git a/alethzero/CMakeLists.txt b/alethzero/CMakeLists.txt index 07500390b..47d1f73e8 100644 --- a/alethzero/CMakeLists.txt +++ b/alethzero/CMakeLists.txt @@ -1,4 +1,9 @@ -cmake_policy(SET CMP0015 OLD) +cmake_policy(SET CMP0015 NEW) +# this policy was introduced in cmake 3.0 +# remove if, once 3.0 will be used on unix +if (APPLE) + cmake_policy(SET CMP0043 OLD) +endif() set(CMAKE_INCLUDE_CURRENT_DIR ON) aux_source_directory(. SRC_LIST) @@ -36,7 +41,7 @@ endif () add_dependencies(${EXECUTABLE} BuildInfo.h) -qt5_use_modules(${EXECUTABLE} Core) +target_link_libraries(${EXECUTABLE} Qt5::Core) target_link_libraries(${EXECUTABLE} ${JSONCPP_LIBRARIES}) target_link_libraries(${EXECUTABLE} webthree) target_link_libraries(${EXECUTABLE} qethereum) @@ -57,7 +62,7 @@ if (APPLE) # First have qt5 install plugins and frameworks # replace CMAKE_PREFIX_PATH with QT_PATH ? add_custom_command(TARGET ${EXECUTABLE} POST_BUILD - COMMAND ${CMAKE_PREFIX_PATH}/bin/macdeployqt ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${EXECUTABLE}.app + COMMAND ${CMAKE_DEPENDENCY_INSTALL_DIR}/bin/macdeployqt ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${EXECUTABLE}.app WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) # This tool and next will inspect linked libraries in order to determine which dependencies are required diff --git a/cmake/EthCompilerSettings.cmake b/cmake/EthCompilerSettings.cmake index d821067a8..677467bea 100644 --- a/cmake/EthCompilerSettings.cmake +++ b/cmake/EthCompilerSettings.cmake @@ -4,7 +4,12 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wno-unknown-pragmas -Wextra -DSHAREDLIB -fPIC") + set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DETH_DEBUG") + set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG -DETH_RELEASE") + set(CMAKE_CXX_FLAGS_RELEASE "-O4 -DNDEBUG -DETH_RELEASE") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DETH_DEBUG") set(ETH_SHARED 1) + execute_process( COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) if (NOT (GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7)) @@ -14,6 +19,10 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wno-unknown-pragmas -Wextra -DSHAREDLIB -fPIC") + set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DETH_DEBUG") + set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG -DETH_RELEASE") + set(CMAKE_CXX_FLAGS_RELEASE "-O4 -DNDEBUG -DETH_RELEASE") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DETH_DEBUG") set(ETH_SHARED 1) elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") @@ -28,10 +37,3 @@ else () message(FATAL_ERROR "Your C++ compiler does not support C++11. You have ${CMAKE_CXX_COMPILER_ID}") endif () -# Initialize CXXFLAGS -# CMAKE_CXX_FLAGS was set before -set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DETH_DEBUG") -set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG -DETH_RELEASE") -set(CMAKE_CXX_FLAGS_RELEASE "-O4 -DNDEBUG -DETH_RELEASE") -set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DETH_DEBUG") - diff --git a/cmake/EthDependencies.cmake b/cmake/EthDependencies.cmake index 7c0fe048c..4877b06d5 100644 --- a/cmake/EthDependencies.cmake +++ b/cmake/EthDependencies.cmake @@ -36,12 +36,17 @@ message(" - Jsoncpp lib : ${JSONCPP_LIBRARIES}") # json-rpc-cpp support is currently not mandatory # TODO make headless client optional # TODO get rid of -DETH_JSONRPC -find_package (JsonRpcCpp 0.3.2) -if (JSON_RPC_CPP_FOUND) +if (JSONRPC) + + find_package (JsonRpcCpp 0.3.2) + if (NOT JSON_RPC_CPP_FOUND) + message (FATAL_ERROR "JSONRPC 0.3.2. not found") + endif() message (" - json-rpc-cpp header: ${JSON_RPC_CPP_INCLUDE_DIRS}") message (" - json-rpc-cpp lib : ${JSON_RPC_CPP_LIBRARIES}") add_definitions(-DETH_JSONRPC) -endif() + +endif() #JSONRPC # TODO readline package does not yet check for correct version number # TODO make readline package dependent on cmake options @@ -77,27 +82,47 @@ find_package (CURL) message(" - curl header: ${CURL_INCLUDE_DIR}") message(" - curl lib : ${CURL_LIBRARY}") +# do not compile GUI +if (NOT HEADLESS) + +# we need json rpc to build alethzero + if (NOT JSON_RPC_CPP_FOUND) + message (FATAL_ERROR "JSONRPC is required for GUI client") + endif() + +# find all of the Qt packages +# remember to use 'Qt' instead of 'QT', cause unix is case sensitive # TODO make headless client optional -find_package (Qt5Core REQUIRED) -find_package (Qt5Gui REQUIRED) -find_package (Qt5Quick REQUIRED) -find_package (Qt5Qml REQUIRED) -find_package (Qt5Network REQUIRED) -find_package (Qt5Widgets REQUIRED) -find_package (Qt5WebKit REQUIRED) -find_package (Qt5WebKitWidgets REQUIRED) + find_package (Qt5Core REQUIRED) + find_package (Qt5Gui REQUIRED) + find_package (Qt5Quick REQUIRED) + find_package (Qt5Qml REQUIRED) + find_package (Qt5Network REQUIRED) + find_package (Qt5Widgets REQUIRED) + find_package (Qt5WebKit REQUIRED) + find_package (Qt5WebKitWidgets REQUIRED) -if (WIN32) - # TODO hanlde other msvc versions or it will fail find them +endif() #HEADLESS + +# use multithreaded boost libraries, with -mt suffix +set(Boost_USE_MULTITHREADED ON) + +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + +# TODO hanlde other msvc versions or it will fail find them set(Boost_COMPILER -vc120) +# use static boost libraries *.lib set(Boost_USE_STATIC_LIBS ON) - set(Boost_USE_MULTITHREADED ON) -elseif(APPLE) + +elseif (APPLE) + +# use static boost libraries *.a set(Boost_USE_STATIC_LIBS ON) - set(Boost_USE_MULTITHREADED ON) -elseif(UNIX) + +elseif (UNIX) +# use dynamic boost libraries .dll set(Boost_USE_STATIC_LIBS OFF) - set(Boost_USE_MULTITHREADED ON) + endif() find_package(Boost 1.54.0 REQUIRED COMPONENTS thread date_time system regex chrono filesystem unit_test_framework) diff --git a/libdevcore/CMakeLists.txt b/libdevcore/CMakeLists.txt index 06cbe850c..b1a21470f 100644 --- a/libdevcore/CMakeLists.txt +++ b/libdevcore/CMakeLists.txt @@ -1,4 +1,11 @@ cmake_policy(SET CMP0015 OLD) +# this policy was introduced in cmake 3.0 +# remove if, once 3.0 will be used on unix +if (APPLE) + # old policy do not use MACOSX_RPATH + cmake_policy(SET CMP0042 OLD) +endif() + set(CMAKE_AUTOMOC OFF) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTATICLIB") diff --git a/libdevcrypto/CMakeLists.txt b/libdevcrypto/CMakeLists.txt index d2db758af..059cae7f9 100644 --- a/libdevcrypto/CMakeLists.txt +++ b/libdevcrypto/CMakeLists.txt @@ -1,4 +1,10 @@ cmake_policy(SET CMP0015 OLD) +# this policy was introduced in cmake 3.0 +# remove if, once 3.0 will be used on unix +if (APPLE) + # old policy do not use MACOSX_RPATH + cmake_policy(SET CMP0042 OLD) +endif() set(CMAKE_AUTOMOC OFF) aux_source_directory(. SRC_LIST) diff --git a/libethcore/CMakeLists.txt b/libethcore/CMakeLists.txt index 869b6092b..b2e90a622 100644 --- a/libethcore/CMakeLists.txt +++ b/libethcore/CMakeLists.txt @@ -1,4 +1,10 @@ cmake_policy(SET CMP0015 NEW) +# this policy was introduced in cmake 3.0 +# remove if, once 3.0 will be used on unix +if (APPLE) + # old policy do not use MACOSX_RPATH + cmake_policy(SET CMP0042 OLD) +endif() set(CMAKE_AUTOMOC OFF) aux_source_directory(. SRC_LIST) diff --git a/libethereum/CMakeLists.txt b/libethereum/CMakeLists.txt index ac5bd7136..40c53a8a5 100644 --- a/libethereum/CMakeLists.txt +++ b/libethereum/CMakeLists.txt @@ -1,4 +1,10 @@ -cmake_policy(SET CMP0015 OLD) +cmake_policy(SET CMP0015 NEW) +# this policy was introduced in cmake 3.0 +# remove if, once 3.0 will be used on unix +if (APPLE) + # old policy do not use MACOSX_RPATH + cmake_policy(SET CMP0042 OLD) +endif() set(CMAKE_AUTOMOC OFF) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTATICLIB") diff --git a/libevm/CMakeLists.txt b/libevm/CMakeLists.txt index 717904912..a4a8c4f3c 100644 --- a/libevm/CMakeLists.txt +++ b/libevm/CMakeLists.txt @@ -1,4 +1,10 @@ cmake_policy(SET CMP0015 NEW) +# this policy was introduced in cmake 3.0 +# remove if, once 3.0 will be used on unix +if (APPLE) + # old policy do not use MACOSX_RPATH + cmake_policy(SET CMP0042 OLD) +endif() set(CMAKE_AUTOMOC OFF) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTATICLIB") diff --git a/libevmcore/CMakeLists.txt b/libevmcore/CMakeLists.txt index 0f71dcd40..737df945b 100644 --- a/libevmcore/CMakeLists.txt +++ b/libevmcore/CMakeLists.txt @@ -1,4 +1,10 @@ cmake_policy(SET CMP0015 NEW) +# this policy was introduced in cmake 3.0 +# remove if, once 3.0 will be used on unix +if (APPLE) + # old policy do not use MACOSX_RPATH + cmake_policy(SET CMP0042 OLD) +endif() set(CMAKE_AUTOMOC OFF) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTATICLIB") diff --git a/libjsqrc/CMakeLists.txt b/libjsqrc/CMakeLists.txt index b8beec2ff..9533ddd1a 100644 --- a/libjsqrc/CMakeLists.txt +++ b/libjsqrc/CMakeLists.txt @@ -1,4 +1,9 @@ cmake_policy(SET CMP0015 NEW) +# this policy was introduced in cmake 3.0 +# remove if, once 3.0 will be used on unix +if (APPLE) + cmake_policy(SET CMP0043 OLD) +endif() set(CMAKE_AUTOMOC OFF) qt5_add_resources(JSQRC js.qrc) diff --git a/liblll/CMakeLists.txt b/liblll/CMakeLists.txt index e2c000010..908b8caf3 100644 --- a/liblll/CMakeLists.txt +++ b/liblll/CMakeLists.txt @@ -1,4 +1,10 @@ cmake_policy(SET CMP0015 NEW) +# this policy was introduced in cmake 3.0 +# remove if, once 3.0 will be used on unix +if (APPLE) + # old policy do not use MACOSX_RPATH + cmake_policy(SET CMP0042 OLD) +endif() set(CMAKE_AUTOMOC OFF) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTATICLIB") diff --git a/libp2p/CMakeLists.txt b/libp2p/CMakeLists.txt index e354a1c65..5ace09dda 100644 --- a/libp2p/CMakeLists.txt +++ b/libp2p/CMakeLists.txt @@ -1,4 +1,10 @@ cmake_policy(SET CMP0015 NEW) +# this policy was introduced in cmake 3.0 +# remove if, once 3.0 will be used on unix +if (APPLE) + # old policy do not use MACOSX_RPATH + cmake_policy(SET CMP0042 OLD) +endif() set(CMAKE_AUTOMOC OFF) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTATICLIB") diff --git a/libqethereum/CMakeLists.txt b/libqethereum/CMakeLists.txt index 56e0ba94a..9bc8c5de8 100644 --- a/libqethereum/CMakeLists.txt +++ b/libqethereum/CMakeLists.txt @@ -1,4 +1,11 @@ -cmake_policy(SET CMP0015 OLD) +cmake_policy(SET CMP0015 NEW) +# this policy was introduced in cmake 3.0 +# remove if, once 3.0 will be used on unix +if (APPLE) + # old policy do not use MACOSX_RPATH + cmake_policy(SET CMP0042 OLD) + cmake_policy(SET CMP0043 OLD) +endif() set(CMAKE_INCLUDE_CURRENT_DIR ON) aux_source_directory(. SRC_LIST) diff --git a/libserpent/CMakeLists.txt b/libserpent/CMakeLists.txt index 365b1bc9e..4d4a25e58 100644 --- a/libserpent/CMakeLists.txt +++ b/libserpent/CMakeLists.txt @@ -1,4 +1,10 @@ cmake_policy(SET CMP0015 NEW) +# this policy was introduced in cmake 3.0 +# remove if, once 3.0 will be used on unix +if (APPLE) + # old policy do not use MACOSX_RPATH + cmake_policy(SET CMP0042 OLD) +endif() set(CMAKE_AUTOMOC OFF) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTATICLIB") diff --git a/libsolidity/CMakeLists.txt b/libsolidity/CMakeLists.txt index 895b22ae0..ad93609f0 100644 --- a/libsolidity/CMakeLists.txt +++ b/libsolidity/CMakeLists.txt @@ -1,4 +1,10 @@ cmake_policy(SET CMP0015 NEW) +# this policy was introduced in cmake 3.0 +# remove if, once 3.0 will be used on unix +if (APPLE) + # old policy do not use MACOSX_RPATH + cmake_policy(SET CMP0042 OLD) +endif() set(CMAKE_AUTOMOC OFF) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTATICLIB") diff --git a/libweb3jsonrpc/CMakeLists.txt b/libweb3jsonrpc/CMakeLists.txt index 133471d18..5ddbc186f 100644 --- a/libweb3jsonrpc/CMakeLists.txt +++ b/libweb3jsonrpc/CMakeLists.txt @@ -1,4 +1,10 @@ -cmake_policy(SET CMP0015 OLD) +cmake_policy(SET CMP0015 NEW) +# this policy was introduced in cmake 3.0 +# remove if, once 3.0 will be used on unix +if (APPLE) + # old policy do not use MACOSX_RPATH + cmake_policy(SET CMP0042 OLD) +endif() set(CMAKE_AUTOMOC OFF) aux_source_directory(. SRC_LIST) diff --git a/libwebthree/CMakeLists.txt b/libwebthree/CMakeLists.txt index 09fe7f736..661786d1a 100644 --- a/libwebthree/CMakeLists.txt +++ b/libwebthree/CMakeLists.txt @@ -1,4 +1,10 @@ -cmake_policy(SET CMP0015 OLD) +cmake_policy(SET CMP0015 NEW) +# this policy was introduced in cmake 3.0 +# remove if, once 3.0 will be used on unix +if (APPLE) + # old policy do not use MACOSX_RPATH + cmake_policy(SET CMP0042 OLD) +endif() set(CMAKE_AUTOMOC OFF) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTATICLIB") diff --git a/libwhisper/CMakeLists.txt b/libwhisper/CMakeLists.txt index 3ab2f6097..89650db88 100644 --- a/libwhisper/CMakeLists.txt +++ b/libwhisper/CMakeLists.txt @@ -1,4 +1,10 @@ -cmake_policy(SET CMP0015 OLD) +cmake_policy(SET CMP0015 NEW) +# this policy was introduced in cmake 3.0 +# remove if, once 3.0 will be used on unix +if (APPLE) + # old policy do not use MACOSX_RPATH + cmake_policy(SET CMP0042 OLD) +endif() set(CMAKE_AUTOMOC OFF) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTATICLIB") @@ -30,4 +36,4 @@ target_link_libraries(${EXECUTABLE} p2p) target_link_libraries(${EXECUTABLE} secp256k1) install( TARGETS ${EXECUTABLE} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib ) -install( FILES ${HEADERS} DESTINATION include/${EXECUTABLE} ) \ No newline at end of file +install( FILES ${HEADERS} DESTINATION include/${EXECUTABLE} ) diff --git a/mix/CMakeLists.txt b/mix/CMakeLists.txt index bdb682a09..3980f5642 100644 --- a/mix/CMakeLists.txt +++ b/mix/CMakeLists.txt @@ -1,15 +1,20 @@ +cmake_policy(SET CMP0015 NEW) +# this policy was introduced in cmake 3.0 +# remove if, once 3.0 will be used on unix +if (APPLE) + cmake_policy(SET CMP0043 OLD) +endif() + set(CMAKE_INCLUDE_CURRENT_DIR ON) aux_source_directory(. SRC_LIST) include_directories(..) -#qt5_wrap_ui(ui_Main.h Main.ui) - qt5_add_resources(UI_RESOURCES qml.qrc) # Set name of binary and add_executable() file(GLOB HEADERS "*.h") if (APPLE) - set(EXECUTEABLE mix) + set(EXECUTABLE mix) set(BIN_INSTALL_DIR ".") set(DOC_INSTALL_DIR ".") @@ -20,48 +25,48 @@ if (APPLE) 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 ${EXECUTEABLE}) + set(MACOSX_BUNDLE_BUNDLE_NAME ${EXECUTABLE}) set(MACOSX_BUNDLE_ICON_FILE mix) include(BundleUtilities) - add_executable(${EXECUTEABLE} MACOSX_BUNDLE ${SRC_LIST} ${HEADERS} ${UI_RESOURCES}) - set_target_properties(${EXECUTEABLE} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/EthereumMacOSXBundleInfo.plist.in") - SET_SOURCE_FILES_PROPERTIES(${EXECUTEABLE} PROPERTIES MACOSX_PACKAGE_LOCATION MacOS) + add_executable(${EXECUTABLE} MACOSX_BUNDLE ${SRC_LIST} ${HEADERS} ${UI_RESOURCES}) + 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(${MACOSX_BUNDLE_ICON_FILE}.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") else () - set(EXECUTEABLE mix) - add_executable(${EXECUTEABLE} ${SRC_LIST} ${HEADERS} ${UI_RESOURCES}) + set(EXECUTABLE mix) + add_executable(${EXECUTABLE} ${SRC_LIST} ${HEADERS} ${UI_RESOURCES}) endif () -target_link_libraries(${EXECUTEABLE} Qt5::Core) -target_link_libraries(${EXECUTEABLE} Qt5::Gui) -target_link_libraries(${EXECUTEABLE} webthree) -target_link_libraries(${EXECUTEABLE} qethereum) -target_link_libraries(${EXECUTEABLE} ethereum) -target_link_libraries(${EXECUTEABLE} evm) -target_link_libraries(${EXECUTEABLE} ethcore) -target_link_libraries(${EXECUTEABLE} devcrypto) -target_link_libraries(${EXECUTEABLE} secp256k1) -target_link_libraries(${EXECUTEABLE} serpent) -target_link_libraries(${EXECUTEABLE} lll) -target_link_libraries(${EXECUTEABLE} solidity) -target_link_libraries(${EXECUTEABLE} evmcore) -target_link_libraries(${EXECUTEABLE} devcore) -target_link_libraries(${EXECUTEABLE} web3jsonrpc) -target_link_libraries(${EXECUTEABLE} jsqrc) +target_link_libraries(${EXECUTABLE} Qt5::Core) +target_link_libraries(${EXECUTABLE} Qt5::Gui) +target_link_libraries(${EXECUTABLE} webthree) +target_link_libraries(${EXECUTABLE} qethereum) +target_link_libraries(${EXECUTABLE} ethereum) +target_link_libraries(${EXECUTABLE} evm) +target_link_libraries(${EXECUTABLE} ethcore) +target_link_libraries(${EXECUTABLE} devcrypto) +target_link_libraries(${EXECUTABLE} secp256k1) +target_link_libraries(${EXECUTABLE} serpent) +target_link_libraries(${EXECUTABLE} lll) +target_link_libraries(${EXECUTABLE} solidity) +target_link_libraries(${EXECUTABLE} evmcore) +target_link_libraries(${EXECUTABLE} devcore) +target_link_libraries(${EXECUTABLE} web3jsonrpc) +target_link_libraries(${EXECUTABLE} jsqrc) if (APPLE) # First have qt5 install plugins and frameworks - add_custom_command(TARGET ${EXECUTEABLE} POST_BUILD - COMMAND /usr/local/opt/qt5/bin/macdeployqt -qmldir=${CMAKE_CURRENT_SOURCE_DIR}/qml ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${EXECUTEABLE}.app + add_custom_command(TARGET ${EXECUTABLE} POST_BUILD + COMMAND ${CMAKE_DEPENDENCY_INSTALL_DIR}/bin/macdeployqt -qmldir=${CMAKE_CURRENT_SOURCE_DIR}/qml ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${EXECUTABLE}.app WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) # This tool and next will inspect linked libraries in order to determine which dependencies are required if (${CMAKE_CFG_INTDIR} STREQUAL ".") - set(APP_BUNDLE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${EXECUTEABLE}.app") + set(APP_BUNDLE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE}.app") else () - set(APP_BUNDLE_PATH "${CMAKE_CURRENT_BINARY_DIR}/\$ENV{CONFIGURATION}/${EXECUTEABLE}.app") + set(APP_BUNDLE_PATH "${CMAKE_CURRENT_BINARY_DIR}/\$ENV{CONFIGURATION}/${EXECUTABLE}.app") endif () install(CODE " include(BundleUtilities) @@ -76,5 +81,6 @@ if (APPLE) endif () ") else() - install( TARGETS ${EXECUTEABLE} RUNTIME DESTINATION bin) + install( TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin) endif () + diff --git a/neth/CMakeLists.txt b/neth/CMakeLists.txt index 4dd49874d..731f1e4fc 100644 --- a/neth/CMakeLists.txt +++ b/neth/CMakeLists.txt @@ -2,52 +2,31 @@ cmake_policy(SET CMP0015 NEW) aux_source_directory(. SRC_LIST) -include_directories(..) include_directories(${JSON_RPC_CPP_INCLUDE_DIRS}) include_directories(${LEVELDB_INCLUDE_DIR}) +include_directories(..) set(EXECUTABLE neth) add_executable(${EXECUTABLE} ${SRC_LIST}) -target_link_libraries(${EXECUTABLE} webthree) -target_link_libraries(${EXECUTABLE} ethereum) -target_link_libraries(${EXECUTABLE} secp256k1) -target_link_libraries(${EXECUTABLE} gmp) +add_dependencies(${EXECUTABLE} BuildInfo.h) + +target_link_libraries(${EXECUTABLE} ${LEVELDB_LIBRARY}) + if(MINIUPNPC_FOUND) target_link_libraries(${EXECUTABLE} ${MINIUPNPC_LIBRARY}) endif() -target_link_libraries(${EXECUTABLE} ${LEVELDB_LIBRARY}) + if(JSON_RPC_CPP_FOUND) target_link_libraries(${EXECUTABLE} web3jsonrpc) endif() -if ("${TARGET_PLATFORM}" STREQUAL "w64") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") - target_link_libraries(${EXECUTABLE} gcc) - target_link_libraries(${EXECUTABLE} gdi32) - target_link_libraries(${EXECUTABLE} ws2_32) - target_link_libraries(${EXECUTABLE} mswsock) - target_link_libraries(${EXECUTABLE} shlwapi) - target_link_libraries(${EXECUTABLE} iphlpapi) - target_link_libraries(${EXECUTABLE} cryptopp) - target_link_libraries(${EXECUTABLE} ncurses) - target_link_libraries(${EXECUTABLE} form) - target_link_libraries(${EXECUTABLE} boost_system-mt-s) - target_link_libraries(${EXECUTABLE} boost_filesystem-mt-s) - target_link_libraries(${EXECUTABLE} boost_thread_win32-mt-s) - set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS) -elseif (UNIX) - target_link_libraries(${EXECUTABLE} ncurses) - target_link_libraries(${EXECUTABLE} form) -else () - target_link_libraries(${EXECUTABLE} boost_system) - target_link_libraries(${EXECUTABLE} boost_filesystem) - target_link_libraries(${EXECUTABLE} ncurses) - target_link_libraries(${EXECUTABLE} form) - find_package(Threads REQUIRED) - target_link_libraries(${EXECUTABLE} ${CMAKE_THREAD_LIBS_INIT}) -endif () +target_link_libraries(${EXECUTABLE} webthree) +target_link_libraries(${EXECUTABLE} ethereum) +target_link_libraries(${EXECUTABLE} secp256k1) +target_link_libraries(${EXECUTABLE} ncurses) +target_link_libraries(${EXECUTABLE} form) install( TARGETS ${EXECUTABLE} DESTINATION bin ) diff --git a/secp256k1/CMakeLists.txt b/secp256k1/CMakeLists.txt index 230bf76b9..beeee598f 100644 --- a/secp256k1/CMakeLists.txt +++ b/secp256k1/CMakeLists.txt @@ -1,4 +1,10 @@ cmake_policy(SET CMP0015 NEW) +# this policy was introduced in cmake 3.0 +# remove if, once 3.0 will be used on unix +if (APPLE) + # old policy do not use MACOSX_RPATH + cmake_policy(SET CMP0042 OLD) +endif() set(CMAKE_AUTOMOC OFF) set(CMAKE_ASM_COMPILER "yasm") diff --git a/third/CMakeLists.txt b/third/CMakeLists.txt index 383985318..98efde545 100644 --- a/third/CMakeLists.txt +++ b/third/CMakeLists.txt @@ -1,26 +1,21 @@ +cmake_policy(SET CMP0015 NEW) +# this policy was introduced in cmake 3.0 +# remove if, once 3.0 will be used on unix +if (APPLE) + cmake_policy(SET CMP0043 OLD) +endif() + set(CMAKE_INCLUDE_CURRENT_DIR ON) aux_source_directory(. SRC_LIST) include_directories(..) include_directories(${JSON_RPC_CPP_INCLUDE_DIRS}) -if (APPLE) - # Add homebrew path for qt5 - #set(CMAKE_PREFIX_PATH /usr/local/opt/qt5) - #include_directories(/usr/local/opt/qt5/include /usr/local/include) -elseif ("${TARGET_PLATFORM}" STREQUAL "w64") - set(SRC_LIST ${SRC_LIST} ../windows/qt_plugin_import.cpp) - include_directories(/usr/x86_64-w64-mingw32/include /usr/x86_64-w64-mingw32/include/QtCore /usr/x86_64-w64-mingw32/include/QtGui /usr/x86_64-w64-mingw32/include/QtQuick /usr/x86_64-w64-mingw32/include/QtQml /usr/x86_64-w64-mingw32/include/QtNetwork /usr/x86_64-w64-mingw32/include/QtWidgets /usr/x86_64-w64-mingw32/include/QtWebKit /usr/x86_64-w64-mingw32/include/QtWebKitWidgets) -elseif (UNIX) - set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ";$ENV{QTDIR}/lib/cmake") -endif () - - qt5_wrap_ui(ui_Main.h Main.ui) # Set name of binary and add_executable() file(GLOB HEADERS "*.h") if (APPLE) - set(EXECUTEABLE Third) + set(EXECUTABLE Third) set(BIN_INSTALL_DIR ".") set(DOC_INSTALL_DIR ".") @@ -31,34 +26,47 @@ if (APPLE) 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 ${EXECUTEABLE}) + set(MACOSX_BUNDLE_BUNDLE_NAME ${EXECUTABLE}) set(MACOSX_BUNDLE_ICON_FILE third) include(BundleUtilities) - add_executable(${EXECUTEABLE} MACOSX_BUNDLE third.icns Main.ui ${SRC_LIST} ${HEADERS}) - set_target_properties(${EXECUTEABLE} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/EthereumMacOSXBundleInfo.plist.in") - SET_SOURCE_FILES_PROPERTIES(${EXECUTEABLE} PROPERTIES MACOSX_PACKAGE_LOCATION MacOS) + add_executable(${EXECUTABLE} MACOSX_BUNDLE third.icns Main.ui ${SRC_LIST} ${HEADERS}) + 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(${MACOSX_BUNDLE_ICON_FILE}.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") else () - set(EXECUTEABLE third) - add_executable(${EXECUTEABLE} Main.ui ${SRC_LIST} ${HEADERS}) + set(EXECUTABLE third) + add_executable(${EXECUTABLE} Main.ui ${SRC_LIST} ${HEADERS}) endif () -qt5_use_modules(${EXECUTEABLE} Core)# Gui Widgets Network WebKit WebKitWidgets) -target_link_libraries(${EXECUTEABLE} webthree qethereum ethereum evm ethcore secp256k1 gmp serpent lll evmcore devcore web3jsonrpc jsqrc) +add_dependencies(${EXECUTABLE} BuildInfo.h) + +target_link_libraries(${EXECUTABLE} Qt5::Core) +target_link_libraries(${EXECUTABLE} webthree) +target_link_libraries(${EXECUTABLE} qethereum) +target_link_libraries(${EXECUTABLE} ethereum) +target_link_libraries(${EXECUTABLE} evm) +target_link_libraries(${EXECUTABLE} ethcore) +target_link_libraries(${EXECUTABLE} secp256k1) +target_link_libraries(${EXECUTABLE} serpent) +target_link_libraries(${EXECUTABLE} lll) +target_link_libraries(${EXECUTABLE} evmcore) +target_link_libraries(${EXECUTABLE} devcore) +target_link_libraries(${EXECUTABLE} web3jsonrpc) +target_link_libraries(${EXECUTABLE} jsqrc) if (APPLE) # First have qt5 install plugins and frameworks - add_custom_command(TARGET ${EXECUTEABLE} POST_BUILD - COMMAND ${CMAKE_PREFIX_PATH}/bin/macdeployqt ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${EXECUTEABLE}.app + add_custom_command(TARGET ${EXECUTABLE} POST_BUILD + COMMAND ${CMAKE_DEPENDENCY_INSTALL_DIR}/bin/macdeployqt ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${EXECUTABLE}.app WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) # This tool and next will inspect linked libraries in order to determine which dependencies are required if (${CMAKE_CFG_INTDIR} STREQUAL ".") - set(APP_BUNDLE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${EXECUTEABLE}.app") + set(APP_BUNDLE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE}.app") else () - set(APP_BUNDLE_PATH "${CMAKE_CURRENT_BINARY_DIR}/\$ENV{CONFIGURATION}/${EXECUTEABLE}.app") + set(APP_BUNDLE_PATH "${CMAKE_CURRENT_BINARY_DIR}/\$ENV{CONFIGURATION}/${EXECUTABLE}.app") endif () install(CODE " include(BundleUtilities) @@ -72,23 +80,7 @@ if (APPLE) file(REMOVE \${LINGER_RM}) endif () ") -elseif ("${TARGET_PLATFORM}" STREQUAL "w64") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-keep-inline-dllexport -static-libgcc -static-libstdc++ -static") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-s -Wl,-subsystem,windows -mthreads -L/usr/x86_64-w64-mingw32/plugins/platforms") - target_link_libraries(${EXECUTEABLE} gcc) - target_link_libraries(${EXECUTEABLE} mingw32 qtmain mswsock iphlpapi qwindows shlwapi Qt5PlatformSupport opengl32 gdi32 comdlg32 oleaut32 imm32 winmm ole32 uuid ws2_32) - target_link_libraries(${EXECUTEABLE} boost_system-mt-s) - target_link_libraries(${EXECUTEABLE} boost_filesystem-mt-s) - target_link_libraries(${EXECUTEABLE} boost_thread_win32-mt-s) - target_link_libraries(${EXECUTEABLE} crypt32) - target_link_libraries(${EXECUTEABLE} Qt5PlatformSupport) - set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS) -elseif (UNIX) else () - target_link_libraries(${EXECUTEABLE} boost_system) - target_link_libraries(${EXECUTEABLE} boost_filesystem) - find_package(Threads REQUIRED) - target_link_libraries(${EXECUTEABLE} ${CMAKE_THREAD_LIBS_INIT}) - install( TARGETS ${EXECUTEABLE} RUNTIME DESTINATION bin ) + install( TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin) endif ()