From e16353a057a0e69814bee233000fe791c8c39f2d Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Mon, 1 Mar 2021 13:36:09 -0500 Subject: [PATCH 1/3] Testing installation. --- .github/workflows/ubuntu20.yml | 27 +++++++------------ .github/workflows/vs16-ci.yml | 11 ++++++-- tests/installation_tests/find/CMakeLists.txt | 28 ++++++++++++++++++++ 3 files changed, 47 insertions(+), 19 deletions(-) create mode 100644 tests/installation_tests/find/CMakeLists.txt diff --git a/.github/workflows/ubuntu20.yml b/.github/workflows/ubuntu20.yml index 8fca2d9..090fe9c 100644 --- a/.github/workflows/ubuntu20.yml +++ b/.github/workflows/ubuntu20.yml @@ -15,20 +15,13 @@ jobs: #- {cxx: , arch: -DCMAKE_CXX_FLAGS="-m32"} # default=gcc9 steps: - uses: actions/checkout@v2 - - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.4 - with: - cmake-version: '3.11.x' - #- name: install older compilers - # run: | - # sudo -E dpkg --add-architecture i386 - # sudo -E apt-get update - # sudo -E apt-get install -y g++-8 g++-8-multilib g++-multilib linux-libc-dev:i386 libc6:i386 libc6-dev:i386 libc6-dbg:i386 - - name: Prepare build dir - run: mkdir build - - name: Configure - run: cd build && cmake ${{matrix.cxx}} ${{matrix.arch}} -DFASTFLOAT_TEST=ON .. - - name: Build - run: cmake --build build - - name: Run basic tests - run: cd build && ctest --output-on-failure -R basictest + - name: Use cmake + run: | + mkdir build && + cd build && + cmake ${{matrix.cxx}} ${{matrix.arch}} -DFASTFLOAT_TEST=ON -DCMAKE_INSTALL_PREFIX:PATH=destination .. && + cmake --build . && + ctest --output-on-failure && + cmake --install . && + cd ../tests/installation_tests/find && + mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=../../../build/destination .. && cmake --build . \ No newline at end of file diff --git a/.github/workflows/vs16-ci.yml b/.github/workflows/vs16-ci.yml index eb4330b..7d79ede 100644 --- a/.github/workflows/vs16-ci.yml +++ b/.github/workflows/vs16-ci.yml @@ -21,7 +21,14 @@ jobs: cd build && cmake -G "${{matrix.gen}}" -A ${{matrix.arch}} -DFASTFLOAT_TEST=ON .. - name: Build run: cmake --build build --config Release --parallel - - name: Run basic tests + - name: Run tests run: | cd build - ctest -C Release --output-on-failure -R basictest + ctest -C Release --output-on-failure + - name: Install + run: | + cmake --install build --config Release + - name: Test Installation + run: | + cmake -G "${{matrix.gen}}" -A ${{matrix.arch}} -B build_install_test tests/installation_tests/find + cmake --build build_install_test --config Release diff --git a/tests/installation_tests/find/CMakeLists.txt b/tests/installation_tests/find/CMakeLists.txt new file mode 100644 index 0000000..0868955 --- /dev/null +++ b/tests/installation_tests/find/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_simdjson_install VERSION 0.1.0 LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +find_package(fast_float REQUIRED) + + + +file(WRITE main.cpp " +#include \"fast_float/fast_float.h\" +#include + +int main() { + const std::string input = \"3.1416 xyz \"; + double result; + auto answer = fast_float::from_chars(input.data(), input.data()+input.size(), result); + if(answer.ec != std::errc()) { std::cerr << \"parsing failure\n\"; return EXIT_FAILURE; } + std::cout << \"parsed the number \" << result << std::endl; + return EXIT_SUCCESS; +}") + + + +add_executable(repro main.cpp) +target_link_libraries(repro PUBLIC fast_float::fast_float) \ No newline at end of file From 61f09fb0be3233606684c86885e7c270095b9685 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Mon, 1 Mar 2021 13:49:52 -0500 Subject: [PATCH 2/3] Fixing syntax. --- tests/installation_tests/find/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/installation_tests/find/CMakeLists.txt b/tests/installation_tests/find/CMakeLists.txt index 0868955..2acc7a7 100644 --- a/tests/installation_tests/find/CMakeLists.txt +++ b/tests/installation_tests/find/CMakeLists.txt @@ -5,7 +5,7 @@ project(test_simdjson_install VERSION 0.1.0 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) -find_package(fast_float REQUIRED) +find_package(FastFloat REQUIRED) @@ -17,7 +17,7 @@ int main() { const std::string input = \"3.1416 xyz \"; double result; auto answer = fast_float::from_chars(input.data(), input.data()+input.size(), result); - if(answer.ec != std::errc()) { std::cerr << \"parsing failure\n\"; return EXIT_FAILURE; } + if(answer.ec != std::errc()) { std::cerr << \"parsing failure\\n\"; return EXIT_FAILURE; } std::cout << \"parsed the number \" << result << std::endl; return EXIT_SUCCESS; }") @@ -25,4 +25,4 @@ int main() { add_executable(repro main.cpp) -target_link_libraries(repro PUBLIC fast_float::fast_float) \ No newline at end of file +target_link_libraries(repro PUBLIC FastFloat::fast_float) \ No newline at end of file From cf344a4c2864bba511e089e910043ccc6f9fcc63 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Mon, 1 Mar 2021 13:56:26 -0500 Subject: [PATCH 3/3] Trying another script. --- .github/workflows/vs16-ci.yml | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/.github/workflows/vs16-ci.yml b/.github/workflows/vs16-ci.yml index 7d79ede..f3d7cd8 100644 --- a/.github/workflows/vs16-ci.yml +++ b/.github/workflows/vs16-ci.yml @@ -15,20 +15,13 @@ jobs: steps: - name: checkout uses: actions/checkout@v2 - - name: Configure + - name: Use cmake run: | - mkdir build - cd build && cmake -G "${{matrix.gen}}" -A ${{matrix.arch}} -DFASTFLOAT_TEST=ON .. - - name: Build - run: cmake --build build --config Release --parallel - - name: Run tests - run: | - cd build - ctest -C Release --output-on-failure - - name: Install - run: | - cmake --install build --config Release - - name: Test Installation - run: | - cmake -G "${{matrix.gen}}" -A ${{matrix.arch}} -B build_install_test tests/installation_tests/find - cmake --build build_install_test --config Release + mkdir build && + cd build && + cmake ${{matrix.cxx}} ${{matrix.arch}} -DFASTFLOAT_TEST=ON -DCMAKE_INSTALL_PREFIX:PATH=destination .. && + cmake --build . && + ctest --output-on-failure && + cmake --install . && + cd ../tests/installation_tests/find && + mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=../../../build/destination .. && cmake --build . \ No newline at end of file