GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — qiskit/Makefile at main · Qiskit/qiskit Expand file tree/ Copy pathMakefileMore file actions 194 lines (162 loc) · 6.64 KB / Copy pathMakefileFile metadata and controls194 lines (162 loc) · 6.64 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 # This code is part of Qiskit. # # (C) Copyright IBM 2017. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at https://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative works of this code must retain this # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. ifneq ($(OS), Windows_NT) OS := $(shell uname -s) endif ifeq ($(QISKIT_BUILD_WITH_MIMALLOC), 1) MIMALLOC := --features=global_mimalloc endif .PHONY: default lint style black test test_randomized pytest pytest_randomized test_ci coverage coverage_erase clean default: style lint test ; lint: ruff check qiskit test tools build_backend tools/verify_headers.py qiskit test tools build_backend tools/find_optional_imports.py tools/find_stray_release_notes.py tools/verify_images.py cargo fmt --check cargo clippy --all-targets --all-features -- -D warnings style: black --check qiskit test tools build_backend docs/conf.py black: black qiskit test tools build_backend docs/conf.py .PHONY: miri miri: tools/miri.bash # Use the -s (starting directory) flag for "unittest discover" is necessary, # otherwise the QuantumCircuit header will be modified during the discovery. test: @echo ================================================ @echo Consider using tox as suggested in the CONTRIBUTING.MD guideline. For running the tests as the CI, use test_ci @echo ================================================ python3 -m unittest discover -s test/python -t . -v @echo ================================================ @echo Consider using tox as suggested in the CONTRIBUTING.MD guideline. For running the tests as the CI, use test_ci @echo ================================================ # Use pytest to run tests pytest: pytest test/python # Use pytest to run randomized tests pytest_randomized: pytest test/randomized test_ci: QISKIT_TEST_CAPTURE_STREAMS=1 stestr run test_randomized: python3 -m unittest discover -s test/randomized -t . -v coverage: coverage run --source qiskit -m unittest discover -s test/python -q coverage report coverage_erase: coverage erase clean: coverage_erase ; # ============================================================================== # Variables that can be set/modified to modify the C builds. # ============================================================================== # Output directories. C_DIR_OUT=dist/c C_DIR_OUT_LIB=$(C_DIR_OUT)/lib C_DIR_OUT_INCLUDE=$(C_DIR_OUT)/include C_DIR_TEST=test/c C_DIR_TEST_BUILD=test/c/build # Input directories C_DIR_CARGO_TARGET=target C_DIR_CRATES=crates # ============================================================================== # Variables that we derive from the settings above. # ============================================================================== ifeq ($(OS), Windows_NT) C_LIB_CARGO_FILENAME=qiskit_cext.dll else ifeq ($(shell uname), Darwin) C_LIB_CARGO_FILENAME=libqiskit_cext.dylib else # ... probably. C_LIB_CARGO_FILENAME=libqiskit_cext.so endif C_LIBQISKIT_OUT=$(C_DIR_OUT_LIB)/$(subst _cext,,$(C_LIB_CARGO_FILENAME)) # ============================================================================== # Recipes for the C components. # ============================================================================== .PHONY: cformat fix_cformat ctidy # Run clang-format (does not apply any changes) cformat: bash tools/run_clang_format.sh # Apply clang-format changes fix_cformat: bash tools/run_clang_format.sh apply # Run clang tidy, which currently only checks for `printf` occurences # This currently only checks for files in test/c/*.c. We could turn this into # a bash script, like for clang-format, which globs for .c files, but we only really care to # run this print check on the test files at the moment. ctidy: cheader clang-tidy $(C_DIR_TEST)/*.c -- -std=c11 -I$(C_DIR_OUT_INCLUDE) # Abstraction over calling Cargo to build the C extension in "standalone" C # mode. This _also_ builds the C header file as a side-effect into # `target/qiskit.h`. Recipes that use this as a prerequisite should ensure they # set `C_LIB_CARGO_FLAGS` to choose the build profile. The `C_LIB_RUSTC_FLAGS` # variable can also be set to add additional logic (like coverage instructions). # # Typically, downstream recipes should depend on `build-clib-release` or `build-clib-dev` # instead. .PHONY: build-clib build-clib-release build-clib-dev build-clib: cargo rustc -p qiskit-cext ${MIMALLOC} --crate-type cdylib ${C_LIB_CARGO_FLAGS} -- ${C_LIB_RUSTC_FLAGS} build-clib-release: C_LIB_CARGO_FLAGS=--release build-clib-release: build-clib build-clib-dev: C_LIB_CARGO_FLAGS=--profile dev build-clib-dev: build-clib # Catch-all directory-creation rule. $(C_DIR_OUT_LIB): mkdir -p $@ .PHONY: cheader cheader: cargo run -p qiskit-bindgen-cli -- install -c $(C_DIR_CRATES)/cext -o $(C_DIR_OUT_INCLUDE) # `clib` and `clib-dev` are conflicting rules - they both attempt to "install" the # shared library into the output `lib` directory, but they differ between release # and dev mode. .PHONY: clib clib: build-clib-release | $(C_DIR_OUT_LIB) cp $(C_DIR_CARGO_TARGET)/release/$(C_LIB_CARGO_FILENAME) $(C_LIBQISKIT_OUT) .PHONY: clib-dev: build-clib-dev | $(C_DIR_OUT_LIB) cp $(C_DIR_CARGO_TARGET)/debug/$(C_LIB_CARGO_FILENAME) $(C_LIBQISKIT_OUT) .PHONY: c c: cheader clib .PHONY: ctest # Use ctest to run C API tests. ctest: cheader build-clib-dev # `-S` specifies the source (including the `CMakeLists.txt` file, `-B` is where # to put the build files, including the generated CMake stuff. See the # `CMakeLists.txt` file for the build variables. # # The `CMAKE_FLAGS` argument is to allow user insertion of additional flags, such # as to override the `CMAKE_C_STANDARD` line. cmake -S$(C_DIR_TEST) -B$(C_DIR_TEST_BUILD) \ $(CMAKE_FLAGS) \ -DCARGO_LIB_DIR=$(abspath $(C_DIR_CARGO_TARGET))/debug \ -DQISKIT_INCLUDE_PATH=$(abspath $(C_DIR_OUT_INCLUDE)) # Actually build the test. cmake --build $(C_DIR_TEST_BUILD) # -V ensures we always produce a logging output to indicate the subtests # -C Debug is needed for windows to work, if you don't specify Debug (or # Release) explicitly ctest doesn't run on windows ctest -V -C Debug --test-dir $(C_DIR_TEST_BUILD) .PHONY: ccoverage ccoverage: C_LIB_RUSTC_FLAGS=-Cinstrument-coverage ccoverage: ctest .PHONY: qiskit-pyo3-ffi qiskit-pyo3-ffi: rm -rf dist/rust/qiskit-pyo3-ffi cargo run -p qiskit-bindgen-cli -- generate-pyo3 --cext-path crates/cext --output-path dist/rust/qiskit-pyo3-ffi .PHONY: cclean cclean: rm -rf $(C_DIR_OUT) $(C_DIR_TEST_BUILD) $(C_INCLUDE_FILES_ABS_GENERATED) cargo clean --package qiskit-cext |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |