From bf138c5d5300b221d4e90cedafb8e3c40933915f Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Wed, 15 Apr 2015 20:00:16 +0200 Subject: [PATCH] cleanup CMakeLists.txt --- CMakeLists.txt | 146 +++++++++++++++++-------------------------------- 1 file changed, 51 insertions(+), 95 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2641f1bda..5342437dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,30 +8,26 @@ project(ethereum) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") - ###################################################################################################### # user defined, defaults # Normally, set(...CACHE...) creates cache variables, but does not modify them. -function(createDefaultCacheConfig) - set(VMTRACE OFF CACHE BOOL "VM tracing and run-time checks (useful for cross-implementation VM debugging)") - set(PARANOID OFF CACHE BOOL "Additional run-time checks") - set(JSONRPC ON CACHE BOOL "Build with jsonprc. default on") - set(FATDB OFF CACHE BOOL "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.") - set(USENPM OFF CACHE BOOL "Use npm to recompile ethereum.js if it was changed") - set(PROFILING OFF CACHE BOOL "Build in support for profiling") - - set(BUNDLE "none" CACHE STRING "Predefined bundle of software to build (none, full, user, tests, minimal).") - set(SOLIDITY ON CACHE BOOL "Build the Solidity language components") - set(SERPENT ON CACHE BOOL "Build the Serpent language components") - set(TOOLS ON CACHE BOOL "Build the tools components") - set(NCURSES ON CACHE BOOL "Build the NCurses components") - set(GUI ON CACHE BOOL "Build GUI components (AlethZero, Mix)") - set(TESTS ON CACHE BOOL "Build the tests.") - set(EVMJIT OFF CACHE BOOL "Build just-in-time compiler for EVM code (requires LLVM)") - set(ETHASHCL OFF CACHE BOOL "Build in support for GPU mining via OpenCL") -endfunction() - +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) + +set(BUNDLE "none" CACHE STRING "Predefined bundle of software to build (none, full, user, tests, minimal).") +option(SOLIDITY "Build the Solidity language components" ON) +option(SERPENT "Build the Serpent language components" ON) +option(TOOLS "Build the tools components" ON) +option(NCURSES "Build the NCurses components" ON) +option(GUI "Build GUI components (AlethZero, Mix)" ON) +option(TESTS "Build the tests." ON) +option(EVMJIT "Build just-in-time compiler for EVM code (requires LLVM)" OFF) +option(ETHASHCL "Build in support for GPU mining via OpenCL" OFF) # propagates CMake configuration options to the compiler function(configureProject) @@ -143,97 +139,57 @@ if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release") endif () endif () -createDefaultCacheConfig() - # Force chromium. set (ETH_HAVE_WEBENGINE 1) -# Normalise build options -# 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 () # Backwards compatibility if (HEADLESS) message("*** WARNING: -DHEADLESS=1 option is DEPRECATED! Use -DBUNDLE=minimal or -DGUI=0") set(BUNDLE "minimal") endif () -if (PARANOID) - set(PARANOID ON) -else () - set(PARANOID OFF) -endif () -if (VMTRACE) - set(VMTRACE ON) -else () - set(VMTRACE OFF) -endif () -if (EVMJIT) - set(EVMJIT ON) -else () - set(EVMJIT OFF) -endif() -if (FATDB) - set(FATDB ON) -else () - set(FATDB OFF) -endif() -if (JSONRPC) - set(JSONRPC ON) -else () - set(JSONRPC OFF) -endif () -if (USENPM) - set(USENPM ON) -else () - set(USENPM OFF) -endif () -if (PROFILING) - set(PROFILING ON) +# TODO: Abstract into something sensible and move into a function. +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + set(DECENT_PLATFORM OFF) else () - set(PROFILING OFF) + 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}) + else() + set(${O} OFF) + endif() +endmacro() + +# Normalise build options +eth_format_option(PARANOID) +eth_format_option(VMTRACE) +eth_format_option(EVMJIT) +eth_format_option(FATDB) +eth_format_option(JSONRPC) +eth_format_option(USENPM) +eth_format_option(PROFILING) +eth_format_option(SOLIDITY) +eth_format_option(GUI) +eth_format_option(TESTS) +eth_format_option(TOOLS) +eth_format_option(ETHASHCL) +eth_format_option_on_decent_platform(SERPENT) +eth_format_option_on_decent_platform(NCURSES) -if (SOLIDITY) - set(SOLIDITY ON) -else () - set(SOLIDITY OFF) -endif() -if (SERPENT) - set(SERPENT ${DECENT_PLATFORM}) -else () - set(SERPENT OFF) -endif() if (GUI) - set(GUI ON) set(JSONRPC ON) -else () - set(GUI OFF) -endif () -if (TESTS) - set(TESTS ON) -else () - set(TESTS OFF) -endif () -if (TOOLS) - set(TOOLS ON) -else () - set(TOOLS OFF) -endif () -if (ETHASHCL) - set(ETHASHCL ON) -else () - set(ETHASHCL OFF) endif() -if (NCURSES) - set(NCURSES ${DECENT_PLATFORM}) -else () - set(NCURSES OFF) -endif () if (BUNDLE STREQUAL "minimal") set(SERPENT OFF)