From 2cb2e820929b1bf47b5feb5579cf60dd6cbaf0d0 Mon Sep 17 00:00:00 2001 From: DavidRagazzi Date: Wed, 12 Feb 2014 23:27:42 -0200 Subject: [PATCH 01/50] Update .travis.yml Last: #516 --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 056e1aa1ef..8c75194c82 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,7 +53,10 @@ install: # See: https://github.com/travis-ci/travis-cookbooks/issues/155 - "sudo rm -rf /dev/shm && sudo ln -s /run/shm /dev/shm" - pip install -q -r $NUPIC/external/common/requirements.txt - - "$NUPIC/build.sh" + - "mkdir -p $TRAVIS_BUILD_DIR/build/scripts" + - "cd $TRAVIS_BUILD_DIR/build/scripts" + - "cmake $NUPIC" + - "make -j3" script: # legacy binary tests From cfe940e21cd09c029885820128d1086f4574eb15 Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Thu, 13 Feb 2014 14:49:58 -0800 Subject: [PATCH 02/50] Changing into root of project before calling make. This is just a change to the travis config for the travis build. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 8c75194c82..c267d2f6f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,6 +57,7 @@ install: - "cd $TRAVIS_BUILD_DIR/build/scripts" - "cmake $NUPIC" - "make -j3" + - "cd" script: # legacy binary tests From 2bd9233ba56a524ec5228a7196951b01e3b19257 Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Thu, 13 Feb 2014 14:57:37 -0800 Subject: [PATCH 03/50] Allowing travis-ci to update submodules. --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index c267d2f6f9..ebf875dd85 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,9 +6,6 @@ python: - "2.6" - "2.7" -git: - submodules: false - env: global: - NUPIC=$TRAVIS_BUILD_DIR From 7432f32fc094201588a096a66ca8d681d7ab7470 Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Thu, 13 Feb 2014 15:42:07 -0800 Subject: [PATCH 04/50] Adding cd into NUPIC before running tests. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index ebf875dd85..04b51d5b7f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -62,6 +62,7 @@ script: # (not quite everything, really) - "$NTA/bin/testeverything" # actual unit tests + - "cd $NUPIC" - "$NUPIC/run_tests.sh --all" # run all example files From 3ca411789a3044fd1ad48c8874498f6e37d1d968 Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Thu, 13 Feb 2014 15:42:36 -0800 Subject: [PATCH 05/50] Updated README for CMake --- README.md | 80 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index c56f6632d9..e1b749829d 100644 --- a/README.md +++ b/README.md @@ -38,33 +38,13 @@ Currently supported platforms: Dependencies: * Python (2.6-2.7) (with development headers) * GCC (4.6-4.8), or Clang - * Make + * Make or any IDE supported by CMake (Visual Studio, Eclipse, XCode, KDevelop, etc) The dependencies are included in platform-specific repositories for convenience: * [nupic-linux64](https://github.com/numenta/nupic-linux64) for 64-bit Linux systems * [nupic-darwin64](https://github.com/numenta/nupic-darwin64) for 64-bit OS X systems -Add the following to your .bashrc file. Change the paths as needed. - - # Installation path - export NTA=$HOME/nta/eng - # Target source/repo path. Defaults to $PWD - export NUPIC=/path/to/repo - # Convenience variable for temporary build files - export BUILDDIR=/tmp/ntabuild - # Number of jobs to run in parallel (optional) - export MK_JOBS=3 - - # Set up the rest of the necessary env variables. Must be done after - # setting $NTA. - source $NUPIC/env.sh - -If you plan on making changes to NuPIC, add the following to your .bashrc file. - - # Developer mode: make build use symbolic links from source for Python files instead of copying files - export NTAX_DEVELOPER_BUILD=1 - Complete set of python requirements are documented in [requirements.txt](/external/common/requirements.txt), compatible with [pip](http://www.pip-installer.org/en/latest/cookbook.html#requirements-files): @@ -76,25 +56,61 @@ _Note_: If using pip 1.5 or later: _Note_: If you get a "permission denied" error when using pip, you may add the --user flag to install to a location in your home directory, which should resolve any permissions issues. Doing this, you may need to add this location to your PATH and PYTHONPATH. Alternatively, you can run pip with 'sudo'. -Build and install NuPIC: +## Build and test NuPIC: + +If you are manually building, be sure to update the `nupic.core` submodule by running the following command first: + + git submodule update + +Important notes: + * $REPOSITORY is the current location of the repository that you downloaded from GitHub. Usually its name is "nupic-master". + * After CMake generation, two useful environment variables will be created: + * $NUPIC which references $REPOSITORY (ie directory with all source code) + * $NTA which references $HOME/nta/eng (ie directory with all executables and libraries generated from build process). In case of this variable already is set on your system, $REPOSITORY/release creation will be discarded, and $NTA will be re-used. + +### Using command line + +#### Configure and generate build files: + + cd $REPOSITORY/build_system + cmake $REPOSITORY + +#### Build: + + cd $REPOSITORY/build_system + make -j3 + +Note: -j3 option specify '3' as the maximum number of parallel jobs/threads that Make will can use during build in order to gain speed. However you can increase this number depending your CPU. + +#### Run the C++ tests: + + cd $NTA/bin + htmtest + testeverything + +### Using graphical interface - $NUPIC/build.sh +#### Generate the IDE solution: -NuPIC should now be installed in $NTA! If the build failed, check to make sure that $NUPIC is set, and the value is the proper path to the local NuPIC repo. + * Open CMake executable. + * Specify the source folder ($REPOSITORY/source). + * Specify the build system folder ($REPOSITORY/build_system), ie where IDE solution will be created. + * Click 'Generate'. + * Choose the IDE that interest you (remember that IDE choice is limited to your OS, ie Visual Studio is available only on CMake for Windows). -## Try it out! +#### Build: -### Tests + * Open 'Nupic.*proj' solution file generated on $REPOSITORY/build_system. + * Run 'ALL_BUILD' project from your IDE. -Run the C++ tests: +#### Run the C++ tests: - $NTA/bin/htmtest - $NTA/bin/testeverything + * Run 'HtmTest' and 'TestEverything' projects from your IDE (check 'output' panel to see the results). -Run the Python unit tests: +### Run the Python unit tests: - cd $NTA - ./bin/run_tests.sh + cd $NTA/bin + ./run_tests.sh ### Examples From 5bd2dfa57507097ca1a4c9eeccc073837dbaa9df Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Thu, 13 Feb 2014 15:43:32 -0800 Subject: [PATCH 06/50] Removing submodule work within build.sh --- build.sh | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/build.sh b/build.sh index 827d75cf94..c94f06b3c5 100755 --- a/build.sh +++ b/build.sh @@ -76,24 +76,6 @@ function doMake { exitOnError $? } -function cleanUpCoreSubmodule { - # Someone might have removed the submodule directory, so let's put it back - # before running any submodule commands. - if [[ ! -d $NUPIC/nta ]] ; then - mkdir $NUPIC/nta - fi - pushd $NUPIC - git submodule foreach git clean -fd - popd -} - -function syncCoreSubmodule { - cleanUpCoreSubmodule - pushd $NUPIC - git submodule update --init - popd -} - function cleanUpDirectories { popd [[ -d $BUILDDIR ]] && echo "Warning: directory \"$BUILDDIR\" already exists and may contain (old) data. Consider removing it. " @@ -107,7 +89,6 @@ function cleanUpEnv { # Redirect stdout to a file but still print stderr. mkdir -p `dirname $STDOUT` { - syncCoreSubmodule prepDirectories pythonSetup @@ -116,7 +97,6 @@ mkdir -p `dirname $STDOUT` cleanUpDirectories cleanUpEnv - cleanUpCoreSubmodule } 2>&1 > $STDOUT echo From d80531eb8cf249040a516a2030545df13f84d7ac Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Thu, 13 Feb 2014 22:09:14 -0800 Subject: [PATCH 07/50] Trying to set default cpp compiler to GSS --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c68f837486..fdc0b036c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,7 +168,7 @@ endmacro() # Set c and c++ compiler. # According to CMake documentation, this must be done before any language is set (ie before any project() or enable_language() command). # -set(DEFAULT_COMPILER "" CACHE STRING "Default C/C++ compiler to be used (GCC / CLANG) [default=none]") +set(DEFAULT_COMPILER "" CACHE STRING "Default C/C++ compiler to be used (GCC / CLANG) [default=GCC]") if("${DEFAULT_COMPILER}" STREQUAL "CLANG") set(CMAKE_C_COMPILER "clang") set(CMAKE_CXX_COMPILER "clang++") From bfe666e5b465dc330e0ada400c960e62d3bdbf58 Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Thu, 13 Feb 2014 22:25:19 -0800 Subject: [PATCH 08/50] Reverting change to default cpp compiler (didn't work). --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fdc0b036c4..c68f837486 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,7 +168,7 @@ endmacro() # Set c and c++ compiler. # According to CMake documentation, this must be done before any language is set (ie before any project() or enable_language() command). # -set(DEFAULT_COMPILER "" CACHE STRING "Default C/C++ compiler to be used (GCC / CLANG) [default=GCC]") +set(DEFAULT_COMPILER "" CACHE STRING "Default C/C++ compiler to be used (GCC / CLANG) [default=none]") if("${DEFAULT_COMPILER}" STREQUAL "CLANG") set(CMAKE_C_COMPILER "clang") set(CMAKE_CXX_COMPILER "clang++") From 746fb2ade3f2e5112a67391b239991a2345b13ee Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Fri, 14 Feb 2014 08:31:13 -0800 Subject: [PATCH 09/50] Trying David's suggestion about default compiler --- CMakeLists.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c68f837486..f6ef43241f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,13 +168,21 @@ endmacro() # Set c and c++ compiler. # According to CMake documentation, this must be done before any language is set (ie before any project() or enable_language() command). # -set(DEFAULT_COMPILER "" CACHE STRING "Default C/C++ compiler to be used (GCC / CLANG) [default=none]") +set(SYSTEM_COMPILER "") +if($ENV{CC} MATCHES "clang") + set(SYSTEM_COMPILER "CLANG") +elseif($ENV{CC} MATCHES "gcc") + set(SYSTEM_COMPILER "GCC") +endif() +set(DEFAULT_COMPILER "${SYSTEM_COMPILER}" CACHE STRING "Default C/C++ compiler to be used (GCC / CLANG) [default=system compiler]") if("${DEFAULT_COMPILER}" STREQUAL "CLANG") set(CMAKE_C_COMPILER "clang") set(CMAKE_CXX_COMPILER "clang++") elseif("${DEFAULT_COMPILER}" STREQUAL "GCC") set(CMAKE_C_COMPILER "gcc") set(CMAKE_CXX_COMPILER "g++") +else() + message(FATAL_ERROR "Only GCC or CLANG compilers are accepted by Nupic. If you have these compilers use DEFAULT_COMPILER option or CC environment variables to specify them.") endif() cmake_minimum_required(VERSION 2.8) From f44b662faa5507027e539e8aab51e99da0c2f347 Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Fri, 14 Feb 2014 09:01:32 -0800 Subject: [PATCH 10/50] Reverting previous CMake default compiler fix. Because it didn't work. Trial and error with Travis at this point. --- CMakeLists.txt | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f6ef43241f..c68f837486 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,21 +168,13 @@ endmacro() # Set c and c++ compiler. # According to CMake documentation, this must be done before any language is set (ie before any project() or enable_language() command). # -set(SYSTEM_COMPILER "") -if($ENV{CC} MATCHES "clang") - set(SYSTEM_COMPILER "CLANG") -elseif($ENV{CC} MATCHES "gcc") - set(SYSTEM_COMPILER "GCC") -endif() -set(DEFAULT_COMPILER "${SYSTEM_COMPILER}" CACHE STRING "Default C/C++ compiler to be used (GCC / CLANG) [default=system compiler]") +set(DEFAULT_COMPILER "" CACHE STRING "Default C/C++ compiler to be used (GCC / CLANG) [default=none]") if("${DEFAULT_COMPILER}" STREQUAL "CLANG") set(CMAKE_C_COMPILER "clang") set(CMAKE_CXX_COMPILER "clang++") elseif("${DEFAULT_COMPILER}" STREQUAL "GCC") set(CMAKE_C_COMPILER "gcc") set(CMAKE_CXX_COMPILER "g++") -else() - message(FATAL_ERROR "Only GCC or CLANG compilers are accepted by Nupic. If you have these compilers use DEFAULT_COMPILER option or CC environment variables to specify them.") endif() cmake_minimum_required(VERSION 2.8) From b1708bd6ec40c9715844dafbcb480229401236a1 Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Fri, 14 Feb 2014 09:02:57 -0800 Subject: [PATCH 11/50] Added -Wsign-compare compile option for gcc. In an attempt to make travis gcc matrix happy. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c68f837486..2c4627b606 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -514,6 +514,7 @@ message(STATUS " MPI Support: ${NTA_MPI_SUPPORT}") # Set GNU c/c++ flags in case of CLang is off. # if("${DEFAULT_COMPILER}" STREQUAL "GCC") + set(NTA_CXXFLAGS_BASE "${NTA_CXXFLAGS_BASE} -Wsign-compare") set(NTA_CXXFLAGS_OPTIMIZATION "${NTA_CXXFLAGS_OPTIMIZATION} -falign-loops=16") endif() From ede1ad09526a917d169537b2ee6771e762a39a26 Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Mon, 17 Feb 2014 13:06:58 -0800 Subject: [PATCH 12/50] Removing -std=c++0x compile option for gcc. This option seemed to be affecting gcc builds. Trying its removal to see if it helps with CI. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c4627b606..45c6cebc10 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -440,7 +440,7 @@ set(NTA_INCLUDEFLAGS "-I${PROJECT_SOURCE_DIR} -I${PROJECT_SOURCE_DIR}/external/c # NTA_INTERNAL tells us that the code is being built under the build system # and not as a separate program. Used for cppvision example. # -set(NTA_CXXFLAGS_BASE "${NTA_INCLUDEFLAGS} ${NTA_PLATFORM_CXXFLAGS} -DHAVE_CONFIG_H -DNTA_INTERNAL -DNTA_PLATFORM_${NTA_PLATFORM_OS} -DBOOST_NO_WREGEX -DNUPIC2 -fvisibility=hidden -std=c++0x -Wall -Wreturn-type -Wunused-variable -Wno-deprecated") +set(NTA_CXXFLAGS_BASE "${NTA_INCLUDEFLAGS} ${NTA_PLATFORM_CXXFLAGS} -DHAVE_CONFIG_H -DNTA_INTERNAL -DNTA_PLATFORM_${NTA_PLATFORM_OS} -DBOOST_NO_WREGEX -DNUPIC2 -fvisibility=hidden -Wall -Wreturn-type -Wunused-variable -Wno-deprecated") # # All executables and plugins are linked with these flags From f600a8abae4b634fee522224b34ca6d2c1a65556 Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Mon, 17 Feb 2014 13:09:12 -0800 Subject: [PATCH 13/50] Fixed -Wno-sign-compare warning option. As suggested by @DavidRagazzi. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 45c6cebc10..0227afe339 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -514,7 +514,7 @@ message(STATUS " MPI Support: ${NTA_MPI_SUPPORT}") # Set GNU c/c++ flags in case of CLang is off. # if("${DEFAULT_COMPILER}" STREQUAL "GCC") - set(NTA_CXXFLAGS_BASE "${NTA_CXXFLAGS_BASE} -Wsign-compare") + set(NTA_CXXFLAGS_BASE "${NTA_CXXFLAGS_BASE} -Wno-sign-compare") set(NTA_CXXFLAGS_OPTIMIZATION "${NTA_CXXFLAGS_OPTIMIZATION} -falign-loops=16") endif() From 8dbd4df4e5c4a1df9ff1d051febd6e9a7ca9a3b4 Mon Sep 17 00:00:00 2001 From: DavidRagazzi Date: Tue, 18 Feb 2014 09:54:57 -0300 Subject: [PATCH 14/50] Update CMakeLists.txt --- CMakeLists.txt | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0227afe339..8dfaf88a18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,17 +168,18 @@ endmacro() # Set c and c++ compiler. # According to CMake documentation, this must be done before any language is set (ie before any project() or enable_language() command). # -set(DEFAULT_COMPILER "" CACHE STRING "Default C/C++ compiler to be used (GCC / CLANG) [default=none]") -if("${DEFAULT_COMPILER}" STREQUAL "CLANG") - set(CMAKE_C_COMPILER "clang") - set(CMAKE_CXX_COMPILER "clang++") -elseif("${DEFAULT_COMPILER}" STREQUAL "GCC") - set(CMAKE_C_COMPILER "gcc") - set(CMAKE_CXX_COMPILER "g++") +set(DEFAULT_COMPILER "" CACHE STRING "Default C/C++ compiler to be used (GCC / CLANG) [default=system compiler]") +if(${DEFAULT_COMPILER} MATCHES "clang" OR ${DEFAULT_COMPILER} MATCHES "g[+][+]") + set(CMAKE_CXX_COMPILER "${DEFAULT_COMPILER}") endif() cmake_minimum_required(VERSION 2.8) -project(Nupic) +project(Nupic CXX) + +# Check if default C/C++ compiler is GNU or CLANG, otherwise exit with error. +if(NOT(CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER} MATCHES "clang")) + message(FATAL_ERROR "${CMAKE_CXX_COMPILER} compiler not supported yet. If you have GNU or CLANG C++ compiler installed on your machine change $CXX environment variable or pass its location through DEFAULT_COMPILER option.") +endif() # # Sets default locations. @@ -513,7 +514,7 @@ message(STATUS " MPI Support: ${NTA_MPI_SUPPORT}") # # Set GNU c/c++ flags in case of CLang is off. # -if("${DEFAULT_COMPILER}" STREQUAL "GCC") +if(CMAKE_COMPILER_IS_GNUCXX) set(NTA_CXXFLAGS_BASE "${NTA_CXXFLAGS_BASE} -Wno-sign-compare") set(NTA_CXXFLAGS_OPTIMIZATION "${NTA_CXXFLAGS_OPTIMIZATION} -falign-loops=16") endif() From b9a9c36bfd513fa3bf7d2ce91eeb64297b7f4ae0 Mon Sep 17 00:00:00 2001 From: DavidRagazzi Date: Tue, 18 Feb 2014 10:31:18 -0300 Subject: [PATCH 15/50] Update CMakeLists.txt --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8dfaf88a18..96f8456984 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -515,7 +515,7 @@ message(STATUS " MPI Support: ${NTA_MPI_SUPPORT}") # Set GNU c/c++ flags in case of CLang is off. # if(CMAKE_COMPILER_IS_GNUCXX) - set(NTA_CXXFLAGS_BASE "${NTA_CXXFLAGS_BASE} -Wno-sign-compare") + set(NTA_CXXFLAGS_BASE "${NTA_CXXFLAGS_BASE}") set(NTA_CXXFLAGS_OPTIMIZATION "${NTA_CXXFLAGS_OPTIMIZATION} -falign-loops=16") endif() From a5370fee18e56978678fdf71c9c6d1d172312592 Mon Sep 17 00:00:00 2001 From: DavidRagazzi Date: Tue, 18 Feb 2014 10:37:28 -0300 Subject: [PATCH 16/50] Update CMakeLists.txt --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 96f8456984..8dfaf88a18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -515,7 +515,7 @@ message(STATUS " MPI Support: ${NTA_MPI_SUPPORT}") # Set GNU c/c++ flags in case of CLang is off. # if(CMAKE_COMPILER_IS_GNUCXX) - set(NTA_CXXFLAGS_BASE "${NTA_CXXFLAGS_BASE}") + set(NTA_CXXFLAGS_BASE "${NTA_CXXFLAGS_BASE} -Wno-sign-compare") set(NTA_CXXFLAGS_OPTIMIZATION "${NTA_CXXFLAGS_OPTIMIZATION} -falign-loops=16") endif() From 93e58026ff07a320c37d9b0ef813c59de5f5d965 Mon Sep 17 00:00:00 2001 From: DavidRagazzi Date: Tue, 18 Feb 2014 12:52:09 -0300 Subject: [PATCH 17/50] Update CMakeLists.txt --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8dfaf88a18..3c18f7b02e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -169,7 +169,7 @@ endmacro() # According to CMake documentation, this must be done before any language is set (ie before any project() or enable_language() command). # set(DEFAULT_COMPILER "" CACHE STRING "Default C/C++ compiler to be used (GCC / CLANG) [default=system compiler]") -if(${DEFAULT_COMPILER} MATCHES "clang" OR ${DEFAULT_COMPILER} MATCHES "g[+][+]") +if(NOT "${DEFAULT_COMPILER}" STREQUAL "") set(CMAKE_CXX_COMPILER "${DEFAULT_COMPILER}") endif() From cef3232d5b83829100182bf7b3dcd4d4d37a7f71 Mon Sep 17 00:00:00 2001 From: DavidRagazzi Date: Tue, 18 Feb 2014 13:28:55 -0300 Subject: [PATCH 18/50] DEFAULT_COMPILER renamed to USER_CXX_COMPILER --- CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c18f7b02e..fee207e90b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -165,12 +165,12 @@ endmacro() ############################################################################################################################ # -# Set c and c++ compiler. +# Set C++ compiler. # According to CMake documentation, this must be done before any language is set (ie before any project() or enable_language() command). # -set(DEFAULT_COMPILER "" CACHE STRING "Default C/C++ compiler to be used (GCC / CLANG) [default=system compiler]") -if(NOT "${DEFAULT_COMPILER}" STREQUAL "") - set(CMAKE_CXX_COMPILER "${DEFAULT_COMPILER}") +set(USER_CXX_COMPILER "" CACHE STRING "Default C++ compiler to be used (GCC / CLANG) [default=system compiler]") +if(NOT "${USER_CXX_COMPILER}" STREQUAL "") + set(CMAKE_CXX_COMPILER "${USER_CXX_COMPILER}") endif() cmake_minimum_required(VERSION 2.8) @@ -178,7 +178,7 @@ project(Nupic CXX) # Check if default C/C++ compiler is GNU or CLANG, otherwise exit with error. if(NOT(CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER} MATCHES "clang")) - message(FATAL_ERROR "${CMAKE_CXX_COMPILER} compiler not supported yet. If you have GNU or CLANG C++ compiler installed on your machine change $CXX environment variable or pass its location through DEFAULT_COMPILER option.") + message(FATAL_ERROR "${CMAKE_CXX_COMPILER} compiler not supported yet. If you have GNU or CLANG C++ compiler installed on your machine change $CXX environment variable or pass its location through USER_CXX_COMPILER option.") endif() # From 32b6e143cf7f67a8132f08313eec3e7851845afb Mon Sep 17 00:00:00 2001 From: DavidRagazzi Date: Tue, 18 Feb 2014 20:31:51 -0300 Subject: [PATCH 19/50] Update CMakeLists.txt --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fee207e90b..a2cfeed411 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -446,7 +446,7 @@ set(NTA_CXXFLAGS_BASE "${NTA_INCLUDEFLAGS} ${NTA_PLATFORM_CXXFLAGS} -DHAVE_CONFI # # All executables and plugins are linked with these flags # -set(NTA_LINKFLAGS "${NTA_PLATFORM_LINKFLAGS} ${NTA_PLATFORM_LIBS} -L${PROJECT_SOURCE_DIR}/external/${NTA_PLATFORM_OS}/lib") +set(NTA_LINKFLAGS "${NTA_PLATFORM_LINKFLAGS} -lm -lpthread -ldl -lutil -lstdc++ ${NTA_PLATFORM_LIBS} -L${PROJECT_SOURCE_DIR}/external/${NTA_PLATFORM_OS}/lib") message(STATUS "Options:") From 1f5e88fafbcb0b1509ee959d8b3277b6d7082f27 Mon Sep 17 00:00:00 2001 From: DavidRagazzi Date: Tue, 18 Feb 2014 20:38:37 -0300 Subject: [PATCH 20/50] Update CMakeLists.txt --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a2cfeed411..fee207e90b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -446,7 +446,7 @@ set(NTA_CXXFLAGS_BASE "${NTA_INCLUDEFLAGS} ${NTA_PLATFORM_CXXFLAGS} -DHAVE_CONFI # # All executables and plugins are linked with these flags # -set(NTA_LINKFLAGS "${NTA_PLATFORM_LINKFLAGS} -lm -lpthread -ldl -lutil -lstdc++ ${NTA_PLATFORM_LIBS} -L${PROJECT_SOURCE_DIR}/external/${NTA_PLATFORM_OS}/lib") +set(NTA_LINKFLAGS "${NTA_PLATFORM_LINKFLAGS} ${NTA_PLATFORM_LIBS} -L${PROJECT_SOURCE_DIR}/external/${NTA_PLATFORM_OS}/lib") message(STATUS "Options:") From e5b6fcf43c522ee51b34c3b24dda2fff9a6d7c49 Mon Sep 17 00:00:00 2001 From: DavidRagazzi Date: Tue, 18 Feb 2014 21:42:48 -0300 Subject: [PATCH 21/50] Update CMakeLists.txt --- CMakeLists.txt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fee207e90b..78bfec09fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,6 +109,7 @@ macro(generate_executable name cxx_flags source_files link_flags libraries) ) set_target_properties(${name} PROPERTIES COMPILE_FLAGS "${cxx_flags}") set_target_properties(${name} PROPERTIES LINK_FLAGS "${link_flags}") + message("LINK: ${link_flags}") endmacro() # This macro generates a static library @@ -258,11 +259,10 @@ elseif(LINUX) set(NTA_PLATFORM_CXXFLAGS "-fPIC -DPIC -m64") set(NTA_PLATFORM_ASFLAGS "-msse2") set(NTA_PLATFORM_DEBUGFLAGS "-g") - # NTA_PLATFORM_LINKFLAGS="-static-libgcc" + set(NTA_PLATFORM_LINKFLAGS "-Wl,--no-as-needed -static-libgcc") # pthread needed by libapr-1 set(NTA_PLATFORM_LIBS "-lm -lpthread -ldl -lutil -lstdc++") set(NTA_PLATFORM_MPI_EXTRA_LIBS "-lrt") - set(NTA_PLATFORM_LINKFLAGS_TEST "-Wl,-R\${libdir}/test") set(NTA_PLATFORM_LINKFLAGS_PYMODULE "-pthread -shared") set(NTA_PLATFORM_LINKFLAGS_PYEMBED "-Wl,--export-dynamic") else() @@ -270,10 +270,9 @@ elseif(LINUX) set(NTA_PLATFORM_CXXFLAGS "-fPIC -DPIC -ffloat-store") set(NTA_PLATFORM_ASFLAGS "") set(NTA_PLATFORM_DEBUGFLAGS "-g") - set(NTA_PLATFORM_LINKFLAGS "-static-libgcc") - set(NTA_PLATFORM_LIBS "-lm -lstdc++ -lpthread -ldl -lutil -lrt") + set(NTA_PLATFORM_LINKFLAGS "-Wl,--no-as-needed -static-libgcc") + set(NTA_PLATFORM_LIBS "-lm -lpthread -ldl -lutil -lstdc++ -lrt") set(NTA_PLATFORM_MPI_EXTRA_LIBS "-lrt") - set(NTA_PLATFORM_LINKFLAGS_TEST "-Wl,-R\${libdir}/test") set(NTA_PLATFORM_LINKFLAGS_PYMODULE "-pthread -shared") set(NTA_PLATFORM_LINKFLAGS_PYEMBED "-Wl,--export-dynamic") endif() @@ -285,7 +284,6 @@ elseif(WINDOWS) set(NTA_PLATFORM_LINKFLAGS "") set(NTA_PLATFORM_LIBS "") set(NTA_PLATFORM_MPI_EXTRA_LIBS "") - set(NTA_PLATFORM_LINKFLAGS_TEST "") set(NTA_PLATFORM_LINKFLAGS_PYMODULE "") set(NTA_PLATFORM_LINKFLAGS_PYEMBED "") else() @@ -300,7 +298,6 @@ message(STATUS " CXX flags: ${NTA_PLATFORM_CXXFLAGS}") message(STATUS " AS flags: ${NTA_PLATFORM_ASFLAGS}") message(STATUS " Debug flags: ${NTA_PLATFORM_DEBUGFLAGS}") message(STATUS " LD flags: ${NTA_PLATFORM_LINKFLAGS}") -message(STATUS " Test library link flags: ${NTA_PLATFORM_LINKFLAGS_TEST}") message(STATUS " Python extension link flags: ${NTA_PLATFORM_LINKFLAGS_PYMODULE}") message(STATUS " Python embedding link flags: ${NTA_PLATFORM_LINKFLAGS_PYEMBED}") From ce39b7f44dcf7e778798118bc9d9fe7219004015 Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Tue, 18 Feb 2014 21:09:21 -0800 Subject: [PATCH 22/50] Updated an incorrect path in README for running python tests. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e1b749829d..c5e20040e0 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,7 @@ Note: -j3 option specify '3' as the maximum number of parallel jobs/threads that ### Run the Python unit tests: - cd $NTA/bin + cd $NUPIC ./run_tests.sh ### Examples From f06c5f22b941e2638c9a5ef154b1dd0d4d93e6f7 Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Tue, 18 Feb 2014 21:11:15 -0800 Subject: [PATCH 23/50] Another update to README for running python tests. Added absolute path and added --all option. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c5e20040e0..82b8112f3d 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ Note: -j3 option specify '3' as the maximum number of parallel jobs/threads that ### Run the Python unit tests: cd $NUPIC - ./run_tests.sh + $NUPIC/run_tests.sh --all ### Examples From 5524f5efb9d1c9d25c4723044020948b4002e07d Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Tue, 18 Feb 2014 21:27:21 -0800 Subject: [PATCH 24/50] We don't want ./run_tests.sh --all option. Because it requires mysql for swarming. Sorry about the extra commit. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 82b8112f3d..8b4af1fe2b 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ Note: -j3 option specify '3' as the maximum number of parallel jobs/threads that ### Run the Python unit tests: cd $NUPIC - $NUPIC/run_tests.sh --all + $NUPIC/run_tests.sh ### Examples From 6ccc9c0344c64e9a398a606abef045793b0450d3 Mon Sep 17 00:00:00 2001 From: DavidRagazzi Date: Wed, 19 Feb 2014 08:24:18 -0300 Subject: [PATCH 25/50] Update CMakeLists.txt --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 78bfec09fd..d989fd9e31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -216,6 +216,15 @@ set(TEMP_BUILD_DIR "/tmp/ntabuild") # CMAKE_CURRENT_BINARY_DIR is used by swig module for put wrappers on, so don't erase this line! set(CMAKE_CURRENT_BINARY_DIR ${TEMP_BUILD_DIR}) +# +# Update repository submodules +# +execute_process(COMMAND ${PROJECT_SOURCE_DIR}/nta/git submodule update + RESULT_VARIABLE EXIT_CODE) +if(NOT EXIT_CODE EQUAL 0) + message(FATAL_ERROR "It was not possible update nupic.core.") +endif() + # # Set OS flags # From dabb3b1c0267cf631205efd45e0e6bd116dcd105 Mon Sep 17 00:00:00 2001 From: DavidRagazzi Date: Wed, 19 Feb 2014 08:29:09 -0300 Subject: [PATCH 26/50] Update CMakeLists.txt --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d989fd9e31..317def39b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -219,7 +219,8 @@ set(CMAKE_CURRENT_BINARY_DIR ${TEMP_BUILD_DIR}) # # Update repository submodules # -execute_process(COMMAND ${PROJECT_SOURCE_DIR}/nta/git submodule update +execute_process(COMMAND git submodule update + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/nta RESULT_VARIABLE EXIT_CODE) if(NOT EXIT_CODE EQUAL 0) message(FATAL_ERROR "It was not possible update nupic.core.") From ca17282756bbfd675004fd8db1fd616c8c7db863 Mon Sep 17 00:00:00 2001 From: DavidRagazzi Date: Wed, 19 Feb 2014 08:31:35 -0300 Subject: [PATCH 27/50] Update CMakeLists.txt --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 317def39b5..5c76e73cbb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,7 +109,6 @@ macro(generate_executable name cxx_flags source_files link_flags libraries) ) set_target_properties(${name} PROPERTIES COMPILE_FLAGS "${cxx_flags}") set_target_properties(${name} PROPERTIES LINK_FLAGS "${link_flags}") - message("LINK: ${link_flags}") endmacro() # This macro generates a static library From 1c7f594e4385dd8207ee1f8ee56414a8b92d2ee8 Mon Sep 17 00:00:00 2001 From: DavidRagazzi Date: Wed, 19 Feb 2014 08:58:13 -0300 Subject: [PATCH 28/50] Update CMakeLists.txt --- CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c76e73cbb..ec6ae05f37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -218,10 +218,13 @@ set(CMAKE_CURRENT_BINARY_DIR ${TEMP_BUILD_DIR}) # # Update repository submodules # +execute_process(COMMAND git submodule init + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/nta + RESULT_VARIABLE SUBMODULE_INIT_EXIT_CODE) execute_process(COMMAND git submodule update WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/nta - RESULT_VARIABLE EXIT_CODE) -if(NOT EXIT_CODE EQUAL 0) + RESULT_VARIABLE SUBMODULE_UPDATE_EXIT_CODE) +if((SUBMODULE_INIT_EXIT_CODE EQUAL 0) OR (SUBMODULE_UPDATE_EXIT_CODE EQUAL 0)) message(FATAL_ERROR "It was not possible update nupic.core.") endif() From 200cd2e7922045ea8564f3437db3244910a74d5e Mon Sep 17 00:00:00 2001 From: DavidRagazzi Date: Wed, 19 Feb 2014 09:07:37 -0300 Subject: [PATCH 29/50] Update CMakeLists.txt --- CMakeLists.txt | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ec6ae05f37..7d5b37c4d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,22 @@ ### ### ############################################################################################################################ +# This macro updates a repository submodule +macro (update_submodule submodule_dir) + message(STATUS "Copying from '${src}' to '${dst}'") + execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${src} ${dst}) + + execute_process(COMMAND git submodule init + WORKING_DIRECTORY ${submodule_dir} + RESULT_VARIABLE submodule_init_exit_code) + execute_process(COMMAND git submodule update + WORKING_DIRECTORY ${submodule_dir} + RESULT_VARIABLE submodule_update_exit_code) + if((submodule_init_exit_code EQUAL 0) OR (submodule_update_exit_code EQUAL 0)) + message(FATAL_ERROR "It was not possible update '${submodule_dir}' submodule.") + endif() +endmacro() + # This macro set environment variables of the operating system macro (show_environment_variable variable value) message(STATUS " ${variable} = ${value}") @@ -218,15 +234,7 @@ set(CMAKE_CURRENT_BINARY_DIR ${TEMP_BUILD_DIR}) # # Update repository submodules # -execute_process(COMMAND git submodule init - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/nta - RESULT_VARIABLE SUBMODULE_INIT_EXIT_CODE) -execute_process(COMMAND git submodule update - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/nta - RESULT_VARIABLE SUBMODULE_UPDATE_EXIT_CODE) -if((SUBMODULE_INIT_EXIT_CODE EQUAL 0) OR (SUBMODULE_UPDATE_EXIT_CODE EQUAL 0)) - message(FATAL_ERROR "It was not possible update nupic.core.") -endif() +update_submodule("${PROJECT_SOURCE_DIR}/nta") # # Set OS flags From 8bc70be51928855a40b0d8c053625fb7fc426629 Mon Sep 17 00:00:00 2001 From: DavidRagazzi Date: Wed, 19 Feb 2014 09:11:11 -0300 Subject: [PATCH 30/50] Update CMakeLists.txt --- CMakeLists.txt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d5b37c4d4..555e53e9c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,16 +31,13 @@ # This macro updates a repository submodule macro (update_submodule submodule_dir) - message(STATUS "Copying from '${src}' to '${dst}'") - execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${src} ${dst}) - execute_process(COMMAND git submodule init WORKING_DIRECTORY ${submodule_dir} RESULT_VARIABLE submodule_init_exit_code) execute_process(COMMAND git submodule update WORKING_DIRECTORY ${submodule_dir} RESULT_VARIABLE submodule_update_exit_code) - if((submodule_init_exit_code EQUAL 0) OR (submodule_update_exit_code EQUAL 0)) + if(NOT(submodule_init_exit_code EQUAL 0 AND submodule_update_exit_code EQUAL 0)) message(FATAL_ERROR "It was not possible update '${submodule_dir}' submodule.") endif() endmacro() From b1403e5ce1adf5457534aaa173606363a4cc198d Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Wed, 19 Feb 2014 07:23:28 -0800 Subject: [PATCH 31/50] Telling Travis not to update submodules --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 099ee1a670..1686f35d15 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,9 @@ python: - "2.6" - "2.7" +git: + - submodules: false + env: global: - NUPIC=$TRAVIS_BUILD_DIR From 6525f2aae91c0a570659f88d74c889045bae66ec Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Wed, 19 Feb 2014 09:23:05 -0800 Subject: [PATCH 32/50] trying previous travis config format --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1686f35d15..b756f88ad4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ python: - "2.7" git: - - submodules: false + submodules: false env: global: From 2745a99961efab5865b5cf2714f4bbe7d1ef551b Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Wed, 19 Feb 2014 11:43:58 -0800 Subject: [PATCH 33/50] Simplified submodule update within cmake. Consolidated two commands into one. No need for reference to the `nta` directory, because the submodule command should be executed from within the parent directory. --- CMakeLists.txt | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 555e53e9c2..cc857d35af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,15 +30,12 @@ ############################################################################################################################ # This macro updates a repository submodule -macro (update_submodule submodule_dir) - execute_process(COMMAND git submodule init - WORKING_DIRECTORY ${submodule_dir} - RESULT_VARIABLE submodule_init_exit_code) - execute_process(COMMAND git submodule update - WORKING_DIRECTORY ${submodule_dir} +macro (update_submodules) + execute_process(COMMAND git submodule update --init + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} RESULT_VARIABLE submodule_update_exit_code) - if(NOT(submodule_init_exit_code EQUAL 0 AND submodule_update_exit_code EQUAL 0)) - message(FATAL_ERROR "It was not possible update '${submodule_dir}' submodule.") + if(NOT(submodule_update_exit_code EQUAL 0)) + message(FATAL_ERROR "Updating submodules within ${PROJECT_SOURCE_DIR} failed.") endif() endmacro() @@ -231,7 +228,7 @@ set(CMAKE_CURRENT_BINARY_DIR ${TEMP_BUILD_DIR}) # # Update repository submodules # -update_submodule("${PROJECT_SOURCE_DIR}/nta") +update_submodules() # # Set OS flags From ee542d007a5ad9c2ed88a37cfca7146286f620d1 Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Wed, 19 Feb 2014 14:20:36 -0800 Subject: [PATCH 34/50] Update nupic.core submodule. Which includes a fix we need for clang on Mavericks. --- nta | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nta b/nta index 3ec7f2f7ca..10fec166ef 160000 --- a/nta +++ b/nta @@ -1 +1 @@ -Subproject commit 3ec7f2f7ca7cc46e300b70e05585d9ab6d72b70d +Subproject commit 10fec166ef997d540e3c9e4a0128339a71d13195 From 7d0901d84b4398d2b7cde0de180d6d4465b37efb Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Wed, 19 Feb 2014 15:04:35 -0800 Subject: [PATCH 35/50] Removed git submodule update instructions. This is done by CMake now, so there is no need to manually do it. --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 8b4af1fe2b..6c951ffd0c 100644 --- a/README.md +++ b/README.md @@ -58,10 +58,6 @@ _Note_: If you get a "permission denied" error when using pip, you may add the - ## Build and test NuPIC: -If you are manually building, be sure to update the `nupic.core` submodule by running the following command first: - - git submodule update - Important notes: * $REPOSITORY is the current location of the repository that you downloaded from GitHub. Usually its name is "nupic-master". * After CMake generation, two useful environment variables will be created: From 8b34f0363964640d1fc4238f12a7ef25cfabcd1a Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Wed, 19 Feb 2014 15:10:13 -0800 Subject: [PATCH 36/50] Cleanup in README --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6c951ffd0c..1f1a6efcf9 100644 --- a/README.md +++ b/README.md @@ -59,10 +59,10 @@ _Note_: If you get a "permission denied" error when using pip, you may add the - ## Build and test NuPIC: Important notes: - * $REPOSITORY is the current location of the repository that you downloaded from GitHub. Usually its name is "nupic-master". + * $REPOSITORY is the current location of the repository that you downloaded from GitHub. * After CMake generation, two useful environment variables will be created: - * $NUPIC which references $REPOSITORY (ie directory with all source code) - * $NTA which references $HOME/nta/eng (ie directory with all executables and libraries generated from build process). In case of this variable already is set on your system, $REPOSITORY/release creation will be discarded, and $NTA will be re-used. + * $NUPIC, which is the same as $REPOSITORY + * $NTA, which references $HOME/nta/eng (the directory with all executables and libraries generated from build process). If this variable is already set, the $REPOSITORY/release will not be created, and $NTA will be used as the release directory. ### Using command line @@ -76,7 +76,7 @@ Important notes: cd $REPOSITORY/build_system make -j3 -Note: -j3 option specify '3' as the maximum number of parallel jobs/threads that Make will can use during build in order to gain speed. However you can increase this number depending your CPU. +> **Note**: -j3 option specify '3' as the maximum number of parallel jobs/threads that Make will use during the build in order to gain speed. However, you can increase this number depending your CPU. #### Run the C++ tests: From 1f2b3117057aaec822e805aa49e74a6074a61fe4 Mon Sep 17 00:00:00 2001 From: DavidRagazzi Date: Thu, 20 Feb 2014 08:03:19 -0300 Subject: [PATCH 37/50] Replacement of UpdateSubmodules to inline command. --- CMakeLists.txt | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc857d35af..ac28336f5a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,16 +29,6 @@ ### ### ############################################################################################################################ -# This macro updates a repository submodule -macro (update_submodules) - execute_process(COMMAND git submodule update --init - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - RESULT_VARIABLE submodule_update_exit_code) - if(NOT(submodule_update_exit_code EQUAL 0)) - message(FATAL_ERROR "Updating submodules within ${PROJECT_SOURCE_DIR} failed.") - endif() -endmacro() - # This macro set environment variables of the operating system macro (show_environment_variable variable value) message(STATUS " ${variable} = ${value}") @@ -228,7 +218,12 @@ set(CMAKE_CURRENT_BINARY_DIR ${TEMP_BUILD_DIR}) # # Update repository submodules # -update_submodules() +execute_process(COMMAND git submodule update --init + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + RESULT_VARIABLE EXIT_CODE) +if(NOT EXIT_CODE EQUAL 0) + message(FATAL_ERROR "Updating submodules within ${PROJECT_SOURCE_DIR} failed.") +endif() # # Set OS flags @@ -323,7 +318,8 @@ message(STATUS " Python embedding link flags: ${NTA_PLATFORM_LINKFLAGS_PYEMBED} # Instead we just use a shell command to execute a simple python command, if exit code is 0 ('success') then we have python installed. # message(STATUS "Checking software tools...") -execute_process(COMMAND python --version RESULT_VARIABLE EXIT_CODE) +execute_process(COMMAND python --version + RESULT_VARIABLE EXIT_CODE) if(NOT EXIT_CODE EQUAL 0) message(FATAL_ERROR "System Python not found. You do not have a system version of Python or it is not set on environment path.") endif() From b6a3cfaf0107b23b88d4f95951a50f25c8f59c4a Mon Sep 17 00:00:00 2001 From: DavidRagazzi Date: Thu, 20 Feb 2014 08:15:05 -0300 Subject: [PATCH 38/50] Update CMakeLists.txt --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ac28336f5a..0bee625ac4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -258,7 +258,7 @@ if(OSX) set(NTA_PLATFORM_ASFLAGS "") set(NTA_PLATFORM_DEBUGFLAGS "-gfull") set(NTA_PLATFORM_LINKFLAGS "-Wl,-u,_munmap") - set(NTA_PLATFORM_LIBS "-liconv -lsqlite3 -framework CoreServices -framework Accelerate") + set(NTA_PLATFORM_LIBS "-stdlib=libstdc++ -liconv -lsqlite3 -framework CoreServices -framework Accelerate") set(NTA_PLATFORM_MPI_EXTRA_LIBS "") set(NTA_PLATFORM_LINKFLAGS_PYMODULE "-bundle -undefined dynamic_lookup -fPIC") set(NTA_PLATFORM_LINKFLAGS_PYEMBED "") @@ -270,7 +270,7 @@ elseif(LINUX) set(NTA_PLATFORM_DEBUGFLAGS "-g") set(NTA_PLATFORM_LINKFLAGS "-Wl,--no-as-needed -static-libgcc") # pthread needed by libapr-1 - set(NTA_PLATFORM_LIBS "-lm -lpthread -ldl -lutil -lstdc++") + set(NTA_PLATFORM_LIBS "-stdlib=libstdc++ -lm -lpthread -ldl -lutil") set(NTA_PLATFORM_MPI_EXTRA_LIBS "-lrt") set(NTA_PLATFORM_LINKFLAGS_PYMODULE "-pthread -shared") set(NTA_PLATFORM_LINKFLAGS_PYEMBED "-Wl,--export-dynamic") @@ -280,7 +280,7 @@ elseif(LINUX) set(NTA_PLATFORM_ASFLAGS "") set(NTA_PLATFORM_DEBUGFLAGS "-g") set(NTA_PLATFORM_LINKFLAGS "-Wl,--no-as-needed -static-libgcc") - set(NTA_PLATFORM_LIBS "-lm -lpthread -ldl -lutil -lstdc++ -lrt") + set(NTA_PLATFORM_LIBS "-stdlib=libstdc++ -lm -lpthread -ldl -lutil -lrt") set(NTA_PLATFORM_MPI_EXTRA_LIBS "-lrt") set(NTA_PLATFORM_LINKFLAGS_PYMODULE "-pthread -shared") set(NTA_PLATFORM_LINKFLAGS_PYEMBED "-Wl,--export-dynamic") From 73942dbb829de584519f89f469de43cea7e3ce2b Mon Sep 17 00:00:00 2001 From: DavidRagazzi Date: Thu, 20 Feb 2014 08:32:20 -0300 Subject: [PATCH 39/50] Update CMakeLists.txt --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0bee625ac4..54ce7da04b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ # Contributor(s): # David Ragazzi (@DavidRagazzi): Full conversion and adaptation from Autotools scripts # -------------------------------------------------------------------------------------------------------------------------- - + ############################################################################################################################ ### ### From 5ecee2621627f249ef88300031af617ec3b6627e Mon Sep 17 00:00:00 2001 From: Subutai Ahmad Date: Thu, 20 Feb 2014 08:48:40 -0800 Subject: [PATCH 40/50] Mac OSX compatibility changes I had to change CMAKE_OSX_DEPLOYMENT_TARGET to 10.7. Apparently that is a compatibility mode that makes the compiler use older libraries. This is documented here: http://stackoverflow.com/questions/19637164/c-linking-error-after-upgrading-to-mac-os-x-10-9-xcode-5-0-1 I also added `-std=c++11 -lc++abi` according to this: http://stackoverflow.com/questions/7016730/compiling-with-clang-using-libc-undefined-references Tests now pass on my machine. --- CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 54ce7da04b..ea36ddf7c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -252,13 +252,13 @@ else() set(NTA_PLATFORM_ARCH "32") endif() if(OSX) - set(CMAKE_OSX_DEPLOYMENT_TARGET "${_CURRENT_OSX_VERSION}") + set(CMAKE_OSX_DEPLOYMENT_TARGET "10.7") set(NTA_PLATFORM_OS "darwin64") set(NTA_PLATFORM_CXXFLAGS "-fPIC -DPIC -m64") set(NTA_PLATFORM_ASFLAGS "") set(NTA_PLATFORM_DEBUGFLAGS "-gfull") set(NTA_PLATFORM_LINKFLAGS "-Wl,-u,_munmap") - set(NTA_PLATFORM_LIBS "-stdlib=libstdc++ -liconv -lsqlite3 -framework CoreServices -framework Accelerate") + set(NTA_PLATFORM_LIBS "-stdlib=libstdc++ -std=c++11 -lc++abi -liconv -lsqlite3 -framework CoreServices -framework Accelerate") set(NTA_PLATFORM_MPI_EXTRA_LIBS "") set(NTA_PLATFORM_LINKFLAGS_PYMODULE "-bundle -undefined dynamic_lookup -fPIC") set(NTA_PLATFORM_LINKFLAGS_PYEMBED "") @@ -270,7 +270,7 @@ elseif(LINUX) set(NTA_PLATFORM_DEBUGFLAGS "-g") set(NTA_PLATFORM_LINKFLAGS "-Wl,--no-as-needed -static-libgcc") # pthread needed by libapr-1 - set(NTA_PLATFORM_LIBS "-stdlib=libstdc++ -lm -lpthread -ldl -lutil") + set(NTA_PLATFORM_LIBS "-stdlib=libstdc++ -std=c++11 -lc++abi -lm -lpthread -ldl -lutil") set(NTA_PLATFORM_MPI_EXTRA_LIBS "-lrt") set(NTA_PLATFORM_LINKFLAGS_PYMODULE "-pthread -shared") set(NTA_PLATFORM_LINKFLAGS_PYEMBED "-Wl,--export-dynamic") @@ -280,7 +280,7 @@ elseif(LINUX) set(NTA_PLATFORM_ASFLAGS "") set(NTA_PLATFORM_DEBUGFLAGS "-g") set(NTA_PLATFORM_LINKFLAGS "-Wl,--no-as-needed -static-libgcc") - set(NTA_PLATFORM_LIBS "-stdlib=libstdc++ -lm -lpthread -ldl -lutil -lrt") + set(NTA_PLATFORM_LIBS "-stdlib=libstdc++ -std=c++11 -lc++abi -lm -lpthread -ldl -lutil -lrt") set(NTA_PLATFORM_MPI_EXTRA_LIBS "-lrt") set(NTA_PLATFORM_LINKFLAGS_PYMODULE "-pthread -shared") set(NTA_PLATFORM_LINKFLAGS_PYEMBED "-Wl,--export-dynamic") @@ -415,7 +415,7 @@ else() show_environment_variable(NTA_DATA_PATH "$ENV{NTA_DATA_PATH}") endif() if(OSX) - set_environment_variable(MACOSX_DEPLOYMENT_TARGET "${_CURRENT_OSX_VERSION}" OFF) + set_environment_variable(MACOSX_DEPLOYMENT_TARGET "10.7" OFF) message(STATUS " (some variables will be updated only after login.)") endif() From b213ecbfb5c8d2a6bad30d47e05079be09310e1f Mon Sep 17 00:00:00 2001 From: Subutai Ahmad Date: Thu, 20 Feb 2014 09:10:23 -0800 Subject: [PATCH 41/50] Took out -std=c++11 for non OSX --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ea36ddf7c1..636452204c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -270,7 +270,7 @@ elseif(LINUX) set(NTA_PLATFORM_DEBUGFLAGS "-g") set(NTA_PLATFORM_LINKFLAGS "-Wl,--no-as-needed -static-libgcc") # pthread needed by libapr-1 - set(NTA_PLATFORM_LIBS "-stdlib=libstdc++ -std=c++11 -lc++abi -lm -lpthread -ldl -lutil") + set(NTA_PLATFORM_LIBS "-stdlib=libstdc++ -lc++abi -lm -lpthread -ldl -lutil") set(NTA_PLATFORM_MPI_EXTRA_LIBS "-lrt") set(NTA_PLATFORM_LINKFLAGS_PYMODULE "-pthread -shared") set(NTA_PLATFORM_LINKFLAGS_PYEMBED "-Wl,--export-dynamic") @@ -280,7 +280,7 @@ elseif(LINUX) set(NTA_PLATFORM_ASFLAGS "") set(NTA_PLATFORM_DEBUGFLAGS "-g") set(NTA_PLATFORM_LINKFLAGS "-Wl,--no-as-needed -static-libgcc") - set(NTA_PLATFORM_LIBS "-stdlib=libstdc++ -std=c++11 -lc++abi -lm -lpthread -ldl -lutil -lrt") + set(NTA_PLATFORM_LIBS "-stdlib=libstdc++ -lc++abi -lm -lpthread -ldl -lutil -lrt") set(NTA_PLATFORM_MPI_EXTRA_LIBS "-lrt") set(NTA_PLATFORM_LINKFLAGS_PYMODULE "-pthread -shared") set(NTA_PLATFORM_LINKFLAGS_PYEMBED "-Wl,--export-dynamic") From 6bf1e55d5553dad7601b55c794cef55cb9163324 Mon Sep 17 00:00:00 2001 From: DavidRagazzi Date: Thu, 20 Feb 2014 14:14:55 -0300 Subject: [PATCH 42/50] Update CMakeLists.txt --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 636452204c..29465d7245 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -404,6 +404,7 @@ set_environment_variable(PYTHONPATH "${PYTHON_SITE_PACKAGES_DIR}" OFF) set_environment_variable(NUPIC "${PROJECT_SOURCE_DIR}" OFF) set_environment_variable(LD_LIBRARY_PATH "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}" ON) set_environment_variable(DYLD_LIBRARY_PATH "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" ON) +set_environment_variable(NTAX_DEVELOPER_BUILD "1") # If $NTA (ie 'release' directory) already is set, don't change it! if("$ENV{NTA}" STREQUAL "") set_environment_variable(NTA "${CMAKE_INSTALL_PREFIX}" OFF) @@ -415,7 +416,7 @@ else() show_environment_variable(NTA_DATA_PATH "$ENV{NTA_DATA_PATH}") endif() if(OSX) - set_environment_variable(MACOSX_DEPLOYMENT_TARGET "10.7" OFF) + set_environment_variable(MACOSX_DEPLOYMENT_TARGET "${CMAKE_OSX_DEPLOYMENT_TARGET}" OFF) message(STATUS " (some variables will be updated only after login.)") endif() From 0563fb3f31688f61ed63c0781d699ed09f4ada19 Mon Sep 17 00:00:00 2001 From: DavidRagazzi Date: Thu, 20 Feb 2014 14:21:13 -0300 Subject: [PATCH 43/50] NTAX_DEVELOPER_BUILD included --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 29465d7245..0e3d302724 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -404,7 +404,7 @@ set_environment_variable(PYTHONPATH "${PYTHON_SITE_PACKAGES_DIR}" OFF) set_environment_variable(NUPIC "${PROJECT_SOURCE_DIR}" OFF) set_environment_variable(LD_LIBRARY_PATH "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}" ON) set_environment_variable(DYLD_LIBRARY_PATH "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" ON) -set_environment_variable(NTAX_DEVELOPER_BUILD "1") +set_environment_variable(NTAX_DEVELOPER_BUILD "1" OFF) # If $NTA (ie 'release' directory) already is set, don't change it! if("$ENV{NTA}" STREQUAL "") set_environment_variable(NTA "${CMAKE_INSTALL_PREFIX}" OFF) From eb36dba17cd5e0c3e8aa16183dd4cd5e17e22bdd Mon Sep 17 00:00:00 2001 From: Subutai Ahmad Date: Thu, 20 Feb 2014 09:42:20 -0800 Subject: [PATCH 44/50] Took out -std=c++11 for non OSX platforms --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 636452204c..89fcde2941 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -270,7 +270,7 @@ elseif(LINUX) set(NTA_PLATFORM_DEBUGFLAGS "-g") set(NTA_PLATFORM_LINKFLAGS "-Wl,--no-as-needed -static-libgcc") # pthread needed by libapr-1 - set(NTA_PLATFORM_LIBS "-stdlib=libstdc++ -lc++abi -lm -lpthread -ldl -lutil") + set(NTA_PLATFORM_LIBS "-stdlib=libstdc++ -lm -lpthread -ldl -lutil") set(NTA_PLATFORM_MPI_EXTRA_LIBS "-lrt") set(NTA_PLATFORM_LINKFLAGS_PYMODULE "-pthread -shared") set(NTA_PLATFORM_LINKFLAGS_PYEMBED "-Wl,--export-dynamic") @@ -280,7 +280,7 @@ elseif(LINUX) set(NTA_PLATFORM_ASFLAGS "") set(NTA_PLATFORM_DEBUGFLAGS "-g") set(NTA_PLATFORM_LINKFLAGS "-Wl,--no-as-needed -static-libgcc") - set(NTA_PLATFORM_LIBS "-stdlib=libstdc++ -lc++abi -lm -lpthread -ldl -lutil -lrt") + set(NTA_PLATFORM_LIBS "-stdlib=libstdc++ -lm -lpthread -ldl -lutil -lrt") set(NTA_PLATFORM_MPI_EXTRA_LIBS "-lrt") set(NTA_PLATFORM_LINKFLAGS_PYMODULE "-pthread -shared") set(NTA_PLATFORM_LINKFLAGS_PYEMBED "-Wl,--export-dynamic") From c059269200b0c036b7360ecbabfddce78cd4e381 Mon Sep 17 00:00:00 2001 From: DavidRagazzi Date: Thu, 20 Feb 2014 15:01:52 -0300 Subject: [PATCH 45/50] Update CMakeLists.txt --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f2781940f2..97c9630a9c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -404,7 +404,11 @@ set_environment_variable(PYTHONPATH "${PYTHON_SITE_PACKAGES_DIR}" OFF) set_environment_variable(NUPIC "${PROJECT_SOURCE_DIR}" OFF) set_environment_variable(LD_LIBRARY_PATH "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}" ON) set_environment_variable(DYLD_LIBRARY_PATH "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" ON) -set_environment_variable(NTAX_DEVELOPER_BUILD "1" OFF) +if("$ENV{NTAX_DEVELOPER_BUILD}" STREQUAL "") + set_environment_variable(NTAX_DEVELOPER_BUILD "1" OFF) +else() + show_environment_variable(NTAX_DEVELOPER_BUILD "$ENV{NTAX_DEVELOPER_BUILD}") +endif() # If $NTA (ie 'release' directory) already is set, don't change it! if("$ENV{NTA}" STREQUAL "") set_environment_variable(NTA "${CMAKE_INSTALL_PREFIX}" OFF) From 6aa55810bc9c98b219270567546a2357faa53eec Mon Sep 17 00:00:00 2001 From: DavidRagazzi Date: Thu, 20 Feb 2014 15:15:46 -0300 Subject: [PATCH 46/50] Update CMakeLists.txt --- CMakeLists.txt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 97c9630a9c..f3f4d24835 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -404,11 +404,6 @@ set_environment_variable(PYTHONPATH "${PYTHON_SITE_PACKAGES_DIR}" OFF) set_environment_variable(NUPIC "${PROJECT_SOURCE_DIR}" OFF) set_environment_variable(LD_LIBRARY_PATH "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}" ON) set_environment_variable(DYLD_LIBRARY_PATH "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" ON) -if("$ENV{NTAX_DEVELOPER_BUILD}" STREQUAL "") - set_environment_variable(NTAX_DEVELOPER_BUILD "1" OFF) -else() - show_environment_variable(NTAX_DEVELOPER_BUILD "$ENV{NTAX_DEVELOPER_BUILD}") -endif() # If $NTA (ie 'release' directory) already is set, don't change it! if("$ENV{NTA}" STREQUAL "") set_environment_variable(NTA "${CMAKE_INSTALL_PREFIX}" OFF) @@ -423,6 +418,7 @@ if(OSX) set_environment_variable(MACOSX_DEPLOYMENT_TARGET "${CMAKE_OSX_DEPLOYMENT_TARGET}" OFF) message(STATUS " (some variables will be updated only after login.)") endif() +show_environment_variable(NTAX_DEVELOPER_BUILD "$ENV{NTAX_DEVELOPER_BUILD}") # # Project details From f0964ccdfcebf362f51f254dd9d1cd69b3511c47 Mon Sep 17 00:00:00 2001 From: Subutai Ahmad Date: Thu, 20 Feb 2014 12:40:40 -0800 Subject: [PATCH 47/50] Added ref to latest nupic.core changes. --- nta | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nta b/nta index 10fec166ef..d07539bbc5 160000 --- a/nta +++ b/nta @@ -1 +1 @@ -Subproject commit 10fec166ef997d540e3c9e4a0128339a71d13195 +Subproject commit d07539bbc5bc6c78c916898e9db4d329d45fe5b2 From 41ea938e077aef945c3e44588236eda93222d257 Mon Sep 17 00:00:00 2001 From: DavidRagazzi Date: Thu, 20 Feb 2014 23:46:36 -0300 Subject: [PATCH 48/50] Symlinks were coded (when NTAX_DEVELOPER_BUILD=1) --- CMakeLists.txt | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f3f4d24835..d00828f4b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,13 +65,23 @@ macro (set_environment_variable variable value incremental) endmacro() # These macros copy all source directories after the configuration is done -macro (copy_directory src dst) - message(STATUS "Copying from '${src}' to '${dst}'") - execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${src} ${dst}) +# Note: If NTAX_DEVELOPER_BUILD is set, copy is optimized (directories are linked, and files are not copied if the modification time of the target is more recent). +macro (copy suffix src dst) + if("$ENV{NTAX_DEVELOPER_BUILD}" STREQUAL "1") + message(STATUS "Linking from '${src}' to '${dst}'") + get_filename_component(dst_dir ${dst} PATH) + execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${dst_dir}) + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${src} ${dst}) + else() + message(STATUS "Copying from '${src}' to '${dst}'") + execute_process(COMMAND ${CMAKE_COMMAND} -E copy${suffix} ${src} ${dst}) + endif() endmacro() macro (copy_file src dst) - message(STATUS "Copying from '${src}' to '${dst}'") - execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${src} ${dst}) + copy("" ${src} ${dst}) +endmacro() +macro (copy_directory src dst) + copy("_directory" ${src} ${dst}) endmacro() # This macro get all files from a directory and its subdirectories. @@ -1054,30 +1064,19 @@ endif() # Create file with unit tests used by TestEverything # set(FILES_RETURNED) -get_files_list(${PROJECT_SOURCE_DIR}/nta "unittests" "Test.cpp") -set(files ${FILES_RETURNED}) -set(file_content "") -foreach(file ${files}) - get_filename_component(test ${file} NAME_WE) - if(NOT ${test} MATCHES "TesterTest") - set(file_content "${file_content}ADD_TEST(${test});\n") - endif() -endforeach() -file(WRITE "${PROJECT_SOURCE_DIR}/qa/testeverything/everything_addtests.hpp" "${file_content}") - -# -# Create file with headers of unit tests used by TestEverything -# -set(FILES_RETURNED) get_files_list(${PROJECT_SOURCE_DIR}/nta "unittests" "Test.hpp") set(files ${FILES_RETURNED}) -set(file_content "") +set(tests_file_content "") +set(headers_file_content "") foreach(file ${files}) + get_filename_component(test ${file} NAME_WE) if(NOT ${file} MATCHES "TesterTest") - set(file_content "${file_content}#include \"${file}\"\n") + set(tests_file_content "${tests_file_content}ADD_TEST(${test});\n") + set(headers_file_content "${headers_file_content}#include \"${file}\"\n") endif() endforeach() -file(WRITE "${PROJECT_SOURCE_DIR}/qa/testeverything/everything_headers.hpp" "${file_content}") +file(WRITE "${PROJECT_SOURCE_DIR}/qa/testeverything/everything_addtests.hpp" "${tests_file_content}") +file(WRITE "${PROJECT_SOURCE_DIR}/qa/testeverything/everything_headers.hpp" "${headers_file_content}") # Copy platform independent executable scripts copy_file(${PROJECT_SOURCE_DIR}/lang/py/bindings/__init__.py ${PYTHON_SITE_PACKAGES_DIR}/nupic/bindings/__init__.py) From da1cc11284bf6377116e7c4c9cc549dbb0d9f401 Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Thu, 20 Feb 2014 22:11:50 -0800 Subject: [PATCH 49/50] Adding back submodule update within build.sh Reverts commit 5bd2dfa57507097ca1a4c9eeccc073837dbaa9df. We changed the process so that Travis will not automatically update submodules, instead CMake does it. So the build script needs to do the same again, too. --- build.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/build.sh b/build.sh index c94f06b3c5..827d75cf94 100755 --- a/build.sh +++ b/build.sh @@ -76,6 +76,24 @@ function doMake { exitOnError $? } +function cleanUpCoreSubmodule { + # Someone might have removed the submodule directory, so let's put it back + # before running any submodule commands. + if [[ ! -d $NUPIC/nta ]] ; then + mkdir $NUPIC/nta + fi + pushd $NUPIC + git submodule foreach git clean -fd + popd +} + +function syncCoreSubmodule { + cleanUpCoreSubmodule + pushd $NUPIC + git submodule update --init + popd +} + function cleanUpDirectories { popd [[ -d $BUILDDIR ]] && echo "Warning: directory \"$BUILDDIR\" already exists and may contain (old) data. Consider removing it. " @@ -89,6 +107,7 @@ function cleanUpEnv { # Redirect stdout to a file but still print stderr. mkdir -p `dirname $STDOUT` { + syncCoreSubmodule prepDirectories pythonSetup @@ -97,6 +116,7 @@ mkdir -p `dirname $STDOUT` cleanUpDirectories cleanUpEnv + cleanUpCoreSubmodule } 2>&1 > $STDOUT echo From a82f56021b79eb2b7c20fc805ecbad10559f0d39 Mon Sep 17 00:00:00 2001 From: Subutai Ahmad Date: Fri, 21 Feb 2014 07:00:29 -0800 Subject: [PATCH 50/50] Took out check for compiler For some reason it is not reliable on Mac's. Will address in documentation for now. --- CMakeLists.txt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d00828f4b5..4596cae02e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -186,11 +186,6 @@ endif() cmake_minimum_required(VERSION 2.8) project(Nupic CXX) -# Check if default C/C++ compiler is GNU or CLANG, otherwise exit with error. -if(NOT(CMAKE_COMPILER_IS_GNUCXX OR ${CMAKE_CXX_COMPILER} MATCHES "clang")) - message(FATAL_ERROR "${CMAKE_CXX_COMPILER} compiler not supported yet. If you have GNU or CLANG C++ compiler installed on your machine change $CXX environment variable or pass its location through USER_CXX_COMPILER option.") -endif() - # # Sets default locations. #