quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

CMakeLists.txt (4510B)


      1 #***************************************************************************
      2 #                                  _   _ ____  _
      3 #  Project                     ___| | | |  _ \| |
      4 #                             / __| | | | |_) | |
      5 #                            | (__| |_| |  _ <| |___
      6 #                             \___|\___/|_| \_\_____|
      7 #
      8 # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      9 #
     10 # This software is licensed as described in the file COPYING, which
     11 # you should have received as part of this distribution. The terms
     12 # are also available at https://curl.se/docs/copyright.html.
     13 #
     14 # You may opt to use, copy, modify, merge, publish, distribute and/or sell
     15 # copies of the Software, and permit persons to whom the Software is
     16 # furnished to do so, under the terms of the COPYING file.
     17 #
     18 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
     19 # KIND, either express or implied.
     20 #
     21 # SPDX-License-Identifier: curl
     22 #
     23 ###########################################################################
     24 find_program(TEST_NGHTTPX "nghttpx")
     25 if(NOT TEST_NGHTTPX)
     26   set(TEST_NGHTTPX "")
     27 endif()
     28 mark_as_advanced(TEST_NGHTTPX)
     29 # Consumed variables: TEST_NGHTTPX
     30 configure_file("config.in" "${CMAKE_CURRENT_BINARY_DIR}/config" @ONLY)
     31 
     32 add_custom_target(testdeps)
     33 if(BUILD_CURL_EXE)
     34   add_dependencies(testdeps curlinfo)
     35 endif()
     36 
     37 if(CURL_CLANG_TIDY)
     38   add_custom_target(tests-clang-tidy)
     39   add_dependencies(testdeps tests-clang-tidy)
     40 endif()
     41 
     42 add_subdirectory(http)
     43 add_subdirectory(client)
     44 add_subdirectory(server)
     45 add_subdirectory(libtest)
     46 add_subdirectory(tunit)
     47 add_subdirectory(unit)
     48 add_subdirectory(certs)
     49 
     50 # Add a runtests target with customized flags
     51 function(curl_add_runtests _targetname _test_flags)
     52   if(NOT BUILD_LIBCURL_DOCS)
     53     string(APPEND _test_flags " !documentation")
     54   endif()
     55   set(_depends "")
     56   # Skip walking through dependent targets before running tests in CI.
     57   # This avoids: GNU Make doing a slow re-evaluation of all targets and
     58   # skipping them, MSBuild doing a re-evaluation, and actually rebuilding them.
     59   if(NOT _targetname STREQUAL "test-ci")
     60     set(_depends "testdeps")
     61   endif()
     62   # Use a special '$TFLAGS' placeholder as last argument which will be
     63   # replaced by the contents of the environment variable in runtests.pl.
     64   # This is a workaround for CMake's limitation where commands executed by
     65   # 'make' or 'ninja' cannot portably reference environment variables.
     66   string(REPLACE " " ";" _test_flags_list "${_test_flags}")
     67   add_custom_target(${_targetname}
     68     COMMAND
     69       "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/runtests.pl"
     70       ${_test_flags_list}
     71       "\$TFLAGS"
     72     DEPENDS "${_depends}"
     73     VERBATIM USES_TERMINAL
     74   )
     75 endfunction()
     76 
     77 # Add a pytests target with customized flags
     78 function(curl_add_pytests _targetname _test_flags)
     79   set(_depends "")
     80   if(NOT _targetname STREQUAL "pytest-ci")
     81     set(_depends "clients")
     82   endif()
     83   string(REPLACE " " ";" _test_flags_list "${_test_flags}")
     84   add_custom_target(${_targetname}
     85     COMMAND pytest ${_test_flags_list} "${CMAKE_CURRENT_SOURCE_DIR}/http"
     86     DEPENDS "${_depends}"
     87     VERBATIM USES_TERMINAL
     88   )
     89 endfunction()
     90 
     91 # Create configurehelp.pm, used by tests needing to run the C preprocessor.
     92 if(MSVC OR CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
     93   set(CURL_CPP "\"${CMAKE_C_COMPILER}\" -E")
     94   if(APPLE AND CMAKE_OSX_SYSROOT)
     95     string(APPEND CURL_CPP " -isysroot ${CMAKE_OSX_SYSROOT}")
     96   endif()
     97   # Add header directories, like autotools builds do.
     98   get_property(_include_dirs TARGET ${LIB_SELECTED} PROPERTY INCLUDE_DIRECTORIES)
     99   foreach(_include_dir IN LISTS _include_dirs)
    100     string(APPEND CURL_CPP " -I${_include_dir}")
    101   endforeach()
    102 else()
    103   set(CURL_CPP "cpp")
    104 endif()
    105 # Generate version script for the linker, for versioned symbols.
    106 # Consumed variable:
    107 #   CURL_CPP
    108 configure_file(
    109   "${CMAKE_CURRENT_SOURCE_DIR}/configurehelp.pm.in"
    110   "${CMAKE_CURRENT_BINARY_DIR}/configurehelp.pm" @ONLY)
    111 
    112 curl_add_runtests(test-quiet     "-a -s")
    113 curl_add_runtests(test-am        "-a -am")
    114 curl_add_runtests(test-full      "-a -p -r")
    115 # ~flaky means that it ignores results of tests using the flaky keyword
    116 curl_add_runtests(test-nonflaky  "-a -p ~flaky ~timing-dependent")
    117 curl_add_runtests(test-ci        "-a -p ~flaky ~timing-dependent -r --retry=5 -j20")
    118 curl_add_runtests(test-torture   "-a -t -j20")
    119 curl_add_runtests(test-event     "-a -e")
    120 
    121 curl_add_pytests(curl-pytest      "-n auto")
    122 curl_add_pytests(curl-pytest-ci   "-n auto -v")