gpt4 book ai didi

c++ - Ninja:安装目标

转载 作者:太空宇宙 更新时间:2023-11-04 13:42:41 24 4
gpt4 key购买 nike

我已经为我正在处理的 C++ 项目编写了一个 build.ninja 文件。没什么特别的,只是一堆编译并链接到可执行文件中的 C++ 源文件(见下文)

我想添加一个安装目标,它只是将可执行文件复制到/usr/local/games 中。我该如何实现?

cflags = -DSYZYGY -Wall -Wcast-qual -fno-exceptions -fno-rtti  -ansi -pedantic -Wno-long-long $
-Wextra -Wshadow -DNDEBUG -O3 -DIS_64BIT -msse -DUSE_BSFQ -msse3 -mpopcnt -DUSE_POPCNT -flto
lflags = -lpthread $cflags

rule compile
command = c++ -MMD -MT $out -MF $out.d $cflags -c $in -o $out
description = Compiling $in
depfile = $out.d
deps = gcc

rule link
command = c++ -o $out $in $lflags && strip $out
description = Linking $out

build src/benchmark.o: compile src/benchmark.cpp
build src/bitbase.o: compile src/bitbase.cpp
build src/bitboard.o: compile src/bitboard.cpp
build src/endgame.o: compile src/endgame.cpp
build src/evaluate.o: compile src/evaluate.cpp
build src/main.o: compile src/main.cpp
build src/material.o: compile src/material.cpp
build src/misc.o: compile src/misc.cpp
build src/movegen.o: compile src/movegen.cpp
build src/movepick.o: compile src/movepick.cpp
build src/pawns.o: compile src/pawns.cpp
build src/position.o: compile src/position.cpp
build src/search.o: compile src/search.cpp
build src/thread.o: compile src/thread.cpp
build src/timeman.o: compile src/timeman.cpp
build src/tt.o: compile src/tt.cpp
build src/uci.o: compile src/uci.cpp
build src/ucioption.o: compile src/ucioption.cpp
build src/syzygy/tbprobe.o: compile src/syzygy/tbprobe.cpp

build stockfish: link src/benchmark.o src/bitbase.o src/bitboard.o src/endgame.o src/evaluate.o $
src/main.o src/material.o src/misc.o src/movegen.o src/movepick.o src/pawns.o src/position.o $
src/search.o src/thread.o src/timeman.o src/tt.o src/uci.o src/ucioption.o src/syzygy/tbprobe.o

default stockfish

最佳答案

也许这可以解决问题(未经测试):

rule copy
command = cp $in $out
build /usr/local/games/stockfish: copy stockfish
build install: phony /usr/local/games/stockfish

关于c++ - Ninja:安装目标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27203190/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com