Git Product home page Git Product logo

Comments (5)

podgorskiy avatar podgorskiy commented on August 21, 2024 1

@salesvictor , @concatime , I execute gl3w_gen.py at the beginning of the CMakelist with a command like:
execute_process(COMMAND python gl3w_gen.py --root ${PROJECT_BINARY_DIR}/libs/gl3w WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/libs/gl3w)
Example: https://github.com/podgorskiy/bimpy/blob/master/CMakeLists.txt#L41
Doing this for many years now, never had problems with it.

from gl3w.

concatime avatar concatime commented on August 21, 2024

Same issue here.

from gl3w.

bwrsandman avatar bwrsandman commented on August 21, 2024

I'm using gl3w with FetchContent. I was able to have it working out of the box by commenting one line out:
bwrsandman@1494cee

Try my branch: https://github.com/bwrsandman/gl3w/

from gl3w.

travishaynes avatar travishaynes commented on August 21, 2024

Here's a CMake script I wrote using FetchContent to include this in my project. It solves two issues I had with the one in this project: The install rules aren't optional, making it difficult, if not impossible, to exclude the sources in a CPack generated installer. I don't want to redistribute the gl3w sources with my app. And the sources are generated at build-time, when they really should be generated pre-build so an IDE can find them before it compiles the first time.

cmake_minimum_required(VERSION 3.24)

find_package(OpenGL REQUIRED)
find_package(PythonInterp REQUIRED)

include(FetchContent)
FetchContent_Declare(gl3w GIT_REPOSITORY "https://github.com/skaslev/gl3w.git" GIT_TAG "master")

message(CHECK_START "Fetching skaslev/gl3w from GitHub")
FetchContent_Populate(gl3w)
message(CHECK_PASS "Done")

message(CHECK_START "Generating gl3w sources")
execute_process(COMMAND ${PYTHON_EXECUTABLE} gl3w_gen.py WORKING_DIRECTORY ${gl3w_SOURCE_DIR} OUTPUT_QUIET)
message(CHECK_PASS "Done")

add_library(gl3w INTERFACE)

target_sources(gl3w INTERFACE
  $<BUILD_INTERFACE:${gl3w_SOURCE_DIR}/src/gl3w.c>
  $<INSTALL_INTERFACE:${CMAKE_INSTALL_DATAROOTDIR}/gl3w/src/gl3w.c>)

target_sources(gl3w INTERFACE FILE_SET HEADERS
  BASE_DIRS
  ${gl3w_source_dir}/include

  FILES
  ${gl3w_headers})

target_include_directories(gl3w INTERFACE
  $<BUILD_INTERFACE:${gl3w_SOURCE_DIR}/include>
  $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/gl3w>)

target_link_libraries(gl3w INTERFACE OpenGL::GL ${CMAKE_DL_LIBS})

from gl3w.

bwrsandman avatar bwrsandman commented on August 21, 2024

Thanks for the script. It works but is not ideal.

from gl3w.

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.