diff options
-rw-r--r-- | CMakeLists.txt | 8 | ||||
-rw-r--r-- | Help/release/3.7.rst | 13 | ||||
-rw-r--r-- | Help/release/dev/0-sample-topic.rst | 7 | ||||
-rw-r--r-- | Help/release/index.rst | 2 | ||||
-rw-r--r-- | Help/variable/CMAKE_CODELITE_USE_TARGETS.rst | 5 | ||||
-rw-r--r-- | Modules/CPackRPM.cmake | 68 | ||||
-rw-r--r-- | Modules/FindMatlab.cmake | 16 | ||||
-rw-r--r-- | Modules/FindProtobuf.cmake | 16 | ||||
-rw-r--r-- | Modules/Platform/Android/ndk-stl-c++.cmake | 10 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 6 | ||||
-rw-r--r-- | Source/QtIFW/cmake.org.html | 2 | ||||
-rw-r--r-- | Source/cmExtraCodeLiteGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmFileMonitor.cxx | 8 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 19 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.h | 4 | ||||
-rw-r--r-- | Source/cmServerConnection.cxx | 162 | ||||
-rw-r--r-- | Source/cmServerConnection.h | 15 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 6 | ||||
-rw-r--r-- | Tests/RunCMake/Android/android.cxx | 3 | ||||
-rw-r--r-- | Tests/RunCMake/Android/common.cmake | 6 | ||||
-rw-r--r-- | Utilities/Release/upload_release.cmake | 2 |
21 files changed, 260 insertions, 122 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 309e224..b4a577c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,10 @@ if(POLICY CMP0053) endif() project(CMake) +# Make sure we can find internal find_package modules only used for +# building CMake and not for shipping externally +list(INSERT CMAKE_MODULE_PATH 0 ${CMake_SOURCE_DIR}/Source/Modules) + if(CMAKE_BOOTSTRAP) # Running from bootstrap script. Set local variable and remove from cache. set(CMAKE_BOOTSTRAP 1) @@ -441,7 +445,7 @@ macro (CMAKE_BUILD_UTILITIES) # Build jsoncpp library. if(CMAKE_USE_SYSTEM_JSONCPP) if(NOT CMAKE_VERSION VERSION_LESS 3.0) - include(${CMake_SOURCE_DIR}/Source/Modules/FindJsonCpp.cmake) + find_package(JsonCpp) else() message(FATAL_ERROR "CMAKE_USE_SYSTEM_JSONCPP requires CMake >= 3.0") endif() @@ -487,7 +491,7 @@ int main(void) { return 0; } if(CMAKE_USE_LIBUV) if(CMAKE_USE_SYSTEM_LIBUV) if(NOT CMAKE_VERSION VERSION_LESS 3.0) - include(${CMake_SOURCE_DIR}/Source/Modules/FindLibUV.cmake) + find_package(LibUV 1.0.0) else() message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBUV requires CMake >= 3.0") endif() diff --git a/Help/release/3.7.rst b/Help/release/3.7.rst index 97c6f7c..9794267 100644 --- a/Help/release/3.7.rst +++ b/Help/release/3.7.rst @@ -176,7 +176,14 @@ Modules * A :module:`FindICU` module was introduced to find the International Components for Unicode (ICU) libraries and programs. -* The :module:`FindMatlab` module learned to find a SIMULINK component. +* The :module:`FindMatlab` module learned to find the SIMULINK and MAT + components. + +* The :module:`FindMatlab` module :command:`matlab_add_mex` command learned + to add executables and modules. + +* The :module:`FindMatlab` module :command:`matlab_add_unit_test` command + learned to support inline Matlab test code. * The :module:`FindOpenCL` module now provides imported targets. @@ -242,6 +249,10 @@ CPack :variable:`CPACK_RPM_SOURCE_PKG_BUILD_PARAMS` and :variable:`CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX`. +* The CPack NSIS generator now supports + :variable:`CPACK_NSIS_<compName>_INSTALL_DIRECTORY`. + This can be used to set component specific installation directories. + * The CPack WIX generator now supports :variable:`CPACK_WIX_SKIP_PROGRAM_FOLDER` to allow specification of a custom absolute installation prefix outside diff --git a/Help/release/dev/0-sample-topic.rst b/Help/release/dev/0-sample-topic.rst deleted file mode 100644 index e4cc01e..0000000 --- a/Help/release/dev/0-sample-topic.rst +++ /dev/null @@ -1,7 +0,0 @@ -0-sample-topic --------------- - -* This is a sample release note for the change in a topic. - Developers should add similar notes for each topic branch - making a noteworthy change. Each document should be named - and titled to match the topic name to avoid merge conflicts. diff --git a/Help/release/index.rst b/Help/release/index.rst index 30decd5..25c6c3e 100644 --- a/Help/release/index.rst +++ b/Help/release/index.rst @@ -5,8 +5,6 @@ CMake Release Notes This file should include the adjacent "dev.txt" file in development versions but not in release versions. -.. include:: dev.txt - Releases ======== diff --git a/Help/variable/CMAKE_CODELITE_USE_TARGETS.rst b/Help/variable/CMAKE_CODELITE_USE_TARGETS.rst index 4aede03..33cdf6c 100644 --- a/Help/variable/CMAKE_CODELITE_USE_TARGETS.rst +++ b/Help/variable/CMAKE_CODELITE_USE_TARGETS.rst @@ -3,5 +3,6 @@ CMAKE_CODELITE_USE_TARGETS Change the way the CodeLite generator creates projectfiles. -If this variable is set to ``ON`` the generator creates projectfiles -based on targets rather than projects. +If this variable evaluates to ``ON`` at the end of the top-level +``CMakeLists.txt`` file, the generator creates projectfiles based on targets +rather than projects. diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 3bbaae9..15b62c7 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -1427,7 +1427,8 @@ function(cpack_rpm_debugsymbol_check INSTALL_FILES WORKING_DIR) execute_process(COMMAND "${OBJDUMP_EXECUTABLE}" -h ${WORKING_DIR}/${F} WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}" RESULT_VARIABLE OBJDUMP_EXEC_RESULT - OUTPUT_VARIABLE OBJDUMP_OUT) + OUTPUT_VARIABLE OBJDUMP_OUT + ERROR_QUIET) # Check that if the given file was executable or not if(NOT OBJDUMP_EXEC_RESULT) string(FIND "${OBJDUMP_OUT}" "debug" FIND_RESULT) @@ -1476,16 +1477,22 @@ function(cpack_rpm_debugsymbol_check INSTALL_FILES WORKING_DIR) endif() endforeach() - list(REMOVE_DUPLICATES mkdir_list_) - unset(TMP_RPM_DEBUGINFO_INSTALL) - foreach(part_ IN LISTS mkdir_list_) - string(APPEND TMP_RPM_DEBUGINFO_INSTALL "mkdir -p \"${part_}\"\n") - endforeach() + list(LENGTH mkdir_list_ len_) + if(len_) + list(REMOVE_DUPLICATES mkdir_list_) + unset(TMP_RPM_DEBUGINFO_INSTALL) + foreach(part_ IN LISTS mkdir_list_) + string(APPEND TMP_RPM_DEBUGINFO_INSTALL "mkdir -p \"${part_}\"\n") + endforeach() + endif() - list(REMOVE_DUPLICATES cp_list_) - foreach(part_ IN LISTS cp_list_) - string(APPEND TMP_RPM_DEBUGINFO_INSTALL "${part_}\n") - endforeach() + list(LENGTH cp_list_ len_) + if(len_) + list(REMOVE_DUPLICATES cp_list_) + foreach(part_ IN LISTS cp_list_) + string(APPEND TMP_RPM_DEBUGINFO_INSTALL "${part_}\n") + endforeach() + endif() if(NOT DEFINED CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS) set(CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS /usr /usr/src /usr/src/debug) @@ -1500,29 +1507,34 @@ function(cpack_rpm_debugsymbol_check INSTALL_FILES WORKING_DIR) message("CPackRPM:Debug: CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS= ${CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS}") endif() - list(REMOVE_DUPLICATES additional_sources_) - unset(additional_sources_all_) - foreach(source_ IN LISTS additional_sources_) - string(REPLACE "/" ";" split_source_ " ${source_}") - list(REMOVE_AT split_source_ 0) - unset(tmp_path_) - # Now generate all segments of the path - foreach(segment_ IN LISTS split_source_) - string(APPEND tmp_path_ "/${segment_}") - list(APPEND additional_sources_all_ "${tmp_path_}") + list(LENGTH additional_sources_ len_) + if(len_) + list(REMOVE_DUPLICATES additional_sources_) + unset(additional_sources_all_) + foreach(source_ IN LISTS additional_sources_) + string(REPLACE "/" ";" split_source_ " ${source_}") + list(REMOVE_AT split_source_ 0) + unset(tmp_path_) + # Now generate all segments of the path + foreach(segment_ IN LISTS split_source_) + string(APPEND tmp_path_ "/${segment_}") + list(APPEND additional_sources_all_ "${tmp_path_}") + endforeach() endforeach() - endforeach() - list(REMOVE_DUPLICATES additional_sources_all_) - list(REMOVE_ITEM additional_sources_all_ ${CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS}) + list(REMOVE_DUPLICATES additional_sources_all_) + list(REMOVE_ITEM additional_sources_all_ + ${CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS}) - unset(TMP_DEBUGINFO_ADDITIONAL_SOURCES) - foreach(source_ IN LISTS additional_sources_all_) - string(APPEND TMP_DEBUGINFO_ADDITIONAL_SOURCES "${source_}\n") - endforeach() + unset(TMP_DEBUGINFO_ADDITIONAL_SOURCES) + foreach(source_ IN LISTS additional_sources_all_) + string(APPEND TMP_DEBUGINFO_ADDITIONAL_SOURCES "${source_}\n") + endforeach() + endif() set(TMP_RPM_DEBUGINFO_INSTALL "${TMP_RPM_DEBUGINFO_INSTALL}" PARENT_SCOPE) - set(TMP_DEBUGINFO_ADDITIONAL_SOURCES "${TMP_DEBUGINFO_ADDITIONAL_SOURCES}" PARENT_SCOPE) + set(TMP_DEBUGINFO_ADDITIONAL_SOURCES "${TMP_DEBUGINFO_ADDITIONAL_SOURCES}" + PARENT_SCOPE) endfunction() function(cpack_rpm_variable_fallback OUTPUT_VAR_NAME) diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 6beacce..b7f2db5 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -737,9 +737,9 @@ endfunction() # added to the Matlab path. # ``CUSTOM_MATLAB_COMMAND`` # Matlab script command to run as the test. -# IIf this is not set, then the following is run: -# "runtests('matlab_file_name'), exit(max([ans(1,:).Failed])) -# matlab_file_name comes from UNITTEST_FILE without the .m. +# If this is not set, then the following is run: +# ``runtests('matlab_file_name'), exit(max([ans(1,:).Failed]))`` +# where ``matlab_file_name`` is the ``UNITTEST_FILE`` without the extension. # ``UNITTEST_PRECOMMAND`` # Matlab script command to be ran before the file # containing the test (eg. GPU device initialisation based on CMake @@ -753,7 +753,7 @@ endfunction() # ``MATLAB_ADDITIONAL_STARTUP_OPTIONS`` # a list of additional option in order # to run Matlab from the command line. -# -nosplash -nodesktop -nodisplay are always added. +# ``-nosplash -nodesktop -nodisplay`` are always added. # ``TEST_ARGS`` # Additional options provided to the add_test command. These # options are added to the default options (eg. "CONFIGURATIONS Release") @@ -763,7 +763,7 @@ endfunction() # ``WORKING_DIRECTORY`` # This will be the working directory for the test. If specified it will # also be the output directory used for the log file of the test run. -# If not specifed the temporary directory ${CMAKE_BINARY_DIR}/Matlab will +# If not specifed the temporary directory ``${CMAKE_BINARY_DIR}/Matlab`` will # be used as the working directory and the log location. # function(matlab_add_unit_test) @@ -844,7 +844,6 @@ endfunction() # the same folder without any processing, with the same name as the final # mex file, and with extension `.m`. In that case, typing ``help <name>`` # in Matlab prints the documentation contained in this file. -# # ``MODULE`` or ``SHARED`` may be given to specify the type of library to be # created. ``EXECUTABLE`` may be given to create an executable instead of # a library. If no type is given explicitly, the type is ``SHARED``. @@ -1246,8 +1245,8 @@ if(_numbers_of_matlab_roots GREATER 0) endif() -# check if the root changed against the previous defined one, if so -# clear all the cached variables +# check if the root changed wrt. the previous defined one, if so +# clear all the cached variables for being able to reconfigure properly if(DEFINED Matlab_ROOT_DIR_LAST_CACHED) if(NOT Matlab_ROOT_DIR_LAST_CACHED STREQUAL Matlab_ROOT_DIR) @@ -1260,6 +1259,7 @@ if(DEFINED Matlab_ROOT_DIR_LAST_CACHED) Matlab_ENG_LIBRARY Matlab_MAT_LIBRARY Matlab_MEX_EXTENSION + Matlab_SIMULINK_INCLUDE_DIR # internal Matlab_MEXEXTENSIONS_PROG diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 10c07c2..14e392a 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -136,9 +136,11 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) foreach(FIL ${ARGN}) get_filename_component(ABS_FIL ${FIL} ABSOLUTE) get_filename_component(FIL_WE ${FIL} NAME_WE) - get_filename_component(FIL_DIR ${FIL} DIRECTORY) - if(FIL_DIR) - set(FIL_WE "${FIL_DIR}/${FIL_WE}") + if(NOT PROTOBUF_GENERATE_CPP_APPEND_PATH) + get_filename_component(FIL_DIR ${FIL} DIRECTORY) + if(FIL_DIR) + set(FIL_WE "${FIL_DIR}/${FIL_WE}") + endif() endif() list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc") @@ -197,9 +199,11 @@ function(PROTOBUF_GENERATE_PYTHON SRCS) foreach(FIL ${ARGN}) get_filename_component(ABS_FIL ${FIL} ABSOLUTE) get_filename_component(FIL_WE ${FIL} NAME_WE) - get_filename_component(FIL_DIR ${FIL} DIRECTORY) - if(FIL_DIR) - set(FIL_WE "${FIL_DIR}/${FIL_WE}") + if(NOT PROTOBUF_GENERATE_CPP_APPEND_PATH) + get_filename_component(FIL_DIR ${FIL} DIRECTORY) + if(FIL_DIR) + set(FIL_WE "${FIL_DIR}/${FIL_WE}") + endif() endif() list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}_pb2.py") diff --git a/Modules/Platform/Android/ndk-stl-c++.cmake b/Modules/Platform/Android/ndk-stl-c++.cmake index 14748a1..b27015d 100644 --- a/Modules/Platform/Android/ndk-stl-c++.cmake +++ b/Modules/Platform/Android/ndk-stl-c++.cmake @@ -3,7 +3,15 @@ set(_ANDROID_STL_RTTI 1) set(_ANDROID_STL_EXCEPTIONS 1) macro(__android_stl_cxx lang filename) # Add the include directory. - __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libcxx/include" 1) + if(EXISTS "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libcxx/include/cstddef") + # r12 and below + __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++/libcxx/include" 1) + __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++abi/libcxxabi/include" 1) + else() + # r13 and above + __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++/include" 1) + __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++abi/include" 1) + endif() # Add a secondary include directory if it exists. __android_stl_inc(${lang} "${CMAKE_ANDROID_NDK}/sources/android/support/include" 0) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 51a0fff..6cb0fea 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 20161003) -#set(CMake_VERSION_RC 1) +set(CMake_VERSION_MINOR 7) +set(CMake_VERSION_PATCH 0) +set(CMake_VERSION_RC 1) diff --git a/Source/QtIFW/cmake.org.html b/Source/QtIFW/cmake.org.html index cf5649d..001d634 100644 --- a/Source/QtIFW/cmake.org.html +++ b/Source/QtIFW/cmake.org.html @@ -1,6 +1,6 @@ <html> <head> -<meta http-equiv="Refresh" content="0; url=http://cmake.org/" /> +<meta http-equiv="Refresh" content="0; url=https://cmake.org/" /> </head> <body> </body> diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index 629c5b6..360c852 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -60,7 +60,6 @@ void cmExtraCodeLiteGenerator::Generate() // loop projects and locate the root project. // and extract the information for creating the worspace // root makefile - const cmMakefile* rmf = CM_NULLPTR; for (std::map<std::string, std::vector<cmLocalGenerator*> >::const_iterator it = projectMap.begin(); it != projectMap.end(); ++it) { @@ -75,7 +74,6 @@ void cmExtraCodeLiteGenerator::Generate() workspaceFileName = workspaceOutputDir + "/"; workspaceFileName += workspaceProjectName + ".workspace"; this->WorkspacePath = it->second[0]->GetCurrentBinaryDirectory(); - rmf = it->second[0]->GetMakefile(); ; break; } @@ -89,7 +87,7 @@ void cmExtraCodeLiteGenerator::Generate() xml.Attribute("Name", workspaceProjectName); bool const targetsAreProjects = - rmf && rmf->IsOn("CMAKE_CODELITE_USE_TARGETS"); + this->GlobalGenerator->GlobalSettingIsOn("CMAKE_CODELITE_USE_TARGETS"); std::vector<std::string> ProjectNames; if (targetsAreProjects) { diff --git a/Source/cmFileMonitor.cxx b/Source/cmFileMonitor.cxx index b97590b..41ec8b4 100644 --- a/Source/cmFileMonitor.cxx +++ b/Source/cmFileMonitor.cxx @@ -12,7 +12,7 @@ namespace { void on_directory_change(uv_fs_event_t* handle, const char* filename, int events, int status); -void on_handle_close(uv_handle_t* handle); +void on_fs_close(uv_handle_t* handle); } // namespace class cmIBaseWatcher @@ -177,7 +177,7 @@ public: { if (this->Handle) { uv_fs_event_stop(this->Handle); - uv_close(reinterpret_cast<uv_handle_t*>(this->Handle), &on_handle_close); + uv_close(reinterpret_cast<uv_handle_t*>(this->Handle), &on_fs_close); this->Handle = nullptr; } cmVirtualDirectoryWatcher::StopWatching(); @@ -292,9 +292,9 @@ void on_directory_change(uv_fs_event_t* handle, const char* filename, watcher->Trigger(pathSegment, events, status); } -void on_handle_close(uv_handle_t* handle) +void on_fs_close(uv_handle_t* handle) { - delete (reinterpret_cast<uv_fs_event_t*>(handle)); + delete reinterpret_cast<uv_fs_event_t*>(handle); } } // namespace diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index a446862..7132ade 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1007,6 +1007,25 @@ void cmGlobalGenerator::FillExtensionToLanguageMap(const std::string& l, } } +const char* cmGlobalGenerator::GetGlobalSetting(std::string const& name) const +{ + assert(!this->Makefiles.empty()); + return this->Makefiles[0]->GetDefinition(name); +} + +bool cmGlobalGenerator::GlobalSettingIsOn(std::string const& name) const +{ + assert(!this->Makefiles.empty()); + return this->Makefiles[0]->IsOn(name); +} + +const char* cmGlobalGenerator::GetSafeGlobalSetting( + std::string const& name) const +{ + assert(!this->Makefiles.empty()); + return this->Makefiles[0]->GetSafeDefinition(name); +} + bool cmGlobalGenerator::IgnoreFile(const char* ext) const { if (!this->GetLanguageFromExtension(ext).empty()) { diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 4120b52..add2b92 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -194,6 +194,10 @@ public: cmExportSetMap& GetExportSets() { return this->ExportSets; } + const char* GetGlobalSetting(std::string const& name) const; + bool GlobalSettingIsOn(std::string const& name) const; + const char* GetSafeGlobalSetting(std::string const& name) const; + /** Add a file to the manifest of generated targets for a configuration. */ void AddToManifest(std::string const& f); diff --git a/Source/cmServerConnection.cxx b/Source/cmServerConnection.cxx index c9822d3..a814d16 100644 --- a/Source/cmServerConnection.cxx +++ b/Source/cmServerConnection.cxx @@ -30,7 +30,7 @@ void on_read(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) if (nread >= 0) { conn->ReadData(std::string(buf->base, buf->base + nread)); } else { - conn->HandleEof(); + conn->TriggerShutdown(); } delete[](buf->base); @@ -56,6 +56,28 @@ void on_new_connection(uv_stream_t* stream, int status) conn->Connect(stream); } +void on_signal(uv_signal_t* signal, int signum) +{ + auto conn = reinterpret_cast<cmServerConnection*>(signal->data); + (void)(signum); + conn->TriggerShutdown(); +} + +void on_signal_close(uv_handle_t* handle) +{ + delete reinterpret_cast<uv_signal_t*>(handle); +} + +void on_pipe_close(uv_handle_t* handle) +{ + delete reinterpret_cast<uv_pipe_t*>(handle); +} + +void on_tty_close(uv_handle_t* handle) +{ + delete reinterpret_cast<uv_tty_t*>(handle); +} + } // namespace class LoopGuard @@ -64,19 +86,25 @@ public: LoopGuard(cmServerConnection* connection) : Connection(connection) { - Connection->mLoop = uv_default_loop(); - if (Connection->mLoop) { - Connection->mFileMonitor = new cmFileMonitor(Connection->mLoop); + this->Connection->mLoop = uv_default_loop(); + if (!this->Connection->mLoop) { + return; } + this->Connection->mFileMonitor = + new cmFileMonitor(this->Connection->mLoop); } ~LoopGuard() { - if (Connection->mFileMonitor) { - delete Connection->mFileMonitor; + if (!this->Connection->mLoop) { + return; } - uv_loop_close(Connection->mLoop); - Connection->mLoop = nullptr; + + if (this->Connection->mFileMonitor) { + delete this->Connection->mFileMonitor; + } + uv_loop_close(this->Connection->mLoop); + this->Connection->mLoop = nullptr; } private: @@ -111,6 +139,16 @@ bool cmServerConnection::ProcessEvents(std::string* errorMessage) return false; } + this->SIGINTHandler = new uv_signal_t; + uv_signal_init(this->mLoop, this->SIGINTHandler); + this->SIGINTHandler->data = static_cast<void*>(this); + uv_signal_start(this->SIGINTHandler, &on_signal, SIGINT); + + this->SIGHUPHandler = new uv_signal_t; + uv_signal_init(this->mLoop, this->SIGHUPHandler); + this->SIGHUPHandler->data = static_cast<void*>(this); + uv_signal_start(this->SIGHUPHandler, &on_signal, SIGHUP); + if (!DoSetup(errorMessage)) { return false; } @@ -162,9 +200,21 @@ void cmServerConnection::ReadData(const std::string& data) } } -void cmServerConnection::HandleEof() +void cmServerConnection::TriggerShutdown() { this->FileMonitor()->StopMonitoring(); + + uv_signal_stop(this->SIGINTHandler); + uv_signal_stop(this->SIGHUPHandler); + + uv_close(reinterpret_cast<uv_handle_t*>(this->SIGINTHandler), + &on_signal_close); // delete handle + uv_close(reinterpret_cast<uv_handle_t*>(this->SIGHUPHandler), + &on_signal_close); // delete handle + + this->SIGINTHandler = nullptr; + this->SIGHUPHandler = nullptr; + this->TearDown(); } @@ -194,30 +244,42 @@ void cmServerConnection::SendGreetings() Server->PrintHello(); } +cmServerStdIoConnection::cmServerStdIoConnection() +{ + this->Input.tty = nullptr; + this->Output.tty = nullptr; +} + bool cmServerStdIoConnection::DoSetup(std::string* errorMessage) { (void)(errorMessage); if (uv_guess_handle(1) == UV_TTY) { - uv_tty_init(this->Loop(), &this->Input.tty, 0, 1); - uv_tty_set_mode(&this->Input.tty, UV_TTY_MODE_NORMAL); - Input.tty.data = this; - this->ReadStream = reinterpret_cast<uv_stream_t*>(&this->Input.tty); - - uv_tty_init(this->Loop(), &this->Output.tty, 1, 0); - uv_tty_set_mode(&this->Output.tty, UV_TTY_MODE_NORMAL); - Output.tty.data = this; - this->WriteStream = reinterpret_cast<uv_stream_t*>(&this->Output.tty); + usesTty = true; + this->Input.tty = new uv_tty_t; + uv_tty_init(this->Loop(), this->Input.tty, 0, 1); + uv_tty_set_mode(this->Input.tty, UV_TTY_MODE_NORMAL); + Input.tty->data = this; + this->ReadStream = reinterpret_cast<uv_stream_t*>(this->Input.tty); + + this->Output.tty = new uv_tty_t; + uv_tty_init(this->Loop(), this->Output.tty, 1, 0); + uv_tty_set_mode(this->Output.tty, UV_TTY_MODE_NORMAL); + Output.tty->data = this; + this->WriteStream = reinterpret_cast<uv_stream_t*>(this->Output.tty); } else { - uv_pipe_init(this->Loop(), &this->Input.pipe, 0); - uv_pipe_open(&this->Input.pipe, 0); - Input.pipe.data = this; - this->ReadStream = reinterpret_cast<uv_stream_t*>(&this->Input.pipe); - - uv_pipe_init(this->Loop(), &this->Output.pipe, 0); - uv_pipe_open(&this->Output.pipe, 1); - Output.pipe.data = this; - this->WriteStream = reinterpret_cast<uv_stream_t*>(&this->Output.pipe); + usesTty = false; + this->Input.pipe = new uv_pipe_t; + uv_pipe_init(this->Loop(), this->Input.pipe, 0); + uv_pipe_open(this->Input.pipe, 0); + Input.pipe->data = this; + this->ReadStream = reinterpret_cast<uv_stream_t*>(this->Input.pipe); + + this->Output.pipe = new uv_pipe_t; + uv_pipe_init(this->Loop(), this->Output.pipe, 0); + uv_pipe_open(this->Output.pipe, 1); + Output.pipe->data = this; + this->WriteStream = reinterpret_cast<uv_stream_t*>(this->Output.pipe); } SendGreetings(); @@ -228,26 +290,35 @@ bool cmServerStdIoConnection::DoSetup(std::string* errorMessage) void cmServerStdIoConnection::TearDown() { - uv_close(reinterpret_cast<uv_handle_t*>(this->ReadStream), nullptr); + if (usesTty) { + uv_close(reinterpret_cast<uv_handle_t*>(this->Input.tty), &on_tty_close); + uv_close(reinterpret_cast<uv_handle_t*>(this->Output.tty), &on_tty_close); + this->Input.tty = nullptr; + this->Output.tty = nullptr; + } else { + uv_close(reinterpret_cast<uv_handle_t*>(this->Input.pipe), &on_pipe_close); + uv_close(reinterpret_cast<uv_handle_t*>(this->Output.pipe), + &on_pipe_close); + this->Input.pipe = nullptr; + this->Input.pipe = nullptr; + } this->ReadStream = nullptr; - uv_close(reinterpret_cast<uv_handle_t*>(this->WriteStream), nullptr); this->WriteStream = nullptr; } cmServerPipeConnection::cmServerPipeConnection(const std::string& name) : PipeName(name) { - this->ServerPipe.data = nullptr; - this->ClientPipe.data = nullptr; } bool cmServerPipeConnection::DoSetup(std::string* errorMessage) { - uv_pipe_init(this->Loop(), &this->ServerPipe, 0); - this->ServerPipe.data = this; + this->ServerPipe = new uv_pipe_t; + uv_pipe_init(this->Loop(), this->ServerPipe, 0); + this->ServerPipe->data = this; int r; - if ((r = uv_pipe_bind(&this->ServerPipe, this->PipeName.c_str())) != 0) { + if ((r = uv_pipe_bind(this->ServerPipe, this->PipeName.c_str())) != 0) { *errorMessage = std::string("Internal Error with ") + this->PipeName + ": " + uv_err_name(r); return false; @@ -265,31 +336,34 @@ bool cmServerPipeConnection::DoSetup(std::string* errorMessage) void cmServerPipeConnection::TearDown() { - if (this->WriteStream->data) { - uv_close(reinterpret_cast<uv_handle_t*>(this->WriteStream), nullptr); + if (this->ClientPipe) { + uv_close(reinterpret_cast<uv_handle_t*>(this->ClientPipe), &on_pipe_close); this->WriteStream->data = nullptr; } - uv_close(reinterpret_cast<uv_handle_t*>(&this->ServerPipe), nullptr); + uv_close(reinterpret_cast<uv_handle_t*>(&this->ServerPipe), &on_pipe_close); + this->ClientPipe = nullptr; + this->ServerPipe = nullptr; this->WriteStream = nullptr; this->ReadStream = nullptr; } void cmServerPipeConnection::Connect(uv_stream_t* server) { - if (this->ClientPipe.data == this) { + if (this->ClientPipe) { // Accept and close all pipes but the first: - uv_pipe_t rejectPipe; + uv_pipe_t* rejectPipe = new uv_pipe_t; - uv_pipe_init(this->Loop(), &rejectPipe, 0); - auto rejecter = reinterpret_cast<uv_stream_t*>(&rejectPipe); + uv_pipe_init(this->Loop(), rejectPipe, 0); + auto rejecter = reinterpret_cast<uv_stream_t*>(rejectPipe); uv_accept(server, rejecter); - uv_close(reinterpret_cast<uv_handle_t*>(rejecter), nullptr); + uv_close(reinterpret_cast<uv_handle_t*>(rejecter), &on_pipe_close); return; } - uv_pipe_init(this->Loop(), &this->ClientPipe, 0); - this->ClientPipe.data = this; + this->ClientPipe = new uv_pipe_t; + uv_pipe_init(this->Loop(), this->ClientPipe, 0); + this->ClientPipe->data = this; auto client = reinterpret_cast<uv_stream_t*>(&this->ClientPipe); if (uv_accept(server, client) != 0) { uv_close(reinterpret_cast<uv_handle_t*>(client), nullptr); diff --git a/Source/cmServerConnection.h b/Source/cmServerConnection.h index 78842e7..3efe28d 100644 --- a/Source/cmServerConnection.h +++ b/Source/cmServerConnection.h @@ -24,7 +24,7 @@ public: bool ProcessEvents(std::string* errorMessage); void ReadData(const std::string& data); - void HandleEof(); + void TriggerShutdown(); void WriteData(const std::string& data); void ProcessNextRequest(); @@ -51,6 +51,8 @@ private: uv_loop_t* mLoop = nullptr; cmFileMonitor* mFileMonitor = nullptr; cmServer* Server = nullptr; + uv_signal_t* SIGINTHandler = nullptr; + uv_signal_t* SIGHUPHandler = nullptr; friend class LoopGuard; }; @@ -58,6 +60,7 @@ private: class cmServerStdIoConnection : public cmServerConnection { public: + cmServerStdIoConnection(); bool DoSetup(std::string* errorMessage) override; void TearDown() override; @@ -65,10 +68,12 @@ public: private: typedef union { - uv_tty_t tty; - uv_pipe_t pipe; + uv_tty_t* tty; + uv_pipe_t* pipe; } InOutUnion; + bool usesTty = false; + InOutUnion Input; InOutUnion Output; }; @@ -85,6 +90,6 @@ public: private: const std::string PipeName; - uv_pipe_t ServerPipe; - uv_pipe_t ClientPipe; + uv_pipe_t* ServerPipe = nullptr; + uv_pipe_t* ClientPipe = nullptr; }; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index d81f59d..6690bfa 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2736,8 +2736,10 @@ void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile() (*this->BuildFileStream) << cmVS10EscapeXML(artifactDir) << "\\</AppxPackageArtifactsDir>\n"; this->WriteString("<ProjectPriFullPath>", 2); - (*this->BuildFileStream) << cmVS10EscapeXML(artifactDir) - << "\\resources.pri</ProjectPriFullPath>\n"; + std::string resourcePriFile = + this->DefaultArtifactDir + "/resources.pri"; + this->ConvertToWindowsSlash(resourcePriFile); + (*this->BuildFileStream) << resourcePriFile << "</ProjectPriFullPath>\n"; // If we are missing files and we don't have a certificate and // aren't targeting WP8.0, add a default certificate diff --git a/Tests/RunCMake/Android/android.cxx b/Tests/RunCMake/Android/android.cxx index e6a6cda..2dee8f9 100644 --- a/Tests/RunCMake/Android/android.cxx +++ b/Tests/RunCMake/Android/android.cxx @@ -6,6 +6,9 @@ #ifndef STL_SYSTEM #include <exception> #include <typeinfo> +#ifndef STL_STLPORT +#include <cxxabi.h> +#endif #ifndef STL_GABI #include <iostream> #include <string> diff --git a/Tests/RunCMake/Android/common.cmake b/Tests/RunCMake/Android/common.cmake index 7eac5d6..d803c98 100644 --- a/Tests/RunCMake/Android/common.cmake +++ b/Tests/RunCMake/Android/common.cmake @@ -17,8 +17,8 @@ foreach(f endif() endforeach() -string(APPEND CMAKE_C_FLAGS " -Werror") -string(APPEND CMAKE_CXX_FLAGS " -Werror") +string(APPEND CMAKE_C_FLAGS " -Werror -Wno-attributes") +string(APPEND CMAKE_CXX_FLAGS " -Werror -Wno-attributes") string(APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,-no-undefined") if(CMAKE_ANDROID_NDK) @@ -43,6 +43,8 @@ elseif(CMAKE_ANDROID_STL_TYPE STREQUAL "system") add_definitions(-DSTL_SYSTEM) elseif(CMAKE_ANDROID_STL_TYPE MATCHES [[^gabi\+\+]]) add_definitions(-DSTL_GABI) +elseif(CMAKE_ANDROID_STL_TYPE MATCHES [[^stlport]]) + add_definitions(-DSTL_STLPORT) endif() string(REPLACE "-" "_" abi "${CMAKE_ANDROID_ARCH_ABI}") diff --git a/Utilities/Release/upload_release.cmake b/Utilities/Release/upload_release.cmake index 04a0cac..1485d9c 100644 --- a/Utilities/Release/upload_release.cmake +++ b/Utilities/Release/upload_release.cmake @@ -1,6 +1,6 @@ set(CTEST_RUN_CURRENT_SCRIPT 0) if(NOT VERSION) - set(VERSION 3.6) + set(VERSION 3.7) endif() if(NOT DEFINED PROJECT_PREFIX) set(PROJECT_PREFIX cmake-${VERSION}) |