From 1e02c508a45115255f776f8839c8f0e88cffbe0e Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Tue, 4 Jul 2023 14:41:09 +0200 Subject: [PATCH 01/18] Cleanup CI and README --- .../azure-pipelines-linux-clang.yml | 38 --------- .../azure-pipelines-linux-gcc.yml | 33 -------- .azure-pipelines/azure-pipelines-osx.yml | 26 ------ .azure-pipelines/azure-pipelines-win.yml | 84 ------------------- .azure-pipelines/unix-build.yml | 27 ------ README.md | 3 +- azure-pipelines.yml | 8 -- 7 files changed, 1 insertion(+), 218 deletions(-) delete mode 100644 .azure-pipelines/azure-pipelines-linux-clang.yml delete mode 100644 .azure-pipelines/azure-pipelines-linux-gcc.yml delete mode 100644 .azure-pipelines/azure-pipelines-osx.yml delete mode 100644 .azure-pipelines/azure-pipelines-win.yml delete mode 100644 .azure-pipelines/unix-build.yml delete mode 100644 azure-pipelines.yml diff --git a/.azure-pipelines/azure-pipelines-linux-clang.yml b/.azure-pipelines/azure-pipelines-linux-clang.yml deleted file mode 100644 index 87d7592..0000000 --- a/.azure-pipelines/azure-pipelines-linux-clang.yml +++ /dev/null @@ -1,38 +0,0 @@ -jobs: - - job: 'Linux_0' - strategy: - matrix: - clang_6: - llvm_version: '6.0' - clang_7: - llvm_version: '7' - clang_8: - llvm_version: '8' - clang_9: - llvm_version: '9' - pool: - vmImage: ubuntu-18.04 - variables: - CC: clang-$(llvm_version) - CXX: clang++-$(llvm_version) - timeoutInMinutes: 360 - steps: - - - script: | - sudo add-apt-repository ppa:ubuntu-toolchain-r/test - if [[ $(llvm_version) == '4.0' || $(llvm_version) == '5.0' ]]; then - sudo apt-get update - sudo apt-get --no-install-suggests --no-install-recommends install gcc-4.9 clang-$(llvm_version) - else - LLVM_VERSION=$(llvm_version) - get -O - http://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - sudo add-apt-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-$LLVM_VERSION main" - sudo apt-get update - sudo apt-get --no-install-suggests --no-install-recommends install clang-$(llvm_version) - fi - displayName: Install build toolchain - - - bash: echo "##vso[task.prependpath]$CONDA/bin" - displayName: Add conda to PATH - - - template: unix-build.yml diff --git a/.azure-pipelines/azure-pipelines-linux-gcc.yml b/.azure-pipelines/azure-pipelines-linux-gcc.yml deleted file mode 100644 index a6e6939..0000000 --- a/.azure-pipelines/azure-pipelines-linux-gcc.yml +++ /dev/null @@ -1,33 +0,0 @@ -jobs: - - job: 'Linux_1' - strategy: - matrix: - gcc_6: - gcc_version: '6' - gcc_7: - gcc_version: '7' - gcc_8: - gcc_version: '8' - gcc_9: - gcc_version: '9' - pool: - vmImage: ubuntu-18.04 - variables: - CC: gcc-$(gcc_version) - CXX: g++-$(gcc_version) - timeoutInMinutes: 360 - steps: - - - script: | - if [[ $(gcc_version) == '4.9' || $(gcc_version) == '6' || $(gcc_version) == '7' || $(gcc_version) == '8' ]]; then - sudo add-apt-repository ppa:ubuntu-toolchain-r/test - sudo apt-get update - sudo apt-get --no-install-suggests --no-install-recommends install g++-$(gcc_version) - fi - displayName: Install build toolchain - - - bash: echo "##vso[task.prependpath]$CONDA/bin" - displayName: Add conda to PATH - - - template: unix-build.yml - diff --git a/.azure-pipelines/azure-pipelines-osx.yml b/.azure-pipelines/azure-pipelines-osx.yml deleted file mode 100644 index 9fbfd07..0000000 --- a/.azure-pipelines/azure-pipelines-osx.yml +++ /dev/null @@ -1,26 +0,0 @@ -jobs: - - job: 'OSX' - strategy: - matrix: - macOS_11: - image_name: 'macOS-11' - macOS_12: - image_name: 'macOS-12' - pool: - vmImage: $(image_name) - variables: - CC: clang - CXX: clang++ - timeoutInMinutes: 360 - steps: - - script: | - echo "Removing homebrew for Azure to avoid conflicts with conda" - /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" - displayName: Remove homebrew - - - bash: | - echo "##vso[task.prependpath]$CONDA/bin" - sudo chown -R $USER $CONDA - displayName: Add conda to PATH - - - template: unix-build.yml diff --git a/.azure-pipelines/azure-pipelines-win.yml b/.azure-pipelines/azure-pipelines-win.yml deleted file mode 100644 index 1728a13..0000000 --- a/.azure-pipelines/azure-pipelines-win.yml +++ /dev/null @@ -1,84 +0,0 @@ - -jobs: - - job: 'Windows_clangcl' - pool: - vmImage: 'windows-2019' - timeoutInMinutes: 360 - steps: - - # Install Chocolatey (https://chocolatey.org/install#install-with-powershellexe) - - powershell: | - Set-ExecutionPolicy Bypass -Scope Process -Force - iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) - Write-Host "##vso[task.setvariable variable=PATH]$env:PATH" - choco --version - displayName: "Install Chocolatey" - - # Install Miniconda - - script: | - choco install miniconda3 --yes - set PATH=C:\tools\miniconda3\Scripts;C:\tools\miniconda3;C:\tools\miniconda3\Library\bin;%PATH% - echo '##vso[task.setvariable variable=PATH]%PATH%' - set LIB=C:\tools\miniconda3\Library\lib;%LIB% - echo '##vso[task.setvariable variable=LIB]%LIB%' - conda --version - displayName: "Install Miniconda" - - # Configure Miniconda - - script: | - conda config --set always_yes yes - conda config --append channels conda-forge - conda info - displayName: "Configure Miniconda" - - # Create conda enviroment - # Note: conda activate doesn't work here, because it creates a new shell! - - script: | - conda install cmake==3.14.0 ^ - ninja ^ - doctest ^ - nlohmann_json ^ - python=3.9 - conda list - displayName: "Install conda packages" - - # Install LLVM - # Note: LLVM distributed by conda is too old - - script: | - choco install llvm --yes - set PATH=C:\Program Files\LLVM\bin;%PATH% - echo '##vso[task.setvariable variable=PATH]%PATH%' - clang-cl --version - displayName: "Install LLVM" - - # Configure - - script: | - setlocal EnableDelayedExpansion - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64 - mkdir build & cd build - cmake -G Ninja ^ - -DCMAKE_BUILD_TYPE=Release ^ - -DCMAKE_C_COMPILER=clang-cl ^ - -DCMAKE_CXX_COMPILER=clang-cl ^ - -DBUILD_TESTS=ON ^ - $(Build.SourcesDirectory) - displayName: "Configure xtl" - workingDirectory: $(Build.BinariesDirectory) - - # Build - - script: | - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64 - cmake --build . ^ - --config Release ^ - --target test_xtl ^ - -- -v - displayName: "Build xtl" - workingDirectory: $(Build.BinariesDirectory)/build - - # Test - - script: | - setlocal EnableDelayedExpansion - cd test - .\test_xtl - displayName: "Test xtl" - workingDirectory: $(Build.BinariesDirectory)/build/test diff --git a/.azure-pipelines/unix-build.yml b/.azure-pipelines/unix-build.yml deleted file mode 100644 index 835803e..0000000 --- a/.azure-pipelines/unix-build.yml +++ /dev/null @@ -1,27 +0,0 @@ -steps: - - script: | - conda config --set always_yes yes --set changeps1 no - conda update -q conda - conda env create --file environment-dev.yml - displayName: Install dependencies - - - script: | - source activate xtl - mkdir build - cd build - cmake -DBUILD_TESTS=ON $(Build.SourcesDirectory) - displayName: Configure xtl - workingDirectory: $(Build.BinariesDirectory) - - - script: | - source activate xtl - make -j2 test_xtl - displayName: Build xtl - workingDirectory: $(Build.BinariesDirectory)/build - - - script: | - source activate xtl - cd test - ./test_xtl - displayName: Test xtl - workingDirectory: $(Build.BinariesDirectory)/build/test diff --git a/README.md b/README.md index 224efb0..a8fa40d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # ![xtl](docs/source/xtl.svg) -[![Appveyor](https://ci.appveyor.com/api/projects/status/wikc50xlb5rbrjy7?svg=true)](https://ci.appveyor.com/project/xtensor-stack/xtl) -[![Azure](https://dev.azure.com/xtensor-stack/xtensor-stack/_apis/build/status/xtensor-stack.xtl?branchName=master)](https://dev.azure.com/xtensor-stack/xtensor-stack/_build/latest?definitionId=2&branchName=master) +[![Build Status](https://github.com/xtenosr-stack/xtl/workflows/CI/badge.svg)](https://github.com/xtensor-stack/xtl/actions) [![Documentation Status](http://readthedocs.org/projects/xtl/badge/?version=latest)](https://xtl.readthedocs.io/en/latest/?badge=latest) [![Join the Gitter Chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/QuantStack/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 39a9170..0000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,8 +0,0 @@ -trigger: - - master - -jobs: - #- template: ./.azure-pipelines/azure-pipelines-win.yml - #- template: ./.azure-pipelines/azure-pipelines-linux-clang.yml - #- template: ./.azure-pipelines/azure-pipelines-linux-gcc.yml - #- template: ./.azure-pipelines/azure-pipelines-osx.yml From dc6aa38a9a4d48e6341ce74bb8a2dff04125e8b4 Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Tue, 4 Jul 2023 14:45:49 +0200 Subject: [PATCH 02/18] Fixed README badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a8fa40d..7768fba 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ![xtl](docs/source/xtl.svg) -[![Build Status](https://github.com/xtenosr-stack/xtl/workflows/CI/badge.svg)](https://github.com/xtensor-stack/xtl/actions) +[![Build Status](https://github.com/xtensor-stack/xtl/workflows/CI/badge.svg)](https://github.com/xtensor-stack/xtl/actions) [![Documentation Status](http://readthedocs.org/projects/xtl/badge/?version=latest)](https://xtl.readthedocs.io/en/latest/?badge=latest) [![Join the Gitter Chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/QuantStack/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) From 2fafba6af0aed4fe935e6c43a779cb9fd620b3cf Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Tue, 4 Jul 2023 15:11:51 +0200 Subject: [PATCH 03/18] Added badges forw GHA workflows --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7768fba..db1a0e8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # ![xtl](docs/source/xtl.svg) -[![Build Status](https://github.com/xtensor-stack/xtl/workflows/CI/badge.svg)](https://github.com/xtensor-stack/xtl/actions) +[![Linux](https://github.com/xtensor-stack/xtl/actions/workflows/linux.yml/badge.svg)](https://github.com/xtensor-stack/xtl/actions/workflows/linux.yml) +[![OSX](https://github.com/xtensor-stack/xtl/actions/workflows/osx.yml/badge.svg)](https://github.com/xtensor-stack/xtl/actions/workflows/osx.yml) +[![Windows](https://github.com/xtensor-stack/xtl/actions/workflows/windows.yml/badge.svg)](https://github.com/xtensor-stack/xtl/actions/workflows/windows.yml) [![Documentation Status](http://readthedocs.org/projects/xtl/badge/?version=latest)](https://xtl.readthedocs.io/en/latest/?badge=latest) [![Join the Gitter Chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/QuantStack/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) From 953e8b3528aa42d2e95359314f2fd7f5e81e0ab6 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Wed, 4 Oct 2023 10:56:41 +0200 Subject: [PATCH 04/18] test/CMakeLists.txt: remove extra find_package(Threads) The directive is also present later. The earlier occurrence makes compilation fail with the following error: ``` CMake Error at /usr/share/cmake-3.27/Modules/FindThreads.cmake:66 (message): FindThreads only works if either C or CXX language is enabled Call Stack (most recent call first): CMakeLists.txt:13 (find_package) ``` --- test/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d85a02c..955ff22 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -10,7 +10,6 @@ cmake_minimum_required(VERSION 3.1) find_package(doctest REQUIRED) -find_package(Threads) if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) project(xtl-test) From 65e956f790a460e23ea3e449858d16052fd56eff Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Sun, 29 Oct 2023 05:58:41 +0100 Subject: [PATCH 05/18] Fixed RTD build --- readthedocs.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/readthedocs.yml b/readthedocs.yml index 02f0e7b..38f414b 100644 --- a/readthedocs.yml +++ b/readthedocs.yml @@ -1,2 +1,9 @@ +version: 2 + +build: + os: "ubuntu-22.04" + tools: + python: "mambaforge-22.9" + conda: - file: docs/environment.yml + environment: docs/environment.yml From c8adef3d7ca4921c88cb222bf7aa374d27c0e12b Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Sun, 29 Oct 2023 06:03:03 +0100 Subject: [PATCH 06/18] Unpinned breathe --- docs/environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/environment.yml b/docs/environment.yml index f0d7d7d..6ab4419 100644 --- a/docs/environment.yml +++ b/docs/environment.yml @@ -4,4 +4,4 @@ channels: - conda-forge dependencies: - - breathe==4.16.0 + - breathe From 2a014022ee36cba04b644a2492d3163ddbcc07ed Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Sun, 29 Oct 2023 06:06:58 +0100 Subject: [PATCH 07/18] Added sphinx_rtd_theme to dependency list --- docs/environment.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/environment.yml b/docs/environment.yml index 6ab4419..778db06 100644 --- a/docs/environment.yml +++ b/docs/environment.yml @@ -5,3 +5,4 @@ channels: dependencies: - breathe + - sphinx_rtd_theme From 3303ffd6f3660e809bf2fb03b4c65f32fd592a90 Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Thu, 2 Nov 2023 14:27:39 +0100 Subject: [PATCH 08/18] Fixed jQuery not loaded on RTD page issue --- docs/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 242e3fd..ed78581 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -20,7 +20,7 @@ def setup(app): app.add_css_file("main_stylesheet.css") -extensions = ['breathe'] +extensions = ['breathe', 'sphinx_rtd_theme'] breathe_projects = { 'xtl': '../xml' } templates_path = ['_templates'] html_static_path = ['_static'] From 88f154d76470a992856b4c937b4ab635489ee652 Mon Sep 17 00:00:00 2001 From: ikuokuo Date: Sat, 4 Nov 2023 01:21:04 +0800 Subject: [PATCH 09/18] Fixed half errhandling throw except --- include/xtl/xhalf_float_impl.hpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/include/xtl/xhalf_float_impl.hpp b/include/xtl/xhalf_float_impl.hpp index 40a398a..12a9086 100644 --- a/include/xtl/xhalf_float_impl.hpp +++ b/include/xtl/xhalf_float_impl.hpp @@ -3996,14 +3996,31 @@ namespace half_float { /// \throw std::range_error if `FE_INEXACT` is selected and set inline void fethrowexcept(int excepts, const char *msg = "") { excepts &= detail::errflags(); - if(excepts & (FE_INVALID|FE_DIVBYZERO)) +#if HALF_ERRHANDLING_THROWS + #ifdef HALF_ERRHANDLING_THROW_INVALID + if(excepts & FE_INVALID) throw std::domain_error(msg); + #endif + #ifdef HALF_ERRHANDLING_THROW_DIVBYZERO + if(excepts & FE_DIVBYZERO) + throw std::domain_error(msg); + #endif + #ifdef HALF_ERRHANDLING_THROW_OVERFLOW if(excepts & FE_OVERFLOW) throw std::overflow_error(msg); + #endif + #ifdef HALF_ERRHANDLING_THROW_UNDERFLOW if(excepts & FE_UNDERFLOW) throw std::underflow_error(msg); + #endif + #ifdef HALF_ERRHANDLING_THROW_INEXACT if(excepts & FE_INEXACT) throw std::range_error(msg); + #endif +#else + std::fprintf(stderr, "%s\n", msg); + std::terminate(); +#endif } /// \} } From 2c5e10c9e52502c4a66457ed6d2ff7f43976e4d7 Mon Sep 17 00:00:00 2001 From: Drew Hubley <96780897+spectre-ns@users.noreply.github.com> Date: Sun, 10 Dec 2023 07:51:17 -0400 Subject: [PATCH 10/18] Update xtype_traits.hpp --- include/xtl/xtype_traits.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/xtl/xtype_traits.hpp b/include/xtl/xtype_traits.hpp index 6558be8..07a04b3 100644 --- a/include/xtl/xtype_traits.hpp +++ b/include/xtl/xtype_traits.hpp @@ -136,6 +136,12 @@ namespace xtl using type = typename promote_type::type>::type; }; + template + struct promote_type, std::complex, REST...> + { + using type = std::complex::type>; + }; + /** * Abbreviation of 'typename promote_type::type'. */ From c95f6c8b13ffb7f74f16d3fd6882668b79bd8412 Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Tue, 12 Dec 2023 15:54:43 +0100 Subject: [PATCH 11/18] Release 0.7.6 --- docs/source/changelog.rst | 9 +++++++++ include/xtl/xtl_config.hpp | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index 0df65e5..9611849 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -7,6 +7,15 @@ Changelog ========= +0.7.6 +----- + +- Add missing #include +- Fix promote_type with two complex floats and one double +- test/CMakeLists.txt: remove extra find_package(Threads) +- Fixed half errhandling throw except +- Resolve issue promoting multiple std::complex + 0.7.5 ----- diff --git a/include/xtl/xtl_config.hpp b/include/xtl/xtl_config.hpp index d0032d5..4106c32 100644 --- a/include/xtl/xtl_config.hpp +++ b/include/xtl/xtl_config.hpp @@ -12,7 +12,7 @@ #define XTL_VERSION_MAJOR 0 #define XTL_VERSION_MINOR 7 -#define XTL_VERSION_PATCH 5 +#define XTL_VERSION_PATCH 6 #ifndef __has_feature #define __has_feature(x) 0 From 5566caa124a74c21104faef6e445376c5c113d53 Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Thu, 14 Dec 2023 10:26:58 +0100 Subject: [PATCH 12/18] Upgraded to cmake 3.5 to avoid warnings --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6111412..2429881 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ # The full license is in the file LICENSE, distributed with this software. # ############################################################################ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(xtl) set(XTL_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include) From 212c2b797ec8a6f07352479461f0a37b042949ab Mon Sep 17 00:00:00 2001 From: anutosh491 Date: Fri, 22 Dec 2023 11:10:40 +0530 Subject: [PATCH 13/18] Use GetModuleFileNameW for wchar_t array --- include/xtl/xsystem.hpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/include/xtl/xsystem.hpp b/include/xtl/xsystem.hpp index 14cdf3b..3c75b5e 100644 --- a/include/xtl/xsystem.hpp +++ b/include/xtl/xsystem.hpp @@ -49,7 +49,11 @@ namespace xtl inline std::string executable_path() { std::string path; - char buffer[1024]; +#if defined(UNICODE) + wchar_t buffer[1024]; +#else + char buffer[1024]; +#endif std::memset(buffer, '\0', sizeof(buffer)); #if defined(__linux__) if (readlink("/proc/self/exe", buffer, sizeof(buffer)) != -1) @@ -61,14 +65,21 @@ namespace xtl // failed to determine run path } #elif defined (_WIN32) - if (GetModuleFileName(nullptr, buffer, sizeof(buffer)) != 0) + #if defined(UNICODE) + if (GetModuleFileNameW(nullptr, buffer, sizeof(buffer)) != 0) { - path = buffer; + // Convert wchar_t to std::string + std::wstring wideString(buffer); + std::string narrowString(wideString.begin(), wideString.end()); + path = narrowString; } - else + #else + if (GetModuleFileNameA(nullptr, buffer, sizeof(buffer)) != 0) { - // failed to determine run path + path = buffer; } + #endif + // failed to determine run path #elif defined (__APPLE__) std::uint32_t size = sizeof(buffer); if(_NSGetExecutablePath(buffer, &size) == 0) From a7c1c5444dfc57f76620391af4c94785ff82c8d6 Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Fri, 22 Dec 2023 12:43:23 +0100 Subject: [PATCH 14/18] Release 0.7.7 --- docs/source/changelog.rst | 5 +++++ include/xtl/xtl_config.hpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index 9611849..0b9fe6c 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -7,6 +7,11 @@ Changelog ========= +0.7.7 +----- + +- Use GetModuleFileNameW for wchar_t array + 0.7.6 ----- diff --git a/include/xtl/xtl_config.hpp b/include/xtl/xtl_config.hpp index 4106c32..2f58d2f 100644 --- a/include/xtl/xtl_config.hpp +++ b/include/xtl/xtl_config.hpp @@ -12,7 +12,7 @@ #define XTL_VERSION_MAJOR 0 #define XTL_VERSION_MINOR 7 -#define XTL_VERSION_PATCH 6 +#define XTL_VERSION_PATCH 7 #ifndef __has_feature #define __has_feature(x) 0 From 144a958d9ff0d11c60ba6e23aa032c1776d31f22 Mon Sep 17 00:00:00 2001 From: Laramie Leavitt Date: Tue, 9 Jan 2024 16:11:17 -0800 Subject: [PATCH 15/18] Add missing includes to xbasic_fixed_string std::make_unsigned requires type_traits std::copy_backwards requires algorithm --- include/xtl/xbasic_fixed_string.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/xtl/xbasic_fixed_string.hpp b/include/xtl/xbasic_fixed_string.hpp index 7bc482f..53b022c 100644 --- a/include/xtl/xbasic_fixed_string.hpp +++ b/include/xtl/xbasic_fixed_string.hpp @@ -18,6 +18,8 @@ #include #include #include +#include +#include #ifdef __CLING__ #include From a9a241cf18a2b6e75866058f79c5f1d6c4918d94 Mon Sep 17 00:00:00 2001 From: Laramie Leavitt Date: Tue, 9 Jan 2024 16:18:39 -0800 Subject: [PATCH 16/18] Add missing includes to xdynamic_bitset.hpp #include for std::initializer_list #include for std::allocator #include for std::copy --- include/xtl/xdynamic_bitset.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/xtl/xdynamic_bitset.hpp b/include/xtl/xdynamic_bitset.hpp index 73a7fde..9ccce79 100644 --- a/include/xtl/xdynamic_bitset.hpp +++ b/include/xtl/xdynamic_bitset.hpp @@ -13,6 +13,10 @@ #include #include #include +#include +#include +#include +#include #include "xclosure.hpp" #include "xspan.hpp" From 2ebf99f86ddcbcd4808f00176aedb9b19f62dd37 Mon Sep 17 00:00:00 2001 From: Laramie Leavitt Date: Tue, 9 Jan 2024 18:22:12 -0800 Subject: [PATCH 17/18] Preprocessor fixes for xtl_config.hpp Avoid re-#defines of XTL_NO_EXCEPTIONS Properly #include for XTL_NO_EXCEPTIONS --- include/xtl/xtl_config.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/xtl/xtl_config.hpp b/include/xtl/xtl_config.hpp index 2f58d2f..eca552f 100644 --- a/include/xtl/xtl_config.hpp +++ b/include/xtl/xtl_config.hpp @@ -22,11 +22,16 @@ #if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(XTL_NO_EXCEPTIONS) // Exceptions are enabled. #else +#if !defined(XTL_NO_EXCEPTIONS) // Exceptions are disabled. #define XTL_NO_EXCEPTIONS #endif +#endif #if defined(XTL_NO_EXCEPTIONS) + +#include + #define XTL_THROW(_, msg) \ { \ std::cerr << msg << std::endl; \ From 443eb2db78050294a7c51c448dbdc0529373234c Mon Sep 17 00:00:00 2001 From: Sylvain Corlay Date: Thu, 30 May 2024 12:30:17 +0200 Subject: [PATCH 18/18] wip-module-path --- include/xtl/xsystem.hpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/include/xtl/xsystem.hpp b/include/xtl/xsystem.hpp index 3c75b5e..0fbc64e 100644 --- a/include/xtl/xsystem.hpp +++ b/include/xtl/xsystem.hpp @@ -39,14 +39,20 @@ namespace xtl { + std::string module_path(bool executable); std::string executable_path(); - std::string prefix_path(); + std::string prefix_path(bool executable); /****************** * implementation * ******************/ inline std::string executable_path() + { + return module_path(false); + } + + inline std::string module_path(bool executable = true) { std::string path; #if defined(UNICODE) @@ -65,8 +71,13 @@ namespace xtl // failed to determine run path } #elif defined (_WIN32) + HMODULE handle = nullptr; + if (!executable) + { + GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, reinterpret_cast(module_path), &handle); + } #if defined(UNICODE) - if (GetModuleFileNameW(nullptr, buffer, sizeof(buffer)) != 0) + if (GetModuleFileNameW(handle, buffer, sizeof(buffer)) != 0) { // Convert wchar_t to std::string std::wstring wideString(buffer); @@ -74,7 +85,7 @@ namespace xtl path = narrowString; } #else - if (GetModuleFileNameA(nullptr, buffer, sizeof(buffer)) != 0) + if (GetModuleFileNameA(handle, buffer, sizeof(buffer)) != 0) { path = buffer; } @@ -107,9 +118,9 @@ namespace xtl return path; } - inline std::string prefix_path() + inline std::string prefix_path(bool executable = true) { - std::string path = executable_path(); + std::string path = module_path(executable); #if defined (_WIN32) char separator = '\\'; #else