繁体   English   中英

如何编译和运行一个hello world JUCE程序?

[英]How to compile and run a hello world JUCE program?

我克隆了https://github.com/juce-framework/JUCE

我首先在/GuiApp' CMakeList.txt 中取消注释find_package(JUCE) 然后我跑了cmake .. . -B cmake-build-dir -D JUCE_BUILD_EXAMPLES=ON 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/JUCE

alsawebkit2gtk是必需的依赖项,在我的计算机中的 Ubuntu 18.04 上不存在这些依赖项。 您也可能必须按如下方式安装:

sudo apt install libwebkit2gtk-4.0-dev libasound2-dev

在此存储库的examples/CMake文件夹中有一个名为GuiApp的文件夹。

要使用 JUCE/CMake 构建新的 GUI 应用程序项目,请执行以下操作(从头开始):

  1. GuiApp文件夹复制到新位置。

  2. 在您复制的GuiApp的 CMakeLists.txt 中,替换

    添加子目录(JUCE)

add_subdirectory("<path_to_JUCE_cloned_repository>" JUCE) 

用系统上 JUCE 存储库的真实位置替换路径。

  1. 从您复制的GuiApp文件夹中,运行

    制作。 -B cmake-build-dir

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

  1. cmake --build cmake-build-dir

上面的命令将在 cmake-build-dir 文件夹中构建所有目标。

  1. 成功构建后,您可以通过进入目录来运行可执行文件:

    cmake-build-dir/GuiAppExample_artefacts/

并发出./Gui\\ App\\ Example 这是生成的默认可执行文件的名称。

信用: https : //forum.juce.com/u/reuk/summary

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM