Reputation: 1
I am working on a 3d engine and I want to add glad repo as a submodule to my project. Cmake is my primary generator but always run into some Python problems while building Glad lib. So I started a separate project test how to build glad using cmake but ran into the same error, My cmake file and its output goes like this,
In CMakeLists.txt
cmake_minimum_required(VERSION 3.25)
project(glad_build VERSION 1.0.0 LANGUAGES C CXX)
include(FetchContent)
FetchContent_Declare(
glad
GIT_REPOSITORY https://github.com/Dav1dde/glad.git
GIT_TAG v2.0.4
GIT_SHALLOW true
)
FetchContent_MakeAvailable(glad)
set(GL_VERSION "4.3")
set(GLAD_LIB "glad_gl_core_43")
glad_add_library(${GLAD_LIB} REPRODUCIBLE API gl:core=${GL_VERSION})
add_executable(${PROJECT_NAME} "Src/Main.cpp")
target_link_libraries(${PROJECT_NAME} PUBLIC glad)
Build Ouput
[main] Building folder: glad
[build] Starting build
[proc] Executing command: chcp
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build "c:/Users/****/Desktop/GitHub/glad/build" --config Debug --target all -j 6 --
[build] [ 20%] glad_gl_core_43-generate
[build] Cleaning "C:/Users/****/Desktop/GitHub/glad/build/gladsources/glad_gl_core_43"
[build] [ 40%] Linking CXX executable glad_build.exe
[build] Generating with args --out-path "C:/Users/***/Desktop/GitHub/glad/build/gladsources/glad_gl_core_43" --api gl:core=4.3 --reproducible c
[build] C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lglad: No such file or directory
[build] Traceback (most recent call last):
[build] File "<frozen runpy>", line 198, in _run_module_as_main
[build] File "<frozen runpy>", line 88, in _run_code
[build] File "C:\Users\****\Desktop\GitHub\glad\glad\glad\__main__.py", line 18, in <module>
[build] from glad.generator import GenerationInfo
[build] File "C:\Users\****\Desktop\GitHub\glad\glad\glad\generator\__init__.py", line 7, in <module>
[build] from jinja2 import Environment, ChoiceLoader, PackageLoader
[build] ModuleNotFoundError: No module named 'jinja2'
[build] mingw32-make[2]: *** [CMakeFiles\glad_gl_core_43.dir\build.make:77: gladsources/glad_gl_core_43/include/KHR/khrplatform.h] Error 1
[build] mingw32-make[1]: *** [CMakeFiles\Makefile2:100: CMakeFiles/glad_gl_core_43.dir/all] Error 2
[build] mingw32-make[1]: *** Waiting for unfinished jobs....
[build] collect2.exe: error: ld returned 1 exit status
[build] mingw32-make[2]: *** [CMakeFiles\glad_build.dir\build.make:98: glad_build.exe] Error 1
[build] mingw32-make[1]: *** [CMakeFiles\Makefile2:127: CMakeFiles/glad_build.dir/all] Error 2
[build] mingw32-make: *** [Makefile:90: all] Error 2
[proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" --build "c:/Users/****/Desktop/GitHub/glad/build" --config Debug --target all -j 6 -- exited with code: 2
[driver] Build completed: 00:00:03.870
[build] Build finished with exit code 2
I checked the module that I have installed, Here is the list... glad, jinja2 installed
Package Version
------------------ ----------
blinker 1.7.0
certifi 2023.11.17
cffi 1.16.0
charset-normalizer 3.3.2
click 8.1.7
colorama 0.4.6
dnspython 2.5.0
docopt 0.6.2
eventlet 0.34.3
Flask 3.0.1
Flask-Silk 0.2
future 0.18.3
gevent 23.9.1
glad 0.1.36
greenlet 3.0.3
gunicorn 21.2.0
idna 3.6
itsdangerous 2.1.2
Jinja2 3.1.3
lxml 5.1.0
MarkupSafe 2.1.4
packaging 23.2
pip 23.3.2
pipreqs 0.4.13
pycparser 2.21
requests 2.31.0
setuptools 69.0.3
types-Jinja2 2.11.9
types-MarkupSafe 1.1.10
urllib3 2.1.0
Werkzeug 3.0.1
yarg 0.1.9
To be honest I'm not a great fan of Python, I don't get code in main.py and init.py. I expect to generate glad.h and glad.c I know I can download these files but when the project build is finished I want to see those files generated along with glad.lib
Upvotes: 0
Views: 555