-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnnabla-v1.19.0.patch
412 lines (383 loc) · 18.5 KB
/
nnabla-v1.19.0.patch
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 18883998..e0e59c5e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-cmake_minimum_required (VERSION 3.1)
+cmake_minimum_required (VERSION 3.13)
#set(CMAKE_VERBOSE_MAKEFILE ON)
# NNabla project
@@ -22,9 +22,9 @@ project (nbla C CXX)
# General settings
###############################################################################
# Using cmake scripts and modules
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/build-tools/cmake/Modules)
+list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/build-tools/cmake/Modules)
list(APPEND CMAKE_FIND_ROOT_PATH $ENV{CMAKE_FIND_ROOT_PATH})
-include(${CMAKE_SOURCE_DIR}/build-tools/cmake/Utils.cmake)
+include(${PROJECT_SOURCE_DIR}/build-tools/cmake/Utils.cmake)
###############################################################################
option(BUILD_CPP_LIB "Build C++ Library" ON)
@@ -74,7 +74,7 @@ endif()
###############################################################################
execute_process(
COMMAND ${PYTHON_COMMAND}
- ${CMAKE_SOURCE_DIR}/build-tools/cmake/get_setup_build_dir.py
+ ${PROJECT_SOURCE_DIR}/build-tools/cmake/get_setup_build_dir.py
OUTPUT_VARIABLE NBLA_SETUP_LIB_DIR_RAW)
string(STRIP ${NBLA_SETUP_LIB_DIR_RAW} NBLA_SETUP_LIB_DIR)
@@ -82,7 +82,7 @@ string(STRIP ${NBLA_SETUP_LIB_DIR_RAW} NBLA_SETUP_LIB_DIR)
# Code generator
###############################################################################
-file(STRINGS ${CMAKE_SOURCE_DIR}/VERSION.txt versions NEWLINE_CONSUME)
+file(STRINGS ${PROJECT_SOURCE_DIR}/VERSION.txt versions NEWLINE_CONSUME)
string(REGEX REPLACE [[^([A-z0-9.\-_]+).*$]] [[\1]] version ${versions})
string(REGEX REPLACE [[^([0-9]+)\.([0-9]+)\.(.*)$]] [[\1]] version_major ${version})
string(REGEX REPLACE [[^([0-9]+)\.([0-9]+)\.(.*)$]] [[\2]] version_minor ${version})
@@ -127,41 +127,41 @@ set(CPACK_PACKAGE_VERSION_MINOR ${version_minor})
set(CPACK_PACKAGE_VERSION_PATCH ${version_patch})
set(CPACK_PACKAGE_CONTACT "nnabla@googlegroups.com")
-file(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/src/nbla/proto)
+file(MAKE_DIRECTORY ${PROJECT_SOURCE_DIR}/src/nbla/proto)
execute_process(
COMMAND
${PYTHON_COMMAND}
- ${CMAKE_SOURCE_DIR}/build-tools/code_generator/generate.py ${version}
+ ${PROJECT_SOURCE_DIR}/build-tools/code_generator/generate.py ${version}
RESULT_VARIABLE GENERATE_RESULT)
if (NOT ${GENERATE_RESULT} EQUAL 0)
message(FATAL_ERROR "generate.py failed.")
endif ()
-if (${CMAKE_SOURCE_DIR}/src/nbla/proto/nnabla.proto
+if (${PROJECT_SOURCE_DIR}/src/nbla/proto/nnabla.proto
IS_NEWER_THAN
- ${CMAKE_SOURCE_DIR}/python/src/nnabla/utils//nnabla_pb2.py)
+ ${PROJECT_SOURCE_DIR}/python/src/nnabla/utils//nnabla_pb2.py)
execute_process(
COMMAND
${PROTOC_COMMAND}
- --proto_path=${CMAKE_SOURCE_DIR}/src/nbla/proto/
- --python_out=${CMAKE_SOURCE_DIR}/python/src/nnabla/utils
- ${CMAKE_SOURCE_DIR}/src/nbla/proto/nnabla.proto
+ --proto_path=${PROJECT_SOURCE_DIR}/src/nbla/proto/
+ --python_out=${PROJECT_SOURCE_DIR}/python/src/nnabla/utils
+ ${PROJECT_SOURCE_DIR}/src/nbla/proto/nnabla.proto
RESULT_VARIABLE PROTOC_RESULT)
if (NOT ${PROTOC_RESULT} EQUAL 0)
message(FATAL_ERROR "protoc for Python failed.")
endif ()
endif()
-if (${CMAKE_SOURCE_DIR}/src/nbla/proto/nnabla.proto
+if (${PROJECT_SOURCE_DIR}/src/nbla/proto/nnabla.proto
IS_NEWER_THAN
- ${CMAKE_SOURCE_DIR}/src/nbla_utils/nnabla.pb.cc)
+ ${PROJECT_SOURCE_DIR}/src/nbla_utils/nnabla.pb.cc)
execute_process(
COMMAND
${PROTOC_COMMAND}
- --proto_path=${CMAKE_SOURCE_DIR}/src/nbla/proto/
- --cpp_out=${CMAKE_SOURCE_DIR}/src/nbla_utils
- ${CMAKE_SOURCE_DIR}/src/nbla/proto/nnabla.proto
+ --proto_path=${PROJECT_SOURCE_DIR}/src/nbla/proto/
+ --cpp_out=${PROJECT_SOURCE_DIR}/src/nbla_utils
+ ${PROJECT_SOURCE_DIR}/src/nbla/proto/nnabla.proto
RESULT_VARIABLE PROTOC_RESULT)
if (NOT ${PROTOC_RESULT} EQUAL 0)
message(FATAL_ERROR "protoc for C++ failed.")
@@ -177,6 +177,8 @@ if(BUILD_CPP_LIB)
###############################################################################
add_subdirectory(third_party)
+ find_package(Eigen3 3.3.5 REQUIRED)
+
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
"Build type release is default on single-configuration build system like GNU make."
@@ -205,13 +207,13 @@ if(BUILD_CPP_LIB)
nbla_warnings_disable(CMAKE_CXX_FLAGS /wd4099)
# Setting output directory naively
- set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
if (WIN32)
- set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
- set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
+ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
+ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
else()
- set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
- set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
+ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
+ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
endif()
###############################################################################
@@ -219,13 +221,13 @@ if(BUILD_CPP_LIB)
###############################################################################
# includes
list(APPEND NBLA_INCLUDE_DIRS
- ${CMAKE_SOURCE_DIR}/include
- ${CMAKE_SOURCE_DIR}/third_party/eigen-3.3.5
- ${CMAKE_SOURCE_DIR}/include/third_party)
+ ${PROJECT_SOURCE_DIR}/include
+ ${PROJECT_SOURCE_DIR}/include/third_party
+ ${EIGEN3_INCLUDE_DIRS})
if(BUILD_CPP_UTILS)
list(APPEND NBLA_INCLUDE_DIRS
- ${CMAKE_SOURCE_DIR}/third_party/cmdline-master)
+ ${PROJECT_SOURCE_DIR}/third_party/cmdline-master)
endif()
include_directories(${NBLA_INCLUDE_DIRS};${PROJECT_BINARY_DIR})
@@ -280,7 +282,7 @@ if(BUILD_CPP_LIB)
" compiler by `python setup.py build_ext --help-compiler`.")
endif()
- option(CONFIG_BUILD_DIR ${CMAKE_BINARY_DIR})
+ option(CONFIG_BUILD_DIR ${PROJECT_BINARY_DIR})
# Two-step configure_file generation with generate-time property (target_file_name).
# http://cmake.3232098.n2.nabble.com/cmp0026-file-GENERATE-and-configure-file-td7590275.html
@@ -340,7 +342,7 @@ if(BUILD_PYTHON_PACKAGE)
${CMAKE_CURRENT_SOURCE_DIR}/python/test/__pycache__
${CMAKE_CURRENT_SOURCE_DIR}/python/test/function/__pycache__
${CMAKE_CURRENT_SOURCE_DIR}/python/test/utils/__pycache__
- ${CMAKE_BINARY_DIR}/"build")
+ ${PROJECT_BINARY_DIR}/"build")
# http://stackoverflow.com/questions/13298504/using-cmake-with-setup-py
file(GLOB_RECURSE NBLA_PYTHON_DEPS
${CMAKE_CURRENT_SOURCE_DIR}/python/src/*.py
@@ -357,7 +359,7 @@ if(BUILD_PYTHON_PACKAGE)
set(NBLA_PYTHON_SETUP ${CMAKE_CURRENT_SOURCE_DIR}/python/setup.py)
set(NNABLA_CONVERTER_SETUP ${CMAKE_CURRENT_SOURCE_DIR}/python/src/nnabla/utils/converter/setup.py)
- set(NBLA_PYTHON_OUTPUT ${CMAKE_BINARY_DIR}/build)
+ set(NBLA_PYTHON_OUTPUT ${PROJECT_BINARY_DIR}/build)
set(NBLA_PYTHON_OUTPUT_WHEEL ${NBLA_PYTHON_OUTPUT}/.timestamp.wheel)
set(NBLA_WHEEL_DEPENDS ${NBLA_PYTHON_DEPS} ${NBLA_LIBRARY_NAME})
# Wheel
@@ -365,21 +367,21 @@ if(BUILD_PYTHON_PACKAGE)
if(MAKE_MANYLINUX_WHEEL)
add_custom_command(OUTPUT ${NBLA_PYTHON_OUTPUT_WHEEL}
COMMAND ${CMAKE_COMMAND} -E remove -f ${NBLA_PYTHON_OUTPUT_CYTHON}
- COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_BINARY_DIR}/dist/*.whl
+ COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_BINARY_DIR}/dist/*.whl
COMMAND ${CMAKE_COMMAND} -E env
WHEEL_SUFFIX=${WHEEL_SUFFIX}
${PYTHON_COMMAND} ${NBLA_PYTHON_SETUP} -q bdist_wheel
COMMAND ${CMAKE_COMMAND} -E env
WHEEL_SUFFIX=${WHEEL_SUFFIX}
${PYTHON_COMMAND} ${NNABLA_CONVERTER_SETUP} -q bdist_wheel
- COMMAND ${CMAKE_SOURCE_DIR}/build-tools/auditwheel-nnabla ${CMAKE_BINARY_DIR}/dist/*-linux_*.whl
- COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_BINARY_DIR}/dist/*-linux*.whl
+ COMMAND ${PROJECT_SOURCE_DIR}/build-tools/auditwheel-nnabla ${PROJECT_BINARY_DIR}/dist/*-linux_*.whl
+ COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_BINARY_DIR}/dist/*-linux*.whl
COMMAND ${CMAKE_COMMAND} -E touch ${NBLA_PYTHON_OUTPUT_WHEEL}
DEPENDS ${NBLA_WHEEL_DEPENDS})
else()
add_custom_command(OUTPUT ${NBLA_PYTHON_OUTPUT_WHEEL}
COMMAND ${CMAKE_COMMAND} -E remove -f ${NBLA_PYTHON_OUTPUT_CYTHON}
- COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_BINARY_DIR}/dist/*.whl
+ COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_BINARY_DIR}/dist/*.whl
COMMAND ${CMAKE_COMMAND} -E env
WHEEL_SUFFIX=${WHEEL_SUFFIX}
${PYTHON_COMMAND} ${NBLA_PYTHON_SETUP} -q bdist_wheel
@@ -392,7 +394,7 @@ if(BUILD_PYTHON_PACKAGE)
else()
add_custom_command(OUTPUT ${NBLA_PYTHON_OUTPUT_WHEEL}
COMMAND ${CMAKE_COMMAND} -E remove -f ${NBLA_PYTHON_OUTPUT_CYTHON}
- COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_BINARY_DIR}/dist/*.whl
+ COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_BINARY_DIR}/dist/*.whl
COMMAND ${PYTHON_COMMAND} ${NBLA_PYTHON_SETUP} -q bdist_wheel
COMMAND ${PYTHON_COMMAND} ${NNABLA_CONVERTER_SETUP} -q bdist_wheel
COMMAND ${CMAKE_COMMAND} -E touch ${NBLA_PYTHON_OUTPUT_WHEEL}
@@ -407,8 +409,8 @@ if(BUILD_PYTHON_PACKAGE)
if(UNIX OR APPLE)
add_custom_target(benchmark
COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR}/python/benchmark &&
- LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}
- PYTHONPATH=${CMAKE_BINARY_DIR}/build/${NBLA_SETUP_LIB_DIR}:$ENV{PYTHONPATH}
+ LD_LIBRARY_PATH=${PROJECT_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}
+ PYTHONPATH=${PROJECT_BINARY_DIR}/build/${NBLA_SETUP_LIB_DIR}:$ENV{PYTHONPATH}
bash -c "py.test -x")
add_dependencies(benchmark wheel)
endif()
@@ -418,26 +420,26 @@ if(BUILD_PYTHON_PACKAGE)
#############################################################################
if(UNIX OR APPLE)
add_custom_target(doc
- COMMAND rm -rf ${CMAKE_BINARY_DIR}/doc
- COMMAND mkdir -p ${CMAKE_BINARY_DIR}/doc/doxygen
- COMMAND cd ${CMAKE_SOURCE_DIR} &&
+ COMMAND rm -rf ${PROJECT_BINARY_DIR}/doc
+ COMMAND mkdir -p ${PROJECT_BINARY_DIR}/doc/doxygen
+ COMMAND cd ${PROJECT_SOURCE_DIR} &&
cat build-tools/doxygen/config >Doxyfile &&
- echo OUTPUT_DIRECTORY = ${CMAKE_BINARY_DIR}/doc/doxygen >>Doxyfile &&
+ echo OUTPUT_DIRECTORY = ${PROJECT_BINARY_DIR}/doc/doxygen >>Doxyfile &&
doxygen && rm -f Doxyfile
- COMMAND mv ${CMAKE_BINARY_DIR}/doc/doxygen/html ${CMAKE_BINARY_DIR}/doc/html-cpp
- COMMAND rm -rf ${CMAKE_BINARY_DIR}/doc/doxygen
+ COMMAND mv ${PROJECT_BINARY_DIR}/doc/doxygen/html ${PROJECT_BINARY_DIR}/doc/html-cpp
+ COMMAND rm -rf ${PROJECT_BINARY_DIR}/doc/doxygen
# English
- COMMAND mkdir -p ${CMAKE_BINARY_DIR}/doc/sphinx
- COMMAND cd ${CMAKE_SOURCE_DIR} &&
- PYTHONPATH=${CMAKE_BINARY_DIR}/build/${NBLA_SETUP_LIB_DIR}:$ENV{PYTHONPATH}
- sphinx-build -b html doc ${CMAKE_BINARY_DIR}/doc/sphinx -c doc
- COMMAND mv ${CMAKE_BINARY_DIR}/doc/sphinx ${CMAKE_BINARY_DIR}/doc/html
+ COMMAND mkdir -p ${PROJECT_BINARY_DIR}/doc/sphinx
+ COMMAND cd ${PROJECT_SOURCE_DIR} &&
+ PYTHONPATH=${PROJECT_BINARY_DIR}/build/${NBLA_SETUP_LIB_DIR}:$ENV{PYTHONPATH}
+ sphinx-build -b html doc ${PROJECT_BINARY_DIR}/doc/sphinx -c doc
+ COMMAND mv ${PROJECT_BINARY_DIR}/doc/sphinx ${PROJECT_BINARY_DIR}/doc/html
# Japanese
- COMMAND mkdir -p ${CMAKE_BINARY_DIR}/doc/sphinx
- COMMAND cd ${CMAKE_SOURCE_DIR} &&
- PYTHONPATH=${CMAKE_BINARY_DIR}/build/${NBLA_SETUP_LIB_DIR}:$ENV{PYTHONPATH}
- sphinx-build -b html -D language=ja doc ${CMAKE_BINARY_DIR}/doc/sphinx -c doc
- COMMAND mv ${CMAKE_BINARY_DIR}/doc/sphinx ${CMAKE_BINARY_DIR}/doc/html-ja)
+ COMMAND mkdir -p ${PROJECT_BINARY_DIR}/doc/sphinx
+ COMMAND cd ${PROJECT_SOURCE_DIR} &&
+ PYTHONPATH=${PROJECT_BINARY_DIR}/build/${NBLA_SETUP_LIB_DIR}:$ENV{PYTHONPATH}
+ sphinx-build -b html -D language=ja doc ${PROJECT_BINARY_DIR}/doc/sphinx -c doc
+ COMMAND mv ${PROJECT_BINARY_DIR}/doc/sphinx ${PROJECT_BINARY_DIR}/doc/html-ja)
add_dependencies(doc wheel)
nbla_exclude_from_all(doc)
endif()
diff --git a/build-tools/cmake/Utils.cmake b/build-tools/cmake/Utils.cmake
index ab5dc0d6..39dbf3d9 100644
--- a/build-tools/cmake/Utils.cmake
+++ b/build-tools/cmake/Utils.cmake
@@ -28,8 +28,8 @@ endfunction(prepend)
function(findhdf5)
set(HDF5_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/third_party/hdf5-master/src
${PROJECT_SOURCE_DIR}/third_party/hdf5-master/hl/src
- ${CMAKE_BINARY_DIR}/third_party/hdf5-master)
- prepend(HDF5_LIBRARIES ${CMAKE_BINARY_DIR}/third_party/hdf5-master/bin/ ${HDF5_LIBRARIES_TO_EXPORT})
+ ${PROJECT_BINARY_DIR}/third_party/hdf5-master)
+ prepend(HDF5_LIBRARIES ${PROJECT_BINARY_DIR}/third_party/hdf5-master/bin/ ${HDF5_LIBRARIES_TO_EXPORT})
set(HDF5_INCLUDE_DIRS "${HDF5_INCLUDE_DIRS}" PARENT_SCOPE)
set(HDF5_LIBRARIES "${HDF5_LIBRARIES}" PARENT_SCOPE)
endfunction(findhdf5)
diff --git a/python/setup.cfg.in b/python/setup.cfg.in
index 6440be6c..1443494d 100644
--- a/python/setup.cfg.in
+++ b/python/setup.cfg.in
@@ -2,7 +2,7 @@
compiler=${NBLA_PYTHON_BUILD_EXT_COMPILER}
[cmake]
-build_dir=${CMAKE_BINARY_DIR}
+build_dir=${PROJECT_BINARY_DIR}
target_name=${NBLA_LIBRARY_NAME}
target_file_name=$<TARGET_FILE_NAME:${NBLA_LIBRARY_NAME}>
target_file=$<TARGET_FILE:${NBLA_LIBRARY_NAME}>
diff --git a/src/nbla/CMakeLists.txt b/src/nbla/CMakeLists.txt
index 3efd3a56..025827e0 100644
--- a/src/nbla/CMakeLists.txt
+++ b/src/nbla/CMakeLists.txt
@@ -36,7 +36,7 @@ if (WIN32)
execute_process(
COMMAND ${PYTHON_COMMAND}
- ${CMAKE_SOURCE_DIR}/build-tools/cmake/utf8_to_utf16.py
+ ${PROJECT_SOURCE_DIR}/build-tools/cmake/utf8_to_utf16.py
${CMAKE_CURRENT_BINARY_DIR}/version-utf8.rc ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
list(APPEND SOURCES ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
diff --git a/src/nbla_cli/CMakeLists.txt b/src/nbla_cli/CMakeLists.txt
index 253ff465..6c415ab3 100644
--- a/src/nbla_cli/CMakeLists.txt
+++ b/src/nbla_cli/CMakeLists.txt
@@ -14,7 +14,7 @@
set(LIB_NAME nnabla_cli${LIB_NAME_SUFFIX})
-include(${CMAKE_SOURCE_DIR}/build-tools/cmake/Utils.cmake)
+include(${PROJECT_SOURCE_DIR}/build-tools/cmake/Utils.cmake)
if (WIN32)
# Use simulated cxxabi.h since it is not appeared in MSVC.
include_directories(${PROJECT_SOURCE_DIR}/include/msvc)
@@ -29,7 +29,7 @@ if (NNABLA_UTILS_WITH_HDF5)
if (NNABLA_UTILS_STATIC_LINK_DEPS)
set(HDF5_USE_STATIC_LIBRARIES 1)
endif()
-findhdf5()
+find_package(HDF5 1.8.0 REQUIRED COMPONENTS C HL)
endif()
if (NNABLA_UTILS_STATIC_LINK_DEPS)
if (NNABLA_UTILS_WITH_HDF5)
diff --git a/src/nbla_utils/CMakeLists.txt b/src/nbla_utils/CMakeLists.txt
index 031d2db2..0b52d695 100644
--- a/src/nbla_utils/CMakeLists.txt
+++ b/src/nbla_utils/CMakeLists.txt
@@ -14,7 +14,7 @@
set(LIB_NAME nnabla_utils${LIB_NAME_SUFFIX})
-include(${CMAKE_SOURCE_DIR}/build-tools/cmake/Utils.cmake)
+include(${PROJECT_SOURCE_DIR}/build-tools/cmake/Utils.cmake)
option(NNABLA_UTILS_WITH_HDF5 "Enable HDF5 in C++ utils." OFF)
option(NNABLA_UTILS_WITH_NPY "Enable DataIterator with NPY Cache." ON)
@@ -25,7 +25,7 @@ if (DEBUG_NETWORK_EXPANDER)
add_definitions(-DDEBUG_NETWORK_EXPANDER)
endif()
-include_directories(${CMAKE_BINARY_DIR}/libraries/include)
+include_directories(${PROJECT_BINARY_DIR}/libraries/include)
list(APPEND nbla_utils_SOURCES
nnp.cpp
@@ -118,7 +118,7 @@ else()
if (NNABLA_UTILS_STATIC_LINK_DEPS)
set(HDF5_USE_STATIC_LIBRARIES 1)
endif()
- findhdf5()
+ find_package(HDF5 1.8.0 REQUIRED COMPONENTS C HL)
endif()
find_package(ZLIB REQUIRED)
if (NNABLA_UTILS_STATIC_LINK_DEPS)
@@ -209,7 +209,7 @@ if (BUILD_TEST)
set_property(TARGET test_nbla_utils PROPERTY CXX_STANDARD 11)
nbla_exclude_from_all(test_nbla_utils)
add_test(NAME test_nbla_utils COMMAND test_nbla_utils
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
+ WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
endif()
set(NBLA_UTILS_LIBRARY_NAME ${LIB_NAME} PARENT_SCOPE)
diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
index 613c03a8..71b4bee5 100644
--- a/third_party/CMakeLists.txt
+++ b/third_party/CMakeLists.txt
@@ -1,9 +1,9 @@
function(download_and_extract_library NAME EXT URL)
- if(NOT IS_DIRECTORY ${CMAKE_SOURCE_DIR}/third_party/${NAME})
+ if(NOT IS_DIRECTORY ${PROJECT_SOURCE_DIR}/third_party/${NAME})
message("Downloading ${NAME}")
file(DOWNLOAD
${URL}
- ${CMAKE_SOURCE_DIR}/third_party/${NAME}${EXT}
+ ${PROJECT_SOURCE_DIR}/third_party/${NAME}${EXT}
SHOW_PROGRESS
STATUS status
LOG log)
@@ -13,7 +13,7 @@ function(download_and_extract_library NAME EXT URL)
if(UNIX OR APPLE)
message("Failed to download ${NAME}. Try to download with wget.")
execute_process(
- COMMAND wget ${URL} -O ${CMAKE_SOURCE_DIR}/third_party/${NAME}${EXT})
+ COMMAND wget ${URL} -O ${PROJECT_SOURCE_DIR}/third_party/${NAME}${EXT})
else()
message(FATAL_ERROR "Failed to download ${NAME}. Please check network connection and proxy settings.
status_code: ${status_code}
@@ -26,23 +26,11 @@ function(download_and_extract_library NAME EXT URL)
endif()
execute_process(
COMMAND ${CMAKE_COMMAND} -E
- chdir ${CMAKE_SOURCE_DIR}/third_party
+ chdir ${PROJECT_SOURCE_DIR}/third_party
${CMAKE_COMMAND} -E tar xf ${NAME}${EXT})
endif()
endfunction()
-if(NNABLA_UTILS_WITH_HDF5)
- download_and_extract_library(hdf5-master .zip https://github.com/mokus0/hdf5/archive/master.zip)
- set(HDF5_EXTERNALLY_CONFIGURED, 1)
- set(HDF5_EXPORTED_TARGETS "nbla_utils-hdf5-targets")
- set(BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries" FORCE)
- set(HDF5_BUILD_HL_LIB ON CACHE BOOL "Build HIGH Level HDF5 Library" FORCE)
- add_subdirectory(hdf5-master)
- install(EXPORT nbla_utils-hdf5-targets DESTINATION "trash")
-endif()
-
-download_and_extract_library(eigen-3.3.5 .zip https://gitlab.com/libeigen/eigen/-/archive/3.3.5/eigen-3.3.5.zip)
-
if(BUILD_TEST)
download_and_extract_library(googletest-release-1.10.0 .zip https://github.com/google/googletest/archive/release-1.10.0.zip)
add_subdirectory(googletest-release-1.10.0)