-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathCMakeLists.txt
99 lines (85 loc) · 2.77 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
cmake_minimum_required(VERSION 2.8.12)
project(AXE)
include(Version.txt)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if(CMAKE_COMPILER_IS_GNUCXX )
set(COMPILER_IS_GCC_COMPATIBLE ON)
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(COMPILER_IS_GCC_COMPATIBLE ON)
endif()
if(COMPILER_IS_GCC_COMPATIBLE)
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-std=c++14" SUPPORTS_CXX14)
if(SUPPORTS_CXX14)
message(STATUS "-std=c++14 is supported.")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++14")
else()
check_cxx_compiler_flag("-std=c++1y" SUPPORTS_CXX1Y)
if(SUPPORTS_CXX1Y)
message(STATUS "-std=c++1y is supported.")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
else()
message(FATAL_ERROR "C++11 is unsupported.")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -W -Wno-unused-parameter -fPIC")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -W -Wno-unused-parameter -fPIC")
endif()
elseif(MSVC)
# Disable the following warnings:
# C4355 'this' : used in base member initializer list.
# Deprecation warnings for less secure CRT functions.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4355 /D_CRT_SECURE_NO_WARNINGS=1")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D_CRT_SECURE_NO_WARNINGS=1")
endif()
# Add path for custom modules
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
)
option(AXE_ENABLE_JIT "Enable LLVM based JIT" ON)
option(AXE_ENABLE_SDL "Use SDL if available" ON)
if(AXE_ENABLE_JIT)
find_package(Clang)
if(NOT CLANG_FOUND)
set(AXE_ENABLE_JIT 0)
endif()
endif()
if(AXE_ENABLE_JIT)
message(STATUS "JIT enabled")
else()
message(STATUS "JIT disabled")
endif()
if(AXE_ENABLE_SDL)
find_package(SDL2)
if(NOT SDL2_FOUND)
set(AXE_ENABLE_SDL 0)
endif()
endif()
if(AXE_ENABLE_SDL)
message(STATUS "SDL enabled")
else()
message(STATUS "SDL disabled")
endif()
add_subdirectory(utils/instgen)
add_subdirectory(utils/not)
add_subdirectory(utils/genHex)
add_subdirectory(utils/genJitGlobalMap)
add_subdirectory(lib)
add_subdirectory(tools/axe)
if (WIN32)
SET(CPACK_GENERATOR "ZIP")
else()
SET(CPACK_GENERATOR "TGZ")
endif()
set(CPACK_PACKAGE_VERSION
"${AXE_VERSION_MAJOR}.${AXE_VERSION_MINOR}${AXE_VERSION_TWEAK}")
set(CPACK_PACKAGE_NAME "axe")
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
INCLUDE(CPack)
configure_file(${CMAKE_SOURCE_DIR}/test/lit.site.cfg.in ${CMAKE_BINARY_DIR}/test/lit.site.cfg)
find_package(PythonInterp)
if (PYTHONINTERP_FOUND)
add_custom_target(check ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/thirdparty/lit/lit.py ${CMAKE_BINARY_DIR}/test)
else()
add_custom_target(check ${CMAKE_COMMAND} -E echo "Not running tests as python is missing")
endif()