Closed BigBIueWhale closed 5 months ago
I've realized that the simplest way is just to disable freetype in imgui, set HELLOIMGUI_USE_FREETYPE to OFF
.
cmake_minimum_required(VERSION 3.12)
project(generic_gui_tester)
set(CMAKE_CXX_STANDARD 17)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build everything as dlls" FORCE)
add_subdirectory(libs/glfw-3.3.9)
set(HELLOIMGUI_USE_GLFW_OPENGL3 ON CACHE BOOL "Use GLFW and OpenGL3 for HelloImGui" FORCE)
set(HELLOIMGUI_USE_FREETYPE OFF CACHE BOOL "Use freetype for imoji support in HelloImGui" FORCE)
add_subdirectory(libs/hello_imgui)
include_directories(libs/hello_imgui)
add_subdirectory(src)
Hello,
With this commit, you can use freetype and lunasvg as CMake target (i.e. call add_subdirectory for them).
So as a conclusion:
What's a simple way to get my project working on Windows platform without relying on an internet connection during build time?
Solution 1: Set HELLOIMGUI_USE_FREETYPE=OFF as you found
Solution 2: Add freetype and lunasvg as submodules and call add_subdirectory on them
Solution 3: Add freetype via a package manager (like vcpkg), and luna_svg as a submodule
However it seems that as least on the Windows platform, CMake depends on ZLIB, BZIP2, PNG, HARFBUZZ, BROTLIDEC.
Those are just warning from Freetype CMake scripts, it still builds fine
However it seems that as least on the Windows platform, CMake depends on ZLIB, BZIP2, PNG, HARFBUZZ, BROTLIDEC.
Those are just warning from Freetype CMake scripts, it still builds fine
Thank you for the fix, I tested it and everything now works!
I confirm that I'm now able to successfully provide freetype and luna_svg in an offline manner to hello_imgui library, as of commit:
34742c5cb56b0a4e8f195ff47e46812ad4d101a7
.
Here is my now working code:
cmake_minimum_required(VERSION 3.12)
project(generic_gui_tester)
set(CMAKE_CXX_STANDARD 17)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build everything as dlls" FORCE)
add_subdirectory(libs/glfw-3.3.9)
add_subdirectory(libs/freetype-VER-2-13-2)
add_subdirectory(libs/lunasvg-2.3.9)
set(HELLOIMGUI_USE_GLFW_OPENGL3 ON CACHE BOOL "Use GLFW and OpenGL3 for HelloImGui" FORCE)
set(HELLOIMGUI_USE_FREETYPE ON CACHE BOOL "Use freetype for imoji support in HelloImGui" FORCE)
add_subdirectory(libs/hello_imgui)
include_directories(libs/hello_imgui)
add_subdirectory(src)
This is my build system on which things are working for me offline:
pip install pillow
which hello_imgui uses for icon conversion.CMake: [Debug]
and change to Release
.Here are the contents of my libs
folder:
And the extract_libs.bat file:
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
:: Get the directory where the batch file is located
SET "BATCH_DIR=%~dp0"
SET "LIBS_DIR=!BATCH_DIR!libs\"
:: Path to 7zip executable
SET "SEVEN_ZIP_PATH=C:\Program Files\7-Zip\7z.exe"
:: Check if 7zip is installed
IF NOT EXIST "!SEVEN_ZIP_PATH!" (
echo 7-Zip not found at "!SEVEN_ZIP_PATH!"
exit /b 1
)
echo freetype-VER-2-13-2.tar.gz...
"!SEVEN_ZIP_PATH!" x "!LIBS_DIR!freetype-VER-2-13-2.tar.gz" -o"!LIBS_DIR!"
"!SEVEN_ZIP_PATH!" x "!LIBS_DIR!freetype-VER-2-13-2.tar" -o"!LIBS_DIR!"
DEL "!LIBS_DIR!freetype-VER-2-13-2.tar"
echo Extracting glfw-3.3.9.tar.gz...
"!SEVEN_ZIP_PATH!" x "!LIBS_DIR!glfw-3.3.9.tar.gz" -o"!LIBS_DIR!"
"!SEVEN_ZIP_PATH!" x "!LIBS_DIR!glfw-3.3.9.tar" -o"!LIBS_DIR!"
DEL "!LIBS_DIR!glfw-3.3.9.tar"
echo Extracting hello_imgui-1.0.0.7z...
"!SEVEN_ZIP_PATH!" x "!LIBS_DIR!hello_imgui.7z" -o"!LIBS_DIR!"
echo Extracting lunasvg-2.3.9.tar.gz...
"!SEVEN_ZIP_PATH!" x "!LIBS_DIR!lunasvg-2.3.9.tar.gz" -o"!LIBS_DIR!"
"!SEVEN_ZIP_PATH!" x "!LIBS_DIR!lunasvg-2.3.9.tar" -o"!LIBS_DIR!"
DEL "!LIBS_DIR!lunasvg-2.3.9.tar"
echo Extraction complete.
ENDLOCAL
By convention I always put the source code of my dependencies in a sub-directory of my project.
I then use
add_subdirectory(libs/hello_imgui)
for each library that I use.For example, this is the configuration I used for my hello_imgui project:
That basic configuration was enough to get everything to build and run without an internet connection when using hello_imgui version 1.0.0
The latest master versions of hello_imgui seem to require
freetype
andlunasvg
and it wants to download those from the internet.I tried to take the source code from Freetype GitLab version 2.13.2 and add that source code as a subdirectory.
However it seems that as least on the Windows platform, CMake depends on ZLIB, BZIP2, PNG, HARFBUZZ, BROTLIDEC.
What's a simple way to get my project working on Windows platform without relying on an internet connection during build time?