gpt4 book ai didi

c++ - 如何编译和运行Hello World JUCE程序?

转载 作者:行者123 更新时间:2023-12-02 10:26:24 25 4
gpt4 key购买 nike

我克隆了https://github.com/juce-framework/JUCE
我首先在find_package(JUCE) CMakeList.txt中取消注释/GuiApp'
然后我跑了cmake .. . -B cmake-build-dir -D JUCE_BUILD_EXAMPLES=ON 在顶层目录上。
它说:

-- Checking for modules 'webkit2gtk-4.0;gtk+-x11-3.0'
-- No package 'webkit2gtk-4.0' found
-- No package 'gtk+-x11-3.0' found
-- Checking for module 'alsa'
-- No package 'alsa' found
-- Configuring juceaide
-- Building juceaide
-- Exporting juceaide
CMake Error at examples/CMake/GuiApp/CMakeLists.txt:27 (find_package):
Could not find a package configuration file provided by "JUCE" with any of
the following names:

JUCEConfig.cmake
juce-config.cmake

Add the installation prefix of "JUCE" to CMAKE_PREFIX_PATH or set
"JUCE_DIR" to a directory containing one of the above files. If "JUCE"
provides a separate development package or SDK, be sure it has been
installed.


-- Configuring incomplete, errors occurred!
我试图找到JUCEConfig.cmake在哪里
 /work/juce/temp/JUCE/build$ find . -name JUCEConfig.cmake
./cmake-build-dir/tools/JUCEConfig.cmake
我应该如何将此路径放入CMAKE_PREFIX_PATHS?

最佳答案

克隆此存储库:https://github.com/juce-framework/JUCEalsawebkit2gtk是必需的依赖项,在我的计算机上的Ubuntu 18.04上不存在。您也可能必须安装如下:

sudo apt install libwebkit2gtk-4.0-dev libasound2-dev
此存储库中的 examples/CMake文件夹中有一个名为 GuiApp的文件夹。
要使用JUCE/CMake构建新的GUI App项目,请执行以下操作(从头开始):
  • GuiApp文件夹复制到新位置。
  • 在您复制的GuiApp的CMakeLists.txt中,替换
    add_subdirectory(JUCE)

  • add_subdirectory("<path_to_JUCE_cloned_repository>" JUCE) 
    将路径替换为系统中JUCE存储库的实际位置。
  • 从您复制的GuiApp文件夹中运行
    cmake。 -B cmake-build-dir

  • 上面的命令将创建一个名为 cmake-build-dir的构建树文件夹
  • cmake --build cmake-build-dir

  • 上面的命令将在cmake-build-dir文件夹中构建所有目标。
  • 成功构建后,可以通过进入目录来运行可执行文件:
    cmake-build-dir/GuiAppExample_artefacts/

  • 并发布 ./Gui\ App\ Example。那就是生成的默认可执行文件的名称。
    信用: https://forum.juce.com/u/reuk/summary

    关于c++ - 如何编译和运行Hello World JUCE程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64317833/

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