solidity/CMakeLists.txt

96 lines
3.0 KiB
CMake
Raw Normal View History

cmake_minimum_required(VERSION 3.13.0)
2015-08-19 12:57:25 +00:00
2023-07-18 20:15:14 +00:00
set(ETH_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}/cmake" CACHE PATH "The path to the cmake directory")
2015-08-19 12:57:25 +00:00
list(APPEND CMAKE_MODULE_PATH ${ETH_CMAKE_DIR})
# Set the build type, if none was specified.
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
if(EXISTS "${PROJECT_SOURCE_DIR}/.git")
set(DEFAULT_BUILD_TYPE "RelWithDebInfo")
else()
set(DEFAULT_BUILD_TYPE "Release")
endif()
set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel" FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "RelWithDebInfo" "MinSizeRel")
endif()
2017-08-28 15:04:41 +00:00
include(EthToolchains)
# Set cmake_policies
include(EthPolicy)
eth_policy()
# project name and version should be set after cmake_policy CMP0048
2023-07-18 18:06:45 +00:00
set(PROJECT_VERSION "0.8.22")
# OSX target needed in order to support std::visit
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14")
project(solidity VERSION ${PROJECT_VERSION} LANGUAGES C CXX)
2019-06-06 11:50:43 +00:00
include(TestBigEndian)
TEST_BIG_ENDIAN(IS_BIG_ENDIAN)
if (IS_BIG_ENDIAN)
message(FATAL_ERROR "${PROJECT_NAME} currently does not support big endian systems.")
endif()
2017-08-22 20:50:03 +00:00
option(SOLC_LINK_STATIC "Link solc executable statically on supported platforms" OFF)
option(SOLC_STATIC_STDLIBS "Link solc against static versions of libgcc and libstdc++ on supported platforms" OFF)
option(STRICT_Z3_VERSION "Use the latest version of Z3" ON)
option(PEDANTIC "Enable extra warnings and pedantic build flags. Treat all warnings as errors." ON)
option(PROFILE_OPTIMIZER_STEPS "Output performance metrics for the optimiser steps." OFF)
2017-08-22 20:50:03 +00:00
# Setup cccache.
include(EthCcache)
# Let's find our dependencies
2015-08-19 12:57:25 +00:00
include(EthDependencies)
include(fmtlib)
include(jsoncpp)
2021-01-11 17:14:23 +00:00
include(range-v3)
2018-05-15 13:14:59 +00:00
include_directories(SYSTEM ${JSONCPP_INCLUDE_DIR})
2017-08-22 14:37:27 +00:00
find_package(Threads)
if(NOT PEDANTIC)
message(WARNING "-- Pedantic build flags turned off. Warnings will not make compilation fail. This is NOT recommended in development builds.")
endif()
if (PROFILE_OPTIMIZER_STEPS)
add_definitions(-DPROFILE_OPTIMIZER_STEPS)
endif()
# Figure out what compiler and system are we using
2015-08-19 12:57:25 +00:00
include(EthCompilerSettings)
# Include utils
include(EthUtils)
2015-08-19 12:57:25 +00:00
# Create license.h from LICENSE.txt and template
2017-06-14 10:42:48 +00:00
# Converting to char array is required due to MSVC's string size limit.
file(READ ${PROJECT_SOURCE_DIR}/LICENSE.txt LICENSE_TEXT HEX)
2017-06-14 10:42:48 +00:00
string(REGEX MATCHALL ".." LICENSE_TEXT "${LICENSE_TEXT}")
2017-06-14 12:17:53 +00:00
string(REGEX REPLACE ";" ",\n\t0x" LICENSE_TEXT "${LICENSE_TEXT}")
set(LICENSE_TEXT "0x${LICENSE_TEXT}")
2017-06-14 10:42:48 +00:00
configure_file("${PROJECT_SOURCE_DIR}/cmake/templates/license.h.in" include/license.h)
include(EthOptions)
2015-09-16 13:55:25 +00:00
configure_project(TESTS)
2020-05-18 15:42:24 +00:00
add_subdirectory(libsolutil)
add_subdirectory(liblangutil)
2020-05-18 15:42:24 +00:00
add_subdirectory(libsmtutil)
2016-03-21 18:37:15 +00:00
add_subdirectory(libevmasm)
add_subdirectory(libyul)
add_subdirectory(libsolidity)
2017-09-16 02:50:16 +00:00
add_subdirectory(libsolc)
add_subdirectory(libstdlib)
add_subdirectory(tools)
if (NOT EMSCRIPTEN)
2017-09-16 02:50:16 +00:00
add_subdirectory(solc)
2016-03-21 18:32:42 +00:00
endif()
2015-08-19 12:57:25 +00:00
if (TESTS AND NOT EMSCRIPTEN)
add_subdirectory(test)
endif()