blob: 9efea7aaec35077782e91ed70e3b45b5fbded319 (
plain)
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
#
# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# Make the tools list available in the current scope
GetToolsList(TOOLS_BUILD_LIST)
if (TOOLS_BUILD STREQUAL "none")
set(TOOLS_DEFAULT_BUILD "disabled")
else()
set(TOOLS_DEFAULT_BUILD "enabled")
endif()
# Sets BUILD_TOOLS_USE_WHITELIST
# Sets BUILD_TOOLS_WHITELIST
if (TOOLS_BUILD MATCHES "-only")
set(BUILD_TOOLS_USE_WHITELIST ON)
if (TOOLS_BUILD STREQUAL "maps-only")
list(APPEND BUILD_TOOLS_WHITELIST map_extractor mmaps_generator vmap4_assembler vmap4_extractor)
endif()
if (TOOLS_BUILD STREQUAL "db-only")
list(APPEND BUILD_TOOLS_WHITELIST dbimport)
endif()
endif()
# Set the TOOL_${TOOL_BUILD_NAME} variables from the
# variables set above
foreach(TOOL_BUILD_NAME ${TOOLS_BUILD_LIST})
ToolNameToVariable(${TOOL_BUILD_NAME} TOOL_BUILD_VARIABLE)
if(${TOOL_BUILD_VARIABLE} STREQUAL "default")
if(BUILD_TOOLS_USE_WHITELIST)
list(FIND BUILD_TOOLS_WHITELIST "${TOOL_BUILD_NAME}" INDEX)
if(${INDEX} GREATER -1)
set(${TOOL_BUILD_VARIABLE} ${TOOLS_DEFAULT_BUILD})
else()
set(${TOOL_BUILD_VARIABLE} "disabled")
endif()
else()
set(${TOOL_BUILD_VARIABLE} ${TOOLS_DEFAULT_BUILD})
endif()
endif()
# Build the Graph values
if(${TOOL_BUILD_VARIABLE} MATCHES "enabled")
list(APPEND TOOL_BUILD_GRAPH_KEYS tools)
set(TOOL_BUILD_VALUE_DISPLAY_tools tools)
list(APPEND TOOL_BUILD_VALUE_CONTAINS_tools ${TOOL_BUILD_NAME})
else()
list(APPEND TOOL_BUILD_GRAPH_KEYS disabled)
set(TOOL_BUILD_VALUE_DISPLAY_disabled disabled)
list(APPEND TOOL_BUILD_VALUE_CONTAINS_disabled ${TOOL_BUILD_NAME})
endif()
endforeach()
list(SORT TOOL_BUILD_GRAPH_KEYS)
list(REMOVE_DUPLICATES TOOL_BUILD_GRAPH_KEYS)
# Display the graphs
message("")
message("* Tools build list (${TOOLS_BUILD}):")
message(" |")
foreach(TOOL_BUILD_GRAPH_KEY ${TOOL_BUILD_GRAPH_KEYS})
if(NOT TOOL_BUILD_GRAPH_KEY STREQUAL "disabled")
message(" +- ${TOOL_BUILD_VALUE_DISPLAY_${TOOL_BUILD_GRAPH_KEY}}")
else()
message(" | ${TOOL_BUILD_VALUE_DISPLAY_${TOOL_BUILD_GRAPH_KEY}}")
endif()
foreach(TOOL_BUILD_GRAPH_ENTRY ${TOOL_BUILD_VALUE_CONTAINS_${TOOL_BUILD_GRAPH_KEY}})
message(" | +- ${TOOL_BUILD_GRAPH_ENTRY}")
endforeach()
message(" |")
endforeach()
message("")
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
# Generates the actual tools projects
foreach(TOOL_NAME ${TOOLS_BUILD_LIST})
GetPathToTool(${TOOL_NAME} SOURCE_TOOL_PATH)
ToolNameToVariable(${TOOL_NAME} TOOL_BUILD_VARIABLE)
if (${TOOL_BUILD_VARIABLE} STREQUAL "disabled")
continue()
endif()
unset(TOOL_PRIVATE_SOURCES)
CollectSourceFiles(
${SOURCE_TOOL_PATH}
TOOL_PRIVATE_SOURCES)
if (WIN32)
list(APPEND TOOL_PRIVATE_SOURCES ${winDebugging})
endif()
GetProjectNameOfToolName(${TOOL_NAME} TOOL_PROJECT_NAME)
# Create the application project
add_executable(${TOOL_PROJECT_NAME}
${TOOL_PRIVATE_SOURCES})
add_dependencies(${TOOL_PROJECT_NAME} revision.h)
# Need fix errors in maps tools
# target_link_libraries(${TOOL_PROJECT_NAME}
# PRIVATE
# acore-dependency-interface)
if (${TOOL_PROJECT_NAME} MATCHES "dbimport")
target_link_libraries(${TOOL_PROJECT_NAME}
PUBLIC
database
PRIVATE
modules
scripts
acore-core-interface)
# Install config
CopyToolConfig(${TOOL_PROJECT_NAME} ${TOOL_NAME})
else()
target_link_libraries(${TOOL_PROJECT_NAME}
PRIVATE
acore-dependency-interface)
target_link_libraries(${TOOL_PROJECT_NAME}
PUBLIC
common
mpq
zlib
Recast
g3dlib)
endif()
unset(TOOL_PUBLIC_INCLUDES)
CollectIncludeDirectories(
${SOURCE_TOOL_PATH}
TOOL_PUBLIC_INCLUDES)
target_include_directories(${TOOL_PROJECT_NAME}
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(${TOOL_PROJECT_NAME}
PUBLIC
${TOOL_PUBLIC_INCLUDES}
${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/modules
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/${TOOL_NAME})
set_target_properties(${TOOL_PROJECT_NAME}
PROPERTIES
FOLDER
"tools")
if (UNIX)
install(TARGETS ${TOOL_PROJECT_NAME} DESTINATION bin)
elseif (WIN32)
install(TARGETS ${TOOL_PROJECT_NAME} DESTINATION "${CMAKE_INSTALL_PREFIX}")
endif()
endforeach()
|