GithubHelp home page GithubHelp logo

Comments (4)

BigBIueWhale avatar BigBIueWhale commented on June 7, 2024

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)

from hello_imgui.

pthom avatar pthom commented on June 7, 2024

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

from hello_imgui.

pthom avatar pthom commented on June 7, 2024

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

from hello_imgui.

BigBIueWhale avatar BigBIueWhale commented on June 7, 2024

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:

  1. Compile on Windows 10 22H2
  2. Install Visual Studio 2022 C++ build tools or Visual Studio 22 community
  3. Install CMake- either through Visual Studio 2022 installer or the standalone version 3.26.4 for Windows
  4. Install VS Code and add extensions "C/C++ Extension Pack" by Microsoft, "CMake" by twxs
  5. Install Python 3.11.3 globally on the Windows OS and make sure to check "add to path" so that it's globally available, then do pip install pillow which hello_imgui uses for icon conversion.
  6. Re-open the project with VS Code
  7. Run VS Code command: "CMake: Delete Cache and Reconfigure" and choose "Visual Studio Community 2022 Release- amd64" as the compiler.
  8. At the bottom of the VS Code window (the CMake tab) choose CMake: [Debug] and change to Release.

Here are the contents of my libs folder:

  • freetype-VER-2-13-2
  • glfw-3.3.9
  • hello_imgui
  • lunasvg-2.3.9
  • .gitignore
  • freetype-VER-2-13-2.tar.gz
  • glfw-3.3.9.tar.gz
  • hello_imgui.7z
  • lunasvg-2.3.9.tar.gz

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

from hello_imgui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.