forked from numenta/nupic.core-legacy
-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yaml Crash Problem WIP #282
Closed
Closed
Changes from 11 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
84faaa0
A placeholder for this PR
dkeeney b1c7e6d
Merge branch 'master_community' into yamlProblem
breznak 22fa00c
YAMLUtils cleanup
breznak 4b9a97f
YAMLUtils toValueMap uses string, not char*
breznak 5752689
CMake: external deps always build in Release mode
breznak 2a9d59f
dummy
breznak 3694c90
CMake: do not build both Release, Debug for Windows
breznak 36a4410
using libYaml
dkeeney ca96b76
Merge branch 'yamlProblem' of https://github.com/htm-community/nupic…
dkeeney e3875bf
Discard previous changes.
dkeeney 6365eca
WIP checking in what I have so far.
dkeeney d3f3082
Merge branch 'master' into yamlProblem
dkeeney 5fcd4ef
encapsales yaml-cpp inside the new Value object.
dkeeney 404a28e
binding is compiling. passing this PR back to windows.
dkeeney 4eb1607
Merge branch 'master' of https://github.com/htm-community/nupic.cpp i…
dkeeney 895d782
Merge branch 'master' of https://github.com/htm-community/nupic.cpp i…
dkeeney 39f983c
Cleaned up new yaml-cpp interface
dkeeney File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,6 @@ | |
Language: Cpp | ||
BasedOnStyle: LLVM | ||
DisableFormat: false | ||
IndentWidth: 2 | ||
ColumnLimit: 120 | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
# ----------------------------------------------------------------------------- | ||
# HTM Community Edition of NuPIC | ||
# Copyright (C) 2019, Numenta, Inc. | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero Public License version 3 as | ||
# published by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
# See the GNU Affero Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero Public License | ||
# along with this program. If not, see http://www.gnu.org/licenses. | ||
# ----------------------------------------------------------------------------- | ||
|
||
# Rapid YAML must be downloaded in four parts. | ||
# - ryml from repository at https://github.com/biojppm/rapidyaml - the main library | ||
# - c4core from repository at https://github.com/biojppm/c4core/ - the C library of utilities | ||
# - cmake from repository at https://github.com/biojppm/cmake/ - Cmake scripts | ||
# - debugbreak from repository at https://github.com/biojppm/debugbreak/ - debug break function | ||
# There are links from rapidyaml to a specific branch of c4core in the extern folder of rapidyaml | ||
# but the downloader does not follow it. So we need to do three downloads. | ||
|
||
message(STATUS "${REPOSITORY_DIR}/build/ThirdParty/share/ryml.zip") | ||
if( (EXISTS "${REPOSITORY_DIR}/build/ThirdParty/share/ryml.zip") | ||
AND (EXISTS "${REPOSITORY_DIR}/build/ThirdParty/share/ryml_c4core.zip") | ||
AND (EXISTS "${REPOSITORY_DIR}/build/ThirdParty/share/ryml_cmake.zip") | ||
AND (EXISTS "${REPOSITORY_DIR}/build/ThirdParty/share/ryml_debugbreak.zip")) | ||
set(URL1 "${REPOSITORY_DIR}/build/ThirdParty/share/ryml.zip") | ||
set(URL2 "${REPOSITORY_DIR}/build/ThirdParty/share/ryml_c4core.zip") | ||
set(URL3 "${REPOSITORY_DIR}/build/ThirdParty/share/ryml_cmake.zip") | ||
set(URL4 "${REPOSITORY_DIR}/build/ThirdParty/share/ryml_debugbreak.zip") | ||
else() | ||
#There are no releases. Use the masters. | ||
set(URL1 https://github.com/biojppm/rapidyaml/archive/master.zip) | ||
set(URL2 https://github.com/biojppm/c4core/archive/master.zip) | ||
set(URL3 https://github.com/biojppm/cmake/archive/master.zip) | ||
set(URL4 https://github.com/biojppm/debugbreak/archive/master.zip) | ||
endif() | ||
|
||
message(STATUS "Obtaining RapidYAML from ${URL1}" ) | ||
include(DownloadProject/DownloadProject.cmake) | ||
download_project(PROJ ryml | ||
PREFIX "${EP_BASE}/ryml" | ||
URL ${URL1} | ||
UPDATE_DISCONNECTED 1 | ||
QUIET | ||
) | ||
download_project(PROJ ryml_c4core | ||
PREFIX "${EP_BASE}/ryml_c4core" | ||
SOURCE_DIR "${ryml_SOURCE_DIR}/extern/c4core" | ||
URL ${URL2} | ||
UPDATE_DISCONNECTED 1 | ||
QUIET | ||
) | ||
download_project(PROJ ryml_cmake | ||
PREFIX "${EP_BASE}/ryml_cmake" | ||
SOURCE_DIR "${ryml_SOURCE_DIR}/extern/c4core/cmake" | ||
URL ${URL3} | ||
UPDATE_DISCONNECTED 1 | ||
QUIET | ||
) | ||
download_project(PROJ ryml_debugbreak | ||
PREFIX "${EP_BASE}/ryml_debugbreak" | ||
SOURCE_DIR "${ryml_SOURCE_DIR}/extern/c4core/extern/debugbreak" | ||
URL ${URL4} | ||
UPDATE_DISCONNECTED 1 | ||
QUIET | ||
) | ||
|
||
#Need to enable Exceptions | ||
set(c4path "${ryml_SOURCE_DIR}/extern/c4core/src/c4") | ||
file(RENAME "${c4path}/config.hpp" "${c4path}/config1.hpp") | ||
file(READ "${c4path}/config1.hpp" content1) | ||
string(REPLACE "//#define C4_ERROR_THROWS_EXCEPTION" | ||
"#define C4_ERROR_EXCEPTIONS_ENABLED\n#define C4_ERROR_THROWS_EXCEPTION" | ||
content | ||
"${content1}") | ||
file(WRITE "${c4path}/config.hpp" "${content}") | ||
|
||
file(RENAME "${c4path}/error.cpp" "${c4path}/error1.cpp") | ||
file(READ "${c4path}/error1.cpp" content2) | ||
string(REPLACE "if(s_error_flags & (ON_ERROR_LOG|ON_ERROR_CALLBACK))" | ||
"if(s_error_flags & (ON_ERROR_LOG|ON_ERROR_CALLBACK|ON_ERROR_THROW))" | ||
content1 | ||
"${content2}") | ||
string(REPLACE "throw Exception(ss.c_str())" | ||
"throw Exception(buf)" | ||
content | ||
"${content1}") | ||
file(WRITE "${c4path}/error.cpp" "${content}") | ||
|
||
set(C4_EXCEPTIONS_ENABLED ON) | ||
set(C4_ERROR_THROWS_EXCEPTION ON) | ||
add_subdirectory(${ryml_SOURCE_DIR} ${ryml_BINARY_DIR}) | ||
|
||
set(yaml_INCLUDE_DIRS "${ryml_SOURCE_DIR}/src@@@${ryml_SOURCE_DIR}/extern/c4core/src@@@${ryml_SOURCE_DIR}/extern/c4core/extern") | ||
if (MSVC) | ||
set(yaml_LIBRARIES "${ryml_BINARY_DIR}$<$<CONFIG:Release>:/Release/ryml.lib>$<$<CONFIG:Debug>:/Debug/ryml.lib>") | ||
else() | ||
set(yaml_LIBRARIES ${ryml_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}ryml${CMAKE_STATIC_LIBRARY_SUFFIX}) | ||
endif() | ||
FILE(APPEND "${EXPORT_FILE_NAME}" "yaml_INCLUDE_DIRS@@@${yaml_INCLUDE_DIRS}\n") | ||
FILE(APPEND "${EXPORT_FILE_NAME}" "yaml_LIBRARIES@@@${yaml_LIBRARIES}\n") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# ----------------------------------------------------------------------------- | ||
# Numenta Platform for Intelligent Computing (NuPIC) | ||
# Copyright (C) 2019, Numenta, Inc. Unless you have purchased from | ||
# Numenta, Inc. a separate commercial license for this software code, the | ||
# following terms and conditions apply: | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero Public License version 3 as | ||
# published by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
# See the GNU Affero Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero Public License | ||
# along with this program. If not, see http://www.gnu.org/licenses. | ||
# | ||
# http://numenta.org/licenses/ | ||
# ----------------------------------------------------------------------------- | ||
# This downloads and builds the libyaml library. | ||
# | ||
if(EXISTS ${REPOSITORY_DIR}/build/ThirdParty/share/libyaml.zip | ||
set(URL ${REPOSITORY_DIR}/build/ThirdParty/share/libyaml.zip) | ||
else() | ||
set(URL "https://github.com/yaml/libyaml/archive/master.zip") | ||
endif() | ||
|
||
message(STATUS "Obtaining libyaml") | ||
include(DownloadProject/DownloadProject.cmake) | ||
download_project(PROJ libyaml | ||
PREFIX ${EP_BASE}/libyaml | ||
URL ${URL} | ||
GIT_SHALLOW ON | ||
UPDATE_DISCONNECTED 1 | ||
QUIET | ||
) | ||
|
||
add_subdirectory(${libyaml_SOURCE_DIR} ${libyaml_BINARY_DIR}) | ||
|
||
set(yaml_INCLUDE_DIRS ${libyaml_SOURCE_DIR}/include) | ||
if (MSVC) | ||
set(yaml_LIBRARIES "${libyaml_BINARY_DIR}$<$<CONFIG:Release>:/Release/liblibyamlmd.lib>$<$<CONFIG:Debug>:/Debug/liblibyamlmdd.lib>") | ||
else() | ||
set(yaml_LIBRARIES ${libyaml_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}libyaml${CMAKE_STATIC_LIBRARY_SUFFIX}) | ||
endif() | ||
FILE(APPEND "${EXPORT_FILE_NAME}" "yaml_INCLUDE_DIRS@@@${yaml_SOURCE_DIR}\n") | ||
FILE(APPEND "${EXPORT_FILE_NAME}" "yaml_LIBRARIES@@@${yaml_LIBRARIES}\n") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,8 +112,6 @@ set(engine_files | |
htm/engine/RegisteredRegionImplCpp.hpp | ||
htm/engine/Spec.cpp | ||
htm/engine/Spec.hpp | ||
htm/engine/YAMLUtils.cpp | ||
htm/engine/YAMLUtils.hpp | ||
htm/engine/Watcher.cpp | ||
htm/engine/Watcher.hpp | ||
) | ||
|
@@ -127,9 +125,9 @@ set(ntypes_files | |
htm/ntypes/BasicType.hpp | ||
htm/ntypes/Collection.hpp | ||
htm/ntypes/Dimensions.hpp | ||
htm/ntypes/Scalar.cpp | ||
htm/ntypes/Scalar.hpp | ||
htm/ntypes/Value.cpp | ||
htm/ntypes/Value-yamlcpp.cpp | ||
htm/ntypes/Value-rapidyaml.cpp | ||
htm/ntypes/Value-libyaml.cpp | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO, only one will be used when finalized |
||
htm/ntypes/Value.hpp | ||
) | ||
|
||
|
@@ -263,7 +261,7 @@ endif() | |
# | ||
set(src_combined_htmcore_source_archives | ||
${src_lib_static} | ||
${yaml-cpp_LIBRARIES} | ||
${yaml_LIBRARIES} | ||
${Boost_LIBRARIES} | ||
${common_LIBRARIES} | ||
) | ||
|
@@ -283,7 +281,7 @@ else() | |
# Note that these libraries must already exist (from depenancies) | ||
set(all_object_locations) | ||
set(src_externLibs | ||
${yaml-cpp_LIBRARIES} | ||
${yaml_LIBRARIES} | ||
${Boost_LIBRARIES} | ||
${common_LIBRARIES} | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i know this is a WIP, eventually we'll want to have just 1 parser.