Skip to content

Commit c591a5c

Browse files
Merge pull request #616 from insertinterestingnamehere/cmake_config
Cmake config
2 parents 425e196 + 9684f2d commit c591a5c

File tree

4 files changed

+77
-54
lines changed

4 files changed

+77
-54
lines changed

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ else()
7272
# Include libdynd in the build
7373
add_subdirectory(libraries/libdynd)
7474

75-
set(LIBDYND_INCLUDE_DIRS
75+
set(LIBDYND_INCLUDE_DIR
7676
"libraries/libdynd/include"
7777
"${CMAKE_CURRENT_BINARY_DIR}/libraries/libdynd/include")
7878
endif()
@@ -136,7 +136,7 @@ endif()
136136
include_directories(
137137
${NUMPY_INCLUDE_DIRS}
138138
${PYTHON_INCLUDE_DIRS}
139-
${LIBDYND_INCLUDE_DIRS}
139+
${LIBDYND_INCLUDE_DIR}
140140
dynd/include
141141
${CMAKE_CURRENT_BINARY_DIR}/dynd/nd
142142
${CMAKE_CURRENT_BINARY_DIR}/dynd/ndt
@@ -197,7 +197,7 @@ foreach(module dynd.config dynd.ndt.type dynd.ndt.json dynd.nd.array dynd.nd.cal
197197
if(DYND_INSTALL_LIB)
198198
target_link_libraries(${module} "${LIBDYND_LIBRARIES}")
199199
else()
200-
target_link_libraries(${module} libdynd)
200+
target_link_libraries(${module} libdynd libdyndt)
201201
if(UNIX)
202202
# Make sure libdynd is on the rpath.
203203
# On Windows, the dll is loaded dynamically via the logic in

cmake/FindLibDyND.cmake

Lines changed: 67 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
# and installed.
44
#
55
# LIBDYND_FOUND - was LibDyND found
6+
# LIBDYND_LIBRARIES - full paths for the LibDyND libraries
7+
# LIBDYND_LIBRARY_DIR - the directory containing the libdynd libraries
8+
# LIBDYND_LIBRARY_NAMES - the names of the libdynd libraries
9+
# LIBDYND_INCLUDE_DIR - path to the LibDyND include files
10+
# LIBDYND_ROOT_DIR - directory containing LIBDYND_LIBRARY_DIR and LIBDYND_INCLUDE_DIR
611
# LIBDYND_VERSION - the version of LibDyND found as a string
7-
# LIBDYND_LIBRARIES - path to the LibDyND library
8-
# LIBDYND_INCLUDE_DIRS - path to the LibDyND include files
9-
# LIBDYND_CUDA - if LibDyND was built with cuda support
1012

1113
#============================================================================
1214
# Copyright 2013 Continuum Analytics, Inc.
@@ -48,50 +50,74 @@ else()
4850
find_program(_LIBDYND_CONFIG "libdynd-config")
4951
endif()
5052
if("${_LIBDYND_CONFIG}" STREQUAL "")
53+
5154
if(LibDyND_FIND_REQUIRED)
52-
message(FATAL_ERROR
53-
"Failed to find libdynd-config program")
55+
message(FATAL_ERROR "Failed to find libdynd-config program")
5456
endif()
55-
set(LIBDYND_FOUND FALSE)
57+
set(LIBDYND_FOUND False)
5658
return()
57-
endif()
5859

60+
else()
5961

60-
# Get the version
61-
execute_process(COMMAND "${_LIBDYND_CONFIG}" "-version"
62-
RESULT_VARIABLE _DYND_SEARCH_SUCCESS
63-
OUTPUT_VARIABLE LIBDYND_VERSION
64-
ERROR_VARIABLE _DYND_ERROR_VALUE
65-
OUTPUT_STRIP_TRAILING_WHITESPACE)
66-
if(NOT _DYND_SEARCH_SUCCESS MATCHES 0)
67-
message(FATAL_ERROR
68-
"Error getting additional properties of libdynd:\n${_DYND_ERROR_VALUE}")
69-
endif()
62+
# Get the libraries to link against.
63+
execute_process(COMMAND "${_LIBDYND_CONFIG}" "-libnames"
64+
RESULT_VARIABLE _DYND_SEARCH_SUCCESS
65+
OUTPUT_VARIABLE LIBDYND_LIBRARY_NAMES
66+
ERROR_VARIABLE _DYND_ERROR_VALUE
67+
OUTPUT_STRIP_TRAILING_WHITESPACE)
68+
if(NOT _DYND_SEARCH_SUCCESS MATCHES 0)
69+
message(FATAL_ERROR "Error getting dynd library names:\n${_DYND_ERROR_VALUE}")
70+
endif()
7071

71-
# Get the library to link against
72-
execute_process(COMMAND "${_LIBDYND_CONFIG}" "-libpath"
73-
RESULT_VARIABLE _DYND_SEARCH_SUCCESS
74-
OUTPUT_VARIABLE LIBDYND_LIBRARIES
75-
ERROR_VARIABLE _DYND_ERROR_VALUE
76-
OUTPUT_STRIP_TRAILING_WHITESPACE)
77-
if(NOT _DYND_SEARCH_SUCCESS MATCHES 0)
78-
message(FATAL_ERROR
79-
"Error getting additional properties of libdynd:\n${_DYND_ERROR_VALUE}")
80-
endif()
72+
execute_process(COMMAND "${_LIBDYND_CONFIG}" "-libdir"
73+
RESULT_VARIABLE _DYND_SEARCH_SUCCESS
74+
OUTPUT_VARIABLE LIBDYND_LIBRARY_DIR
75+
ERROR_VARIABLE _DYND_ERROR_VALUE
76+
OUTPUT_STRIP_TRAILING_WHITESPACE)
77+
if(NOT _DYND_SEARCH_SUCCESS MATCHES 0)
78+
message(FATAL_ERROR "Error getting dynd library directory:\n${_DYND_ERROR_VALUE}")
79+
endif()
8180

82-
# Get the include directory
83-
execute_process(COMMAND "${_LIBDYND_CONFIG}" "-includedir"
84-
RESULT_VARIABLE _DYND_SEARCH_SUCCESS
85-
OUTPUT_VARIABLE LIBDYND_INCLUDE_DIRS
86-
ERROR_VARIABLE _DYND_ERROR_VALUE
87-
OUTPUT_STRIP_TRAILING_WHITESPACE)
88-
if(NOT _DYND_SEARCH_SUCCESS MATCHES 0)
89-
message(FATAL_ERROR
90-
"Error getting additional properties of libdynd:\n${_DYND_ERROR_VALUE}")
91-
endif()
81+
# Construct DYND_LIBRARIES from the names and directory given.
82+
if(WIN32)
83+
string(REPLACE "\\" "/" LIBDYND_LIBRARY_DIR ${LIBDYND_LIBRARY_DIR})
84+
endif()
85+
set(LIBDYND_LIBRARIES "")
86+
foreach(_lib ${LIBDYND_LIBRARY_NAMES})
87+
LIST(APPEND LIBDYND_LIBRARIES "${LIBDYND_LIBRARY_DIR}/${_lib}")
88+
endforeach()
89+
90+
# Get the include directory
91+
execute_process(COMMAND "${_LIBDYND_CONFIG}" "-includedir"
92+
RESULT_VARIABLE _DYND_SEARCH_SUCCESS
93+
OUTPUT_VARIABLE LIBDYND_INCLUDE_DIR
94+
ERROR_VARIABLE _DYND_ERROR_VALUE
95+
OUTPUT_STRIP_TRAILING_WHITESPACE)
96+
if(NOT _DYND_SEARCH_SUCCESS MATCHES 0)
97+
message(FATAL_ERROR "Error getting dynd include directory:\n${_DYND_ERROR_VALUE}")
98+
endif()
99+
100+
# Get the root directory
101+
execute_process(COMMAND "${_LIBDYND_CONFIG}" "-rootdir"
102+
RESULT_VARIABLE _DYND_SEARCH_SUCCESS
103+
OUTPUT_VARIABLE LIBDYND_ROOT_DIR
104+
ERROR_VARIABLE _DYND_ERROR_VALUE
105+
OUTPUT_STRIP_TRAILING_WHITESPACE)
106+
if(NOT _DYND_SEARCH_SUCCESS MATCHES 0)
107+
message(FATAL_ERROR "Error getting dynd root directory:\n${_DYND_ERROR_VALUE}")
108+
endif()
109+
110+
# Get the version
111+
execute_process(COMMAND "${_LIBDYND_CONFIG}" "-version"
112+
RESULT_VARIABLE _DYND_SEARCH_SUCCESS
113+
OUTPUT_VARIABLE LIBDYND_VERSION
114+
ERROR_VARIABLE _DYND_ERROR_VALUE
115+
OUTPUT_STRIP_TRAILING_WHITESPACE)
116+
if(NOT _DYND_SEARCH_SUCCESS MATCHES 0)
117+
message(FATAL_ERROR "Error getting dynd version:\n${_DYND_ERROR_VALUE}")
118+
endif()
92119

93-
find_package_message(LIBDYND
94-
"Found LibDyND: version \"${LIBDYND_VERSION}\", ${LIBDYND_LIBRARIES}"
95-
"${LIBDYND_INCLUDE_DIRS}${LIBDYND_LIBRARIES}${LIBDYND_VERSION}")
120+
find_package_message(LIBDYND "Found LibDyND: version \"${LIBDYND_VERSION}\"" "${LIBDYND_ROOT_DIR}.")
96121

97-
set(NUMPY_FOUND TRUE)
122+
set(LIBDYND_FOUND True)
123+
endif()

dynd/nd/array.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ def dshape_of(array a):
603603
a : dynd array
604604
The array whose type is requested.
605605
"""
606-
return str(<char *>dynd_format_datashape(a.v).c_str())
606+
return str(<char *>dynd_format_datashape(a.v.get_type()).c_str())
607607

608608
def ndim_of(array a):
609609
"""

setup.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,14 @@ def run(self):
102102

103103
import glob, shutil
104104

105-
if sys.platform != 'win32':
106-
if install_lib_option.split('=')[1] == 'OFF':
107-
name, = glob.glob('libraries/libdynd/libdynd.*')
105+
if install_lib_option.split('=')[1] == 'OFF':
106+
if sys.platform != 'win32':
107+
names = glob.glob('libraries/libdynd/libdy*.*')
108+
else:
109+
names = glob.glob('libraries/libdynd/%s/libdy*.*' % build_type)
110+
for name in names:
108111
short_name = split(name)[1]
109112
shutil.move(name, os.path.join(build_lib, 'dynd', short_name))
110-
else:
111-
if install_lib_option.split('=')[1] == 'OFF':
112-
names = glob.glob('libraries/libdynd/%s/libdynd.*' % build_type)
113-
for name in names:
114-
short_name = split(name)[1]
115-
shutil.move(name, os.path.join(build_lib, 'dynd', short_name))
116113

117114
# Move the built C-extension to the place expected by the Python build
118115
self._found_names = []

0 commit comments

Comments
 (0)