diff --git a/CMakeLists.txt b/CMakeLists.txt index 20203b6f9..9a29ecc14 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # cmake global cmake_minimum_required(VERSION 2.8.12) -set(PROJECT_VERSION "0.9.35") +set(PROJECT_VERSION "0.9.36") if (${CMAKE_VERSION} VERSION_GREATER 3.0) cmake_policy(SET CMP0048 NEW) # allow VERSION argument in project() project(ethereum VERSION ${PROJECT_VERSION}) @@ -28,29 +28,124 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") ###################################################################################################### -# user defined, defaults -# Normally, set(...CACHE...) creates cache variables, but does not modify them. -option(VMTRACE "VM tracing and run-time checks (useful for cross-implementation VM debugging)" OFF) -option(PARANOID "Additional run-time checks" OFF) -option(JSONRPC "Build with jsonprc. default on" ON) -option(FATDB "Build with ability to list entries in the Trie. Doubles DB size, slows everything down, but good for looking at state diffs and trie contents." OFF) -option(USENPM "Use npm to recompile ethereum.js if it was changed" OFF) -option(PROFILING "Build in support for profiling" OFF) -option(ROCKSDB "Use rocksdb rather than leveldb" OFF) - -set(BUNDLE "none" CACHE STRING "Predefined bundle of software to build (none, full, user, tests, minimal).") -option(MINER "Build the CLI miner component" ON) -option(ETHKEY "Build the CLI key manager component" ON) -option(SOLIDITY "Build the Solidity language components" ON) -option(SERPENT "Build the Serpent language components" ON) -option(TOOLS "Build the tools components" ON) -option(GUI "Build GUI components (AlethZero, Mix)" ON) -option(TESTS "Build the tests." ON) -option(NOBOOST "No use of boost macros in test functions" OFF) -option(EVMJIT "Build just-in-time compiler for EVM code (requires LLVM)" ON) -option(ETHASHCL "Build in support for GPU mining via OpenCL" ON) -option(JSCONSOLE "Build in javascript console" ON) -option(FRONTIER "Build for Frontier network" OFF) +# note: The value "default" which provides the defaults is just a fake value +# which lets us keep the default values of all build options and is set at +# the beginning of this file. + +# TODO: Abstract into something sensible and move into a function. +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + set(DECENT_PLATFORM OFF) +else () + set(DECENT_PLATFORM ON) +endif () + +#defaults: +set(D_CMAKE_BUILD_TYPE "RelWithDebInfo") +set(D_SERPENT ${DECENT_PLATFORM}) +set(D_SOLIDITY ON) +set(D_USENPM OFF) +set(D_GUI ON) +set(D_TOOLS ON) +set(D_TESTS ON) +set(D_FATDB ON) +set(D_ETHASHCL ON) +set(D_EVMJIT ON) +set(D_JSCONSOLE ON) +set(D_JSONRPC ON) +set(D_VMTRACE OFF) +set(D_PARANOID OFF) +set(D_PROFILING OFF) +set(D_ROCKSDB OFF) +set(D_NOBOOST OFF) +set(D_FRONTIER OFF) +set(D_MINER ON) +set(D_ETHKEY ON) + +if (BUNDLE STREQUAL "minimal") + set(D_SERPENT OFF) + set(D_SOLIDITY OFF) + set(D_USENPM OFF) + set(D_GUI OFF) + set(D_TOOLS ON) + set(D_TESTS OFF) +elseif (BUNDLE STREQUAL "full") + set(D_SERPENT ${DECENT_PLATFORM}) + set(D_SOLIDITY ON) + set(D_USENPM ON) + set(D_GUI ON) + set(D_TOOLS ON) + set(D_TESTS ON) + set(D_FATDB ON) +elseif (BUNDLE STREQUAL "cli") + set(D_SERPENT ${DECENT_PLATFORM}) + set(D_SOLIDITY ON) + set(D_USENPM ON) + set(D_GUI OFF) + set(D_TOOLS ON) + set(D_TESTS ON) + set(D_FATDB ON) +elseif (BUNDLE STREQUAL "core") + set(D_SERPENT OFF) + set(D_SOLIDITY ON) + set(D_USENPM OFF) + set(D_GUI ON) + set(D_TOOLS ON) + set(D_TESTS OFF) + set(D_FATDB ON) +elseif (BUNDLE STREQUAL "tests") + set(D_SERPENT ${DECENT_PLATFORM}) + set(D_SOLIDITY ON) + set(D_USENPM OFF) + set(D_GUI OFF) + set(D_TOOLS OFF) + set(D_TESTS ON) + set(D_FATDB ON) +elseif (BUNDLE STREQUAL "user") + set(D_SERPENT OFF) + set(D_SOLIDITY OFF) + set(D_USENPM OFF) + set(D_GUI ON) + set(D_TOOLS ON) + set(D_TESTS OFF) +elseif (BUNDLE STREQUAL "wallet") + set(D_SERPENT OFF) + set(D_SOLIDITY OFF) + set(D_USENPM OFF) + set(D_GUI OFF) + set(D_TOOLS OFF) + set(D_TESTS OFF) + set(D_ETHKEY ON) + set(D_MINER OFF) + set(D_ETHASHCL ON) +elseif (BUNDLE STREQUAL "miner") + set(D_SERPENT OFF) + set(D_SOLIDITY OFF) + set(D_USENPM OFF) + set(D_GUI OFF) + set(D_TOOLS OFF) + set(D_TESTS OFF) + set(D_ETHKEY OFF) + set(D_MINER ON) + set(D_ETHASHCL ON) +elseif (BUNDLE STREQUAL "release") # release builds + set(D_SERPENT ${DECENT_PLATFORM}) + set(D_SOLIDITY ON) + set(D_USENPM OFF) + set(D_GUI ON) + set(D_TOOLS ON) + set(D_TESTS OFF) + set(D_FATDB OFF) + set(D_ETHASHCL ON) + set(D_EVMJIT ON) + set(D_JSCONSOLE ON) + set(D_JSONRPC ON) + set(D_FRONTIER ON) + set(D_CMAKE_BUILD_TYPE "Release") +endif () + +if ("${CMAKE_BUILD_TYPE}" STREQUAL "") + set(CMAKE_BUILD_TYPE ${D_CMAKE_BUILD_TYPE}) +endif () # propagates CMake configuration options to the compiler function(configureProject) @@ -177,24 +272,11 @@ if (HEADLESS) set(GUI OFF) endif () -# TODO: Abstract into something sensible and move into a function. -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - set(DECENT_PLATFORM OFF) -else () - set(DECENT_PLATFORM ON) -endif () - macro(eth_format_option O) if (${${O}}) set(${O} ON) - else() - set(${O} OFF) - endif() -endmacro() - -macro(eth_format_option_on_decent_platform O) - if (${${O}}) - set(${O} ${DECENT_PLATFORM}) + elseif ("${${O}}" STREQUAL "" AND ${D_${O}}) + set(${O} ON) else() set(${O} OFF) endif() @@ -220,7 +302,7 @@ eth_format_option(ETHKEY) eth_format_option(ETHASHCL) eth_format_option(JSCONSOLE) eth_format_option(FRONTIER) -eth_format_option_on_decent_platform(SERPENT) +eth_format_option(SERPENT) if (JSCONSOLE) set(JSONRPC ON) @@ -231,110 +313,11 @@ if (GUI) endif() # Default CMAKE_BUILD_TYPE to "Release". -set(CMAKE_BUILD_TYPE CACHE STRING "Release") - -# note: The value "default" which provides the defaults is just a fake value -# which lets us keep the default values of all build options and is set at -# the beginning of this file. -if (BUNDLE STREQUAL "minimal") - set(SERPENT OFF) - set(SOLIDITY OFF) - set(USENPM OFF) - set(GUI OFF) - set(TOOLS ON) - set(TESTS OFF) -elseif (BUNDLE STREQUAL "full") - set(SERPENT ${DECENT_PLATFORM}) - set(SOLIDITY ON) - set(USENPM ON) - set(GUI ON) - set(TOOLS ON) - set(TESTS ON) - set(FATDB ON) -elseif (BUNDLE STREQUAL "cli") - set(SERPENT ${DECENT_PLATFORM}) - set(SOLIDITY ON) - set(USENPM ON) - set(GUI OFF) - set(TOOLS ON) - set(TESTS ON) - set(FATDB ON) -elseif (BUNDLE STREQUAL "core") - set(SERPENT OFF) - set(SOLIDITY ON) - set(USENPM OFF) - set(GUI ON) - set(TOOLS ON) - set(TESTS OFF) - set(FATDB ON) -elseif (BUNDLE STREQUAL "tests") - set(SERPENT ${DECENT_PLATFORM}) - set(SOLIDITY ON) - set(USENPM OFF) - set(GUI OFF) - set(TOOLS OFF) - set(TESTS ON) - set(FATDB ON) -elseif (BUNDLE STREQUAL "user") - set(SERPENT OFF) - set(SOLIDITY OFF) - set(USENPM OFF) - set(GUI ON) - set(TOOLS ON) - set(TESTS OFF) -elseif (BUNDLE STREQUAL "wallet") - set(SERPENT OFF) - set(SOLIDITY OFF) - set(USENPM OFF) - set(GUI OFF) - set(TOOLS OFF) - set(TESTS OFF) - set(ETHKEY ON) - set(MINER OFF) - set(ETHASHCL ON) -elseif (BUNDLE STREQUAL "miner") - set(SERPENT OFF) - set(SOLIDITY OFF) - set(USENPM OFF) - set(GUI OFF) - set(TOOLS OFF) - set(TESTS OFF) - set(ETHKEY OFF) - set(MINER ON) - set(ETHASHCL ON) -elseif (BUNDLE STREQUAL "default") # development builds - set(SERPENT ${DECENT_PLATFORM}) - set(SOLIDITY ON) - set(USENPM OFF) - set(GUI ON) - set(TOOLS ON) - set(TESTS ON) - set(FATDB ON) - set(ETHASHCL ON) - set(EVMJIT ON) - set(JSCONSOLE ON) - set(JSONRPC ON) - if ("x${CMAKE_BUILD_TYPE}" STREQUAL "x") - set(CMAKE_BUILD_TYPE "RelWithDebInfo") - endif () -elseif (BUNDLE STREQUAL "release") # release builds - set(SERPENT ${DECENT_PLATFORM}) - set(SOLIDITY ON) - set(USENPM OFF) - set(GUI ON) - set(TOOLS ON) - set(TESTS OFF) - set(FATDB OFF) - set(ETHASHCL ON) - set(EVMJIT ON) - set(JSCONSOLE ON) - set(JSONRPC ON) - set(FRONTIER ON) -endif () +set(CMAKE_BUILD_TYPE CACHE STRING ${D_CMAKE_BUILD_TYPE}) -if ("x${CMAKE_BUILD_TYPE}" STREQUAL "x") - set(CMAKE_BUILD_TYPE "Release") -endif () +#if ("x${CMAKE_BUILD_TYPE}" STREQUAL "x") +# set(CMAKE_BUILD_TYPE ${D_CMAKE_BUILD_TYPE}) +#endif () # Default TARGET_PLATFORM to ${CMAKE_SYSTEM_NAME} # change this once we support cross compiling