-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFindBWAPI.cmake
81 lines (66 loc) · 2.97 KB
/
FindBWAPI.cmake
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
# Find BWAPI (C++ library https://github.com/bwapi/bwapi/releases)
# Input variable: BWAPI_PATH
# Output variables:
# Windows:
# BWAPI_INCLUDE_DIRS
# BWAPI_LIBRARIES:
# BWAPI_LIB_DEBUG // BWAPId.lib
# BWAPI_LIB_RELEASE // BWAPI.lib
# BWAPI_DLLS:
# BWAPI_DLL_DEBUG // BWAPId.dll
# BWAPI_DLL_RELEASE // BWAPI.dll
# BWAPI_CLIENT_LIBRARIES
# BWAPI_CLIENT_LIB_DEBUG // BWAPIClientd.lib
# BWAPI_CLIENT_LIB_RELEASE // BWAPIClient.lib
# Linux:
# BWAPI_INCLUDE_DIRS
# BWAPI_DLL // libBWAPILIB.so
# BWAPI_CLIENT_LIB // libBWAPIClient.a
find_path(BWAPI_INCLUDE_DIRS NAMES BWAPI.h PATHS ${BWAPI_PATH}/include)
if (UNIX)
# find libBWAPIClient.a
find_library(BWAPI_CLIENT_LIB NAMES BWAPIClient PATHS ${BWAPI_PATH}/lib)
# find libBWAPILIB.so
find_library(BWAPI_DLL NAMES BWAPILIB PATHS ${BWAPI_PATH}/lib)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(BWAPI DEFAULT_MSG
BWAPI_DLL BWAPI_CLIENT_LIB
BWAPI_INCLUDE_DIRS
)
add_library(BWAPI SHARED IMPORTED)
set_property(TARGET BWAPI PROPERTY IMPORTED_LOCATION ${BWAPI_DLL})
add_library(BWAPIClient STATIC IMPORTED)
set_property(TARGET BWAPIClient PROPERTY IMPORTED_LOCATION ${BWAPI_CLIENT_LIB})
else()
set(old_prefixes ${CMAKE_FIND_LIBRARY_PREFIXES})
set(old_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_PREFIXES "")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
# find BWAPI .lib
find_library(BWAPI_LIB_DEBUG NAMES BWAPId PATHS ${BWAPI_PATH}/lib)
find_library(BWAPI_LIB_RELEASE NAMES BWAPI PATHS ${BWAPI_PATH}/lib)
set(BWAPI_LIBRARIES ${BWAPI_LIB_DEBUG} ${BWAPI_LIB_RELEASE})
# find BWAPIClient .lib
find_library(BWAPI_CLIENT_LIB_DEBUG NAMES BWAPIClientd PATHS ${BWAPI_PATH}/lib)
find_library(BWAPI_CLIENT_LIB_RELEASE NAMES BWAPIClient PATHS ${BWAPI_PATH}/lib)
set(BWAPI_CLIENT_LIBRARIES ${BWAPI_LIB_DEBUG} ${BWAPI_LIB_RELEASE})
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll")
#find BWAPI .dll
find_library(BWAPI_DLL_DEBUG NAMES BWAPId PATHS ${BWAPI_PATH}/Starcraft/bwapi-data/)
find_library(BWAPI_DLL_RELEASE NAMES BWAPI PATHS ${BWAPI_PATH}/Starcraft/bwapi-data/)
set(BWAPI_DLLS ${BWAPI_DLL_DEBUG} ${BWAPI_DLL_RELEASE})
set(CMAKE_FIND_LIBRARY_PREFIXES ${old_prefixes})
set(CMAKE_FIND_LIBRARY_SUFFIXES ${old_suffixes})
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(BWAPI DEFAULT_MSG
BWAPI_LIBRARIES BWAPI_DLLS
BWAPI_CLIENT_LIBRARIES
BWAPI_INCLUDE_DIRS
)
add_library(BWAPI STATIC IMPORTED)
set_property(TARGET BWAPI PROPERTY IMPORTED_LOCATION ${BWAPI_LIB_RELEASE})
set_property(TARGET BWAPI PROPERTY IMPORTED_LOCATION_DEBUG ${BWAPI_LIB_DEBUG})
add_library(BWAPIClient STATIC IMPORTED)
set_property(TARGET BWAPIClient PROPERTY IMPORTED_LOCATION ${BWAPI_CLIENT_LIB_RELEASE})
set_property(TARGET BWAPIClient PROPERTY IMPORTED_LOCATION_DEBUG ${BWAPI_CLIENT_LIB_DEBUG})
endif(UNIX)