-
Notifications
You must be signed in to change notification settings - Fork 19
/
bcl_externals.cmake
145 lines (133 loc) · 6.59 KB
/
bcl_externals.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
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
#####################
# external dependency
#####################
# this is a list of all external packages - each entry has space separated: name of package, version
SET(
BCL_EXTERNAL_PACKAGES
"pthreads 2.8.0"
"bzip2 1.0.5"
"zlib 1.2.5"
)
# freeocl is currently not API compatible with OpenCL.dll on windows, so for now, use of ATI's opencl is still necesary
IF( ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
SET( USE_ATI_OCL 1)
ENDIF()
# switches to allow for changing between ati and free ocl or other OCL implementations
SET( LIB_OPENCL_IMPL "freeocl 0.3.6")
SET( OPENCL_VAR freeocl)
IF( USE_ATI_OCL)
SET( LIB_OPENCL_IMPL "ati 2.5")
SET( OPENCL_VAR ati)
ELSEIF( ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
SET( OPENCL_VAR opencl)
SET( LIB_OPENCL_IMPL "opencl 1.2")
ENDIF()
IF( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
LIST( APPEND BCL_EXTERNAL_PACKAGES ${LIB_OPENCL_IMPL})
# LIST( APPEND BCL_EXTERNAL_PACKAGES "openblas 0.2.20")
ELSEIF( ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
LIST( APPEND BCL_EXTERNAL_PACKAGES ${LIB_OPENCL_IMPL})
ELSEIF( ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
LIST( APPEND BCL_EXTERNAL_PACKAGES ${LIB_OPENCL_IMPL})
ENDIF()
# directory to install externals to
IF( NOT BCL_LICENSE)
IF( WIN32)
SET( BCL_EXTERN_DESTINATION "bin")
ELSEIF( UNIX)
SET( BCL_EXTERN_DESTINATION "lib")
ELSEIF( APPLE)
SET( BCL_EXTERN_DESTINATION "lib")
ENDIF()
ELSE()
# install licensed builds' libraries in the same directory as the executable
SET( BCL_EXTERN_DESTINATION ${BCL_EXEC_PREFIX})
ENDIF()
# define the external libs folder for os and architecture
IF( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
SET( BCL_EXTERNAL_LIBRARY_BASE extern/Linux2/${CMAKE_SYSTEM_PROCESSOR}) #x86 and x86_64
ELSEIF( ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
# libraries in those folders should be universal binaries for i386 and x86_64 - but they are dependent on the SDK used
# Since libraries under x86_64 were built using a 10.4-10.6 compatible SDK, and since all currently targeted libraries
# are 10.6 compatible, use x86_64 for now
SET( BCL_EXTERNAL_LIBRARY_BASE extern/MacOS/x86_64)
# add include and library path for external packages and find package for apple frameworks path
SET( CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${APPLE_FRAMEWORKS_PATH})
SET( CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${APPLE_FRAMEWORKS_PATH})
ELSEIF( ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
SET( BCL_EXTERNAL_LIBRARY_BASE extern/windows)
IF( ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
SET( BCL_EXTERNAL_LIBRARY_BASE "${BCL_EXTERNAL_LIBRARY_BASE}/win64") # windows 64bit
ELSEIF( ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86")
SET( BCL_EXTERNAL_LIBRARY_BASE "${BCL_EXTERNAL_LIBRARY_BASE}/win32") # windows 32bit
ENDIF()
ENDIF()
IF( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")# AND NOT ${CMAKE_BUILD_TYPE} STREQUAL "Release")
# explicitly add the dynamic runtime library; needed for callstack
# the ld linker adds common system libraries like dl whenever it detects a dependency on them,
# but gold does not and will not, see http://sourceware.org/bugzilla/show_bug.cgi?id=10238
LIST( APPEND EXTERN_LINK_LIBRARIES "dl")
ENDIF()
SET( EXTERNAL_RUNTIME_LIBRARIES "")
FOREACH( EXTERNAL ${BCL_EXTERNAL_PACKAGES})
SEPARATE_ARGUMENTS( EXTERNAL)
LIST( GET EXTERNAL 0 CURRENT_PACKAGE)
LIST( GET EXTERNAL 1 CURRENT_VERSION)
SET( CMAKE_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/extern/noarch/${CURRENT_PACKAGE}/${CURRENT_VERSION}/include ${CMAKE_INCLUDE_PATH})
SET( CMAKE_LIBRARY_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${BCL_EXTERNAL_LIBRARY_BASE}/${CURRENT_PACKAGE}/${CURRENT_VERSION}/lib ${CMAKE_LIBRARY_PATH})
IF( ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
SET(
CMAKE_LIBRARY_PATH
${CMAKE_CURRENT_SOURCE_DIR}/${BCL_EXTERNAL_LIBRARY_BASE}/${CURRENT_PACKAGE}/${CURRENT_VERSION}/lib/mingw
${CMAKE_CURRENT_SOURCE_DIR}/${BCL_EXTERNAL_LIBRARY_BASE}/${CURRENT_PACKAGE}/${CURRENT_VERSION}/bin/mingw
${CMAKE_CURRENT_SOURCE_DIR}/${BCL_EXTERNAL_LIBRARY_BASE}/${CURRENT_PACKAGE}/${CURRENT_VERSION}/lib
${CMAKE_CURRENT_SOURCE_DIR}/${BCL_EXTERNAL_LIBRARY_BASE}/${CURRENT_PACKAGE}/${CURRENT_VERSION}/bin
${CMAKE_LIBRARY_PATH}
)
# LIST( APPEND CMAKE_LIBRARY_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${BCL_EXTERNAL_LIBRARY_BASE}/${CURRENT_PACKAGE}/${CURRENT_VERSION}/lib/vs2010/release)
# LIST( APPEND CMAKE_LIBRARY_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${BCL_EXTERNAL_LIBRARY_BASE}/${CURRENT_PACKAGE}/${CURRENT_VERSION}/bin/vs2010/release)
# LIST( APPEND CMAKE_LIBRARY_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${BCL_EXTERNAL_LIBRARY_BASE}/${CURRENT_PACKAGE}/${CURRENT_VERSION}/lib/vs/release)
# LIST( APPEND CMAKE_LIBRARY_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${BCL_EXTERNAL_LIBRARY_BASE}/${CURRENT_PACKAGE}/${CURRENT_VERSION}/bin/vs/release)
ENDIF()
# if package is supposed to be used
IF( BCL_EXTERNALS STREQUAL OFF OR BCL_EXTERNALS MATCHES ${CURRENT_PACKAGE})
MESSAGE( STATUS "package is considered: " ${CURRENT_PACKAGE} " " ${CURRENT_VERSION})
FIND_PACKAGE( ${CURRENT_PACKAGE} ${CURRENT_VERSION})
# if package was found
IF( ${CURRENT_PACKAGE}_FOUND)
INCLUDE_DIRECTORIES( ${${CURRENT_PACKAGE}_INCLUDE_DIRS})
LIST( APPEND EXTERN_LINK_LIBRARIES ${${CURRENT_PACKAGE}_LIBRARIES})
# check if runtime libraries need to be installed
IF( ${CURRENT_PACKAGE}_RUNTIME_LIBRARY)
# find license file
FIND_FILE( ${CURRENT_PACKAGE}_LICENSE NAMES "LICENSE.txt" PATHS ${CMAKE_CURRENT_SOURCE_DIR}/extern/noarch/${CURRENT_PACKAGE} DOC "license file for package ${CURRENT_PACKAGE}" NO_DEFAULT_PATH)
IF( ${CURRENT_PACKAGE}_LICENSE)
INSTALL(
FILES ${${CURRENT_PACKAGE}_LICENSE}
DESTINATION ${BCL_EXTERN_DESTINATION}
RENAME ${CURRENT_PACKAGE}License.txt
COMPONENT BclReleaseAll
)
ENDIF()
IF( ${CURRENT_PACKAGE}_RUNTIME_LIBRARY_RENAME)
MESSAGE( STATUS "add runtime library to install: " ${${CURRENT_PACKAGE}_RUNTIME_LIBRARY} " and so name: " ${${CURRENT_PACKAGE}_RUNTIME_LIBRARY_RENAME})
INSTALL(
FILES ${${CURRENT_PACKAGE}_RUNTIME_LIBRARY}
DESTINATION ${BCL_EXTERN_DESTINATION}
RENAME ${${CURRENT_PACKAGE}_RUNTIME_LIBRARY_RENAME}
COMPONENT BclReleaseAll
)
LIST( APPEND EXTERNAL_RUNTIME_LIBRARIES ${${CURRENT_PACKAGE}_RUNTIME_LIBRARY_RENAME})
ELSE( ${CURRENT_PACKAGE}_RUNTIME_LIBRARY_RENAME)
MESSAGE( STATUS "add runtime library to install: " ${${CURRENT_PACKAGE}_RUNTIME_LIBRARY})
INSTALL(
FILES ${${CURRENT_PACKAGE}_RUNTIME_LIBRARY}
DESTINATION ${BCL_EXTERN_DESTINATION}
COMPONENT BclReleaseAll
)
LIST( APPEND EXTERNAL_RUNTIME_LIBRARIES ${${CURRENT_PACKAGE}_RUNTIME_LIBRARY})
ENDIF( ${CURRENT_PACKAGE}_RUNTIME_LIBRARY_RENAME)
ENDIF( ${CURRENT_PACKAGE}_RUNTIME_LIBRARY)
ENDIF()
ENDIF()
ENDFOREACH()