diff options
-rw-r--r-- | Modules/CPackNSIS.cmake | 5 | ||||
-rw-r--r-- | Modules/FindBoost.cmake | 16 | ||||
-rw-r--r-- | Modules/FindMatlab.cmake | 7 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/CPack/cmCPackNSISGenerator.cxx | 41 | ||||
-rw-r--r-- | Source/CPack/cmCPackNSISGenerator.h | 5 | ||||
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 12 | ||||
-rw-r--r-- | Source/kwsys/testConsoleBuf.cxx | 37 | ||||
-rw-r--r-- | Tests/FortranModules/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/FortranModules/non_pp_include.f90 | 3 | ||||
-rw-r--r-- | Tests/FortranModules/test_non_pp_include_main.f90 | 5 |
11 files changed, 111 insertions, 24 deletions
diff --git a/Modules/CPackNSIS.cmake b/Modules/CPackNSIS.cmake index db5984a..4693ce5 100644 --- a/Modules/CPackNSIS.cmake +++ b/Modules/CPackNSIS.cmake @@ -96,6 +96,11 @@ # Contact information for questions and comments about the installation # process. # +# .. variable:: CPACK_NSIS_<compName>_INSTALL_DIRECTORY +# +# Custom install directory for the specified component <compName> instead +# of $INSTDIR. +# # .. variable:: CPACK_NSIS_CREATE_ICONS_EXTRA # # Additional NSIS commands for creating start menu shortcuts. diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 1f03841..b3e8db9 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -742,6 +742,21 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) + elseif(NOT Boost_VERSION VERSION_LESS 106200 AND Boost_VERSION VERSION_LESS 106300) + set(_Boost_CHRONO_DEPENDENCIES system) + set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) + set(_Boost_COROUTINE_DEPENDENCIES context system) + set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) + set(_Boost_FILESYSTEM_DEPENDENCIES system) + set(_Boost_IOSTREAMS_DEPENDENCIES regex) + set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) + set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) + set(_Boost_MPI_DEPENDENCIES serialization) + set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) + set(_Boost_RANDOM_DEPENDENCIES system) + set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) + set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) + set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) else() message(WARNING "Imported targets not available for Boost version ${Boost_VERSION}") set(_Boost_IMPORTED_TARGETS FALSE) @@ -777,6 +792,7 @@ function(_Boost_COMPONENT_HEADERS component _hdrs) set(_Boost_COROUTINE_HEADERS "boost/coroutine/all.hpp") set(_Boost_EXCEPTION_HEADERS "boost/exception/exception.hpp") set(_Boost_DATE_TIME_HEADERS "boost/date_time/date.hpp") + set(_Boost_FIBER_HEADERS "boost/fiber/all.hpp") set(_Boost_FILESYSTEM_HEADERS "boost/filesystem/path.hpp") set(_Boost_GRAPH_HEADERS "boost/graph/adjacency_list.hpp") set(_Boost_GRAPH_PARALLEL_HEADERS "boost/graph/adjacency_list.hpp") diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 8b41bb9..d016848 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -225,6 +225,7 @@ set(_FindMatlab_SELF_DIR "${CMAKE_CURRENT_LIST_DIR}") include(FindPackageHandleStandardArgs) include(CheckCXXCompilerFlag) +include(CheckCCompilerFlag) # The currently supported versions. Other version can be added by the user by @@ -871,7 +872,11 @@ function(matlab_add_mex) if(NOT WIN32) # we do not need all this on Windows # pthread options - check_cxx_compiler_flag(-pthread HAS_MINUS_PTHREAD) + if(CMAKE_CXX_COMPILER_LOADED) + check_cxx_compiler_flag(-pthread HAS_MINUS_PTHREAD) + elseif(CMAKE_C_COMPILER_LOADED) + check_c_compiler_flag(-pthread HAS_MINUS_PTHREAD) + endif() # we should use try_compile instead, the link flags are discarded from # this compiler_flag function. #check_cxx_compiler_flag(-Wl,--exclude-libs,ALL HAS_SYMBOL_HIDING_CAPABILITY) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9a10ddb..9eb99ea 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160926) +set(CMake_VERSION_PATCH 20160927) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 2db94f1..b49da7f 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -71,14 +71,26 @@ int cmCPackNSISGenerator::PackageFiles() std::ostringstream str; std::vector<std::string>::const_iterator it; for (it = files.begin(); it != files.end(); ++it) { + std::string outputDir = "$INSTDIR"; std::string fileN = cmSystemTools::RelativePath(toplevel.c_str(), it->c_str()); if (!this->Components.empty()) { + const std::string::size_type pos = fileN.find('/'); + + // Use the custom component install directory if we have one + if (pos != std::string::npos) { + const std::string componentName = fileN.substr(0, pos); + outputDir = CustomComponentInstallDirectory(componentName); + } else { + outputDir = CustomComponentInstallDirectory(fileN); + } + // Strip off the component part of the path. - fileN = fileN.substr(fileN.find('/') + 1, std::string::npos); + fileN = fileN.substr(pos + 1, std::string::npos); } std::replace(fileN.begin(), fileN.end(), '/', '\\'); - str << " Delete \"$INSTDIR\\" << fileN << "\"" << std::endl; + + str << " Delete \"" << outputDir << "\\" << fileN << "\"" << std::endl; } cmCPackLogger(cmCPackLog::LOG_DEBUG, "Uninstall Files: " << str.str() << std::endl); @@ -108,7 +120,12 @@ int cmCPackNSISGenerator::PackageFiles() } } std::replace(fileN.begin(), fileN.end(), '/', '\\'); - dstr << " RMDir \"$INSTDIR\\" << fileN << "\"" << std::endl; + + const std::string componentOutputDir = + CustomComponentInstallDirectory(componentName); + + dstr << " RMDir \"" << componentOutputDir << "\\" << fileN << "\"" + << std::endl; if (!componentName.empty()) { this->Components[componentName].Directories.push_back(fileN); } @@ -650,7 +667,10 @@ std::string cmCPackNSISGenerator::CreateComponentDescription( } componentCode += " SectionIn" + out.str() + "\n"; } - componentCode += " SetOutPath \"$INSTDIR\"\n"; + + const std::string componentOutputDir = + CustomComponentInstallDirectory(component->Name); + componentCode += " SetOutPath \"" + componentOutputDir + "\"\n"; // Create the actual installation commands if (component->IsDownloaded) { @@ -796,13 +816,13 @@ std::string cmCPackNSISGenerator::CreateComponentDescription( ++pathIt) { path = *pathIt; std::replace(path.begin(), path.end(), '/', '\\'); - macrosOut << " Delete \"$INSTDIR\\" << path << "\"\n"; + macrosOut << " Delete \"" << componentOutputDir << "\\" << path << "\"\n"; } for (pathIt = component->Directories.begin(); pathIt != component->Directories.end(); ++pathIt) { path = *pathIt; std::replace(path.begin(), path.end(), '/', '\\'); - macrosOut << " RMDir \"$INSTDIR\\" << path << "\"\n"; + macrosOut << " RMDir \"" << componentOutputDir << "\\" << path << "\"\n"; } macrosOut << " noremove_" << component->Name << ":\n"; macrosOut << "!macroend\n"; @@ -914,6 +934,15 @@ std::string cmCPackNSISGenerator::CreateComponentGroupDescription( return code; } +std::string cmCPackNSISGenerator::CustomComponentInstallDirectory( + const std::string& componentName) +{ + const char* outputDir = + this->GetOption("CPACK_NSIS_" + componentName + "_INSTALL_DIRECTORY"); + const std::string componentOutputDir = (outputDir ? outputDir : "$INSTDIR"); + return componentOutputDir; +} + std::string cmCPackNSISGenerator::TranslateNewlines(std::string str) { cmSystemTools::ReplaceString(str, "\n", "$\\r$\\n"); diff --git a/Source/CPack/cmCPackNSISGenerator.h b/Source/CPack/cmCPackNSISGenerator.h index ae03e6b..bd7d752 100644 --- a/Source/CPack/cmCPackNSISGenerator.h +++ b/Source/CPack/cmCPackNSISGenerator.h @@ -84,6 +84,11 @@ protected: std::string CreateComponentGroupDescription(cmCPackComponentGroup* group, std::ostream& macrosOut); + /// Returns the custom install directory if available for the specified + /// component, otherwise $INSTDIR is returned. + std::string CustomComponentInstallDirectory( + const std::string& componentName); + /// Translations any newlines found in the string into \\r\\n, so that the /// resulting string can be used within NSIS. static std::string TranslateNewlines(std::string str); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index b418ce3..f88eb7b 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -841,6 +841,18 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( // directive. ppVars["INCLUDES"] = vars["INCLUDES"]; + // Prepend source file's original directory as an include directory + // so e.g. Fortran INCLUDE statements can look for files in it. + std::vector<std::string> sourceDirectory; + sourceDirectory.push_back( + cmSystemTools::GetParentDirectory(source->GetFullPath())); + + std::string sourceDirectoryFlag = this->LocalGenerator->GetIncludeFlags( + sourceDirectory, this->GeneratorTarget, language, false, false, + this->GetConfigName()); + + vars["INCLUDES"] = sourceDirectoryFlag + " " + vars["INCLUDES"]; + // Explicit preprocessing always uses a depfile. ppVars["DEP_FILE"] = cmGlobalNinjaGenerator::EncodeDepfileSpace(ppFileName + ".d"); diff --git a/Source/kwsys/testConsoleBuf.cxx b/Source/kwsys/testConsoleBuf.cxx index 3dc3337..d7775e6 100644 --- a/Source/kwsys/testConsoleBuf.cxx +++ b/Source/kwsys/testConsoleBuf.cxx @@ -103,7 +103,7 @@ static void dumpBuffers(const T *expected, const T *received, size_t size) { } std::cerr << std::endl; } - std::cerr << std::endl << std::flush; + std::cerr << std::endl; } //---------------------------------------------------------------------------- @@ -331,21 +331,23 @@ static int testPipe() didFail = encodedTestString.compare(buffer2) == 0 ? 0 : 1; } if (didFail != 0) { - std::cerr << "Pipe's output didn't match expected output!" << std::endl << std::flush; + std::cerr << "Pipe's output didn't match expected output!" << std::endl; dumpBuffers<char>(encodedTestString.c_str(), buffer, encodedTestString.size()); dumpBuffers<char>(encodedInputTestString.c_str(), buffer + encodedTestString.size() + 1, encodedInputTestString.size()); dumpBuffers<char>(encodedTestString.c_str(), buffer2, encodedTestString.size()); } } catch (const std::runtime_error &ex) { DWORD lastError = GetLastError(); - std::cerr << "In function " << __FUNCTION__ << ":" << ex.what() << std::endl << std::flush; + std::cerr << "In function testPipe, line " << __LINE__ << ": " + << ex.what() << std::endl; displayError(lastError); } finishProcess(didFail == 0); } } catch (const std::runtime_error &ex) { DWORD lastError = GetLastError(); - std::cerr << "In function " << __FUNCTION__ << ":" << ex.what() << std::endl << std::flush; + std::cerr << "In function testPipe, line " << __LINE__ << ": " + << ex.what() << std::endl; displayError(lastError); } finishPipe(inPipeRead, inPipeWrite); @@ -368,11 +370,11 @@ static int testFile() (errFile = createFile(L"stderrFile.txt")) == INVALID_HANDLE_VALUE) { throw std::runtime_error("createFile failed!"); } - int length = 0; DWORD bytesWritten = 0; char buffer[200]; char buffer2[200]; + int length; if ((length = WideCharToMultiByte(TestCodepage, 0, UnicodeInputTestString, -1, buffer, sizeof(buffer), NULL, NULL)) == 0) { @@ -424,21 +426,23 @@ static int testFile() didFail = encodedTestString.compare(buffer2) == 0 ? 0 : 1; } if (didFail != 0) { - std::cerr << "File's output didn't match expected output!" << std::endl << std::flush; + std::cerr << "File's output didn't match expected output!" << std::endl; dumpBuffers<char>(encodedTestString.c_str(), buffer, encodedTestString.size()); dumpBuffers<char>(encodedInputTestString.c_str(), buffer + encodedTestString.size() + 1, encodedInputTestString.size() - 1); dumpBuffers<char>(encodedTestString.c_str(), buffer2, encodedTestString.size()); } } catch (const std::runtime_error &ex) { DWORD lastError = GetLastError(); - std::cerr << "In function " << __FUNCTION__ << ":" << ex.what() << std::endl << std::flush; + std::cerr << "In function testFile, line " << __LINE__ << ": " + << ex.what() << std::endl; displayError(lastError); } finishProcess(didFail == 0); } } catch (const std::runtime_error &ex) { DWORD lastError = GetLastError(); - std::cerr << "In function " << __FUNCTION__ << ":" << ex.what() << std::endl << std::flush; + std::cerr << "In function testFile, line " << __LINE__ << ": " + << ex.what() << std::endl; displayError(lastError); } finishFile(inFile); @@ -508,18 +512,18 @@ static int testConsole() forceNewConsole = true; } } else { - std::cerr << "RegGetValueW(FontFamily) failed!" << std::endl << std::flush; + std::cerr << "RegGetValueW(FontFamily) failed!" << std::endl; } RegCloseKey(hConsoleKey); } else { - std::cerr << "RegOpenKeyExW(HKEY_CURRENT_USER\\Console) failed!" << std::endl << std::flush; + std::cerr << "RegOpenKeyExW(HKEY_CURRENT_USER\\Console) failed!" << std::endl; } } if (forceNewConsole || GetConsoleMode(parentOut, &consoleMode) == 0) { // Not a real console, let's create new one. FreeConsole(); if (!AllocConsole()) { - std::cerr << "AllocConsole failed!" << std::endl << std::flush; + std::cerr << "AllocConsole failed!" << std::endl; return didFail; } SECURITY_ATTRIBUTES securityAttributes; @@ -561,11 +565,11 @@ static int testConsole() consoleFont.FontFamily = TestFontFamily; wcscpy(consoleFont.FaceName, TestFaceName); if (!setConsoleFont(hOut, FALSE, &consoleFont)) { - std::cerr << "SetCurrentConsoleFontEx failed!" << std::endl << std::flush; + std::cerr << "SetCurrentConsoleFontEx failed!" << std::endl; } } } else { - std::cerr << "GetCurrentConsoleFontEx failed!" << std::endl << std::flush; + std::cerr << "GetCurrentConsoleFontEx failed!" << std::endl; } } else { #endif @@ -599,7 +603,7 @@ static int testConsole() INPUT_RECORD inputBuffer[(sizeof(UnicodeInputTestString) / sizeof(UnicodeInputTestString[0])) * 2]; memset(&inputBuffer, 0, sizeof(inputBuffer)); - unsigned int i = 0; + unsigned int i; for (i = 0; i < (sizeof(UnicodeInputTestString) / sizeof(UnicodeInputTestString[0]) - 1); i++) { writeInputKeyEvent(&inputBuffer[i*2], UnicodeInputTestString[i]); @@ -650,7 +654,7 @@ static int testConsole() ) { didFail = 0; } else { - std::cerr << "Console's output didn't match expected output!" << std::endl << std::flush; + std::cerr << "Console's output didn't match expected output!" << std::endl; dumpBuffers<wchar_t>(wideTestString.c_str(), outputBuffer, wideTestString.size()); dumpBuffers<wchar_t>(wideTestString.c_str(), outputBuffer + screenBufferInfo.dwSize.X * 1, wideTestString.size()); dumpBuffers<wchar_t>(UnicodeInputTestString, outputBuffer + screenBufferInfo.dwSize.X * 2, (sizeof(UnicodeInputTestString) - 1) / sizeof(WCHAR)); @@ -659,7 +663,8 @@ static int testConsole() delete[] outputBuffer; } catch (const std::runtime_error &ex) { DWORD lastError = GetLastError(); - std::cerr << "In function " << __FUNCTION__ << ":" << ex.what() << std::endl << std::flush; + std::cerr << "In function testConsole, line " << __LINE__ << ": " + << ex.what() << std::endl; displayError(lastError); } finishProcess(didFail == 0); diff --git a/Tests/FortranModules/CMakeLists.txt b/Tests/FortranModules/CMakeLists.txt index ff12771..3996600 100644 --- a/Tests/FortranModules/CMakeLists.txt +++ b/Tests/FortranModules/CMakeLists.txt @@ -52,6 +52,8 @@ add_definitions(-DFOO -DBAR=1) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) add_executable(test_preprocess test_preprocess.F90 test_preprocess_module.F90) +add_executable(test_non_pp_include test_non_pp_include_main.f90) + # Build the external project separately using a custom target. # Make sure it uses the same build configuration as this test. if(CMAKE_CONFIGURATION_TYPES) diff --git a/Tests/FortranModules/non_pp_include.f90 b/Tests/FortranModules/non_pp_include.f90 new file mode 100644 index 0000000..7eb1725 --- /dev/null +++ b/Tests/FortranModules/non_pp_include.f90 @@ -0,0 +1,3 @@ +SUBROUTINE NON_PP_INCLUDE_SUBROUTINE + PRINT *, "Hello World!" +END SUBROUTINE NON_PP_INCLUDE_SUBROUTINE diff --git a/Tests/FortranModules/test_non_pp_include_main.f90 b/Tests/FortranModules/test_non_pp_include_main.f90 new file mode 100644 index 0000000..8a04fbd --- /dev/null +++ b/Tests/FortranModules/test_non_pp_include_main.f90 @@ -0,0 +1,5 @@ +INCLUDE "non_pp_include.f90" + +PROGRAM MAINF90 + CALL NON_PP_INCLUDE_SUBROUTINE +END PROGRAM MAINF90 |