-
Notifications
You must be signed in to change notification settings - Fork 18
/
CMakeLists.txt
91 lines (73 loc) · 2.68 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
cmake_minimum_required(VERSION 3.12)
foreach(policy
CMP0074 # CMake 3.12
)
if(POLICY ${policy})
cmake_policy(SET ${policy} NEW)
endif()
endforeach()
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
set(PROJECT_NAME nampower)
project(${PROJECT_NAME})
# build in Release-mode by default if not explicitly set
if( NOT CMAKE_BUILD_TYPE )
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
endif()
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost REQUIRED COMPONENTS filesystem program_options)
if (Boost_FOUND)
message(STATUS "boost found at ${Boost_INCLUDE_DIR}. Library dir: ${Boost_LIBRARY_DIR_DEBUG}")
else()
message(FATAL_ERROR "boost not found")
endif()
if ("x_${CMAKE_BUILD_TYPE}" STREQUAL "x_Debug")
set(HADESMEM_BUILD "Debug")
link_directories("${Boost_LIBRARY_DIR_DEBUG}")
else()
set(HADESMEM_BUILD "Release")
link_directories("${Boost_LIBRARY_DIR_RELEASE}")
endif()
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
message(FATAL_ERROR "64-bit unsupported. nampower integrates with the 1.12.1 client which is only 32 bit")
else()
set(HADESMEM_ARCH "Win32")
endif()
if ("x_${HADESMEM_ROOT}" STREQUAL "x_")
if (EXISTS "${CMAKE_SOURCE_DIR}/hadesmem-v${MSVC_TOOLSET_VERSION}-${HADESMEM_BUILD}-${HADESMEM_ARCH}")
set(HADESMEM_ROOT "${CMAKE_SOURCE_DIR}/hadesmem-v${MSVC_TOOLSET_VERSION}-${HADESMEM_BUILD}-${HADESMEM_ARCH}")
set(HADESMEM_LIB_DIR "${HADESMEM_ROOT}/lib")
else()
message(FATAL_ERROR "HADESMEM_ROOT not set. ${PROJECT_NAME} requires hadesmem, available at https://github.com/namreeb/hadesmem")
endif()
else()
set(HADESMEM_LIB_DIR "${HADESMEM_ROOT}/lib")
endif()
if (NOT EXISTS "${HADESMEM_ROOT}/include/memory/hadesmem")
message(FATAL_ERROR "hadesmem not found at ${HADESMEM_ROOT}")
else()
message(STATUS "hadesmem found at ${HADESMEM_ROOT}")
endif()
message(STATUS "hadesmem library directory: ${HADESMEM_LIB_DIR}")
# threading library is required
find_package(Threads REQUIRED)
add_definitions(-DUNICODE -D_UNICODE -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -DASMJIT_STATIC -DASMJIT_BUILD_X86 -DHADESMEM_NO_PUGIXML)
include_directories(
"Include"
"${CMAKE_CURRENT_SOURCE_DIR}"
"${Boost_INCLUDE_DIR}"
"${HADESMEM_ROOT}/include/memory/"
"${HADESMEM_ROOT}/deps/udis86/udis86"
"${HADESMEM_ROOT}/deps/asmjit/asmjit/src"
)
link_directories("${HADESMEM_LIB_DIR}")
add_subdirectory(loader)
add_subdirectory(nampower)
install(FILES
"${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt"
"${CMAKE_CURRENT_SOURCE_DIR}/README.md"
DESTINATION "${CMAKE_INSTALL_PREFIX}")