-
Notifications
You must be signed in to change notification settings - Fork 81
/
Copy pathCMakeLists.txt
54 lines (40 loc) · 1.92 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
cmake_minimum_required(VERSION 3.4.0)
cmake_policy(SET CMP0042 OLD) # Fix MACOSX_RPATH.
cmake_policy(SET CMP0048 NEW) # Allow VERSION argument in project().
if (POLICY CMP0054)
cmake_policy(SET CMP0054 NEW) # No longer implicitly dereference variables.
endif()
set(CMAKE_CONFIGURATION_TYPES Debug Release RelWithDebInfo)
project(EVMJIT VERSION 0.9.0.2 LANGUAGES CXX C)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
message(STATUS "EVM JIT ${EVMJIT_VERSION_MAJOR}.${EVMJIT_VERSION_MINOR}.${EVMJIT_VERSION_PATCH}")
if (NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64|AMD64")
message(FATAL_ERROR "Target ${CMAKE_SYSTEM_PROCESSOR} not supported -- EVM JIT works only on x86_64 architecture")
endif()
option(EVMJIT_EXAMPLES "Generate build targets for the EVMJIT examples" OFF)
option(EVMJIT_TESTS "Create targets for CTest" OFF)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# Always use Release variant of C++ runtime.
# We don't want to provide Debug variants of all dependencies. Some default
# flags set by CMake must be tweaked.
string(REPLACE "/MDd" "/MD" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
string(REPLACE "/D_DEBUG" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
set_property(GLOBAL PROPERTY DEBUG_CONFIGURATIONS OFF)
else()
set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wextra -Wconversion -Wno-sign-conversion -Wno-unknown-pragmas ${CMAKE_CXX_FLAGS}")
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT SANITIZE)
# Do not allow unresolved symbols in shared library (default on linux)
# unless sanitizer is used (sanity checks produce unresolved function calls)
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
endif()
include(ProjectLLVM)
configure_llvm_project()
add_subdirectory(evmc)
add_subdirectory(libevmjit)
if (EVMJIT_TESTS)
enable_testing()
add_subdirectory(tests)
endif()