Git Product home page Git Product logo

Comments (12)

MarkCallow avatar MarkCallow commented on June 19, 2024

Are you using a distribution of gyp that is included with Debian? After I run sudo ./setup.py install in my clone of GYP on Ubuntu, gyp is installed in /usr/local/lib/python2.7/dist-packages.

The cmake generator has been included in GYP for the entire 2+ years I have been using it so I don't know why it should be missing from the Debian distribution, if that is what you are using. Check your /usr/lib/python2.7/dist-packages/gyp/generator for cmake.{py,pyc}.

I suggest you clone the GYP source and install it yourself. You can find my fork here. Checkout branch remaster. Or you can find the upstream at Google here.

I did not add a dependency on libGL because applications using the writeKTX functions, e.g. toktx, do not need it. So please only add the dependency if building a libktx shared library. You can use a target_conditions block like this inside the libktx target.

'target_conditions': [
  ['_type == "shared_library"', {
     'includes': [ '../gyp_include/libgl.gypi' ],
     'dependencies':  [ 'libgl' ],
  }],
]

from ktx-software.

rjktcby avatar rjktcby commented on June 19, 2024

Actually i've already solved the issue with cmake gyp generator. Yes, it is not present in debian gyp package and i've built gyp from source so now i have it. Can't make your target_conditions work, getting errors.

Here's my diff:

diff --git a/lib/libktx.gypi b/lib/libktx.gypi
index a3bf9a3..eafabf5 100644
--- a/lib/libktx.gypi
+++ b/lib/libktx.gypi
@@ -43,7 +43,7 @@
         # Because these must be specified in two places.
         'defines': [ 'KTX_OPENGL=1' ],
       },
-      'type': 'static_library',
+      'type': '<(library)',
       'defines': [ '<@(defines)' ],
       'direct_dependent_settings': {
          'defines': [ '<@(defines)' ],
@@ -51,6 +51,12 @@
       },
       'sources': [ '<@(sources)' ],
       'include_dirs': [ '<@(include_dirs)' ],
+      'target_conditions': [
+        ['_type == "shared_library"', {
+          'includes': [ '../gyp_include/libgl.gypi' ],
+          'dependencies': ['libgl'],
+        }]
+      ],
     }, # libktx.gl target
     {
       'target_name': 'libktx.es1',

Here's gyp output

gyp -f cmake -Dlibrary=shared_library -DOS=linux --generator-output=build/cmake/linux/ -G output_dir=. --depth=. ktxtests.gyp ktxtools.gyp
Traceback (most recent call last):
  File "/usr/local/bin/gyp", line 9, in <module>
    load_entry_point('gyp==0.1', 'console_scripts', 'gyp')()
  File "/usr/local/lib/python2.7/dist-packages/gyp-0.1-py2.7.egg/gyp/__init__.py", line 545, in script_main
    return main(sys.argv[1:])
  File "/usr/local/lib/python2.7/dist-packages/gyp-0.1-py2.7.egg/gyp/__init__.py", line 538, in main
    return gyp_main(args)
  File "/usr/local/lib/python2.7/dist-packages/gyp-0.1-py2.7.egg/gyp/__init__.py", line 523, in gyp_main
    generator.GenerateOutput(flat_list, targets, data, params)
  File "/usr/local/lib/python2.7/dist-packages/gyp-0.1-py2.7.egg/gyp/generator/cmake.py", line 1241, in GenerateOutput
    pool.map(CallGenerateOutputForConfig, arglists)
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 251, in map
    return self.map_async(func, iterable, chunksize).get()
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 558, in get
    raise self._value
KeyError: 'libgl'

If i comment out the 'dependencies' line, gyp succeeds, but libGL linkage line is not generated in CMakeLists.txt.
I'm new to gyp, don't know yet how to effectively debug it, python stacktraces are not helpful at all

from ktx-software.

MarkCallow avatar MarkCallow commented on June 19, 2024

The problem is possibly a bug in GYP. The libgl target is not yet in the list of targets GYP is building at the time target_conditions is evaluated. Weird as that is supposed to be evaluated "late".

I have found that using a regular conditions works but you have to move the includes out and test library instead of _type. See the new issue-18 branch for sample code. The variable library is set in gyp_includes/config.gypi. It is shared_library for linux and OS X. You will probably need to copy the .so to the directory where the gl3loadtests executable is. There is a commented out copy block to point the way in lib/libktx.gypi.

from ktx-software.

MarkCallow avatar MarkCallow commented on June 19, 2024

I just pushed an update that makes the shared library fully functional on OS X. You should be able to add the necessary flags and copy (if needed) for Linux fairly easily with this to follow.

from ktx-software.

rjktcby avatar rjktcby commented on June 19, 2024

I was able to build all with some changes and all tests passed.
You can check out my diff in latest commit here: https://github.com/rjktcby/KTX/tree/issue-18-linux

I had to change sdl_to_use to installed_dylib for linux (and use libsdl from distro) as I didn't really get the point of these text files as libSDL.so. They don't link as they're not libraries. Is this some OSX magic?

from ktx-software.

MarkCallow avatar MarkCallow commented on June 19, 2024

Thank you for the changes. They look good with the exception of the change of sdl_to_use to installed_dylib. When you say "text files" I am not sure to what you are referring. When built_dylib is used, 2 files are copied <(PRODUCT_DIR). One is the library .so which has a full version number after the .so. The other is a symbolic link to the actual library using the name searched for by the linker. This is the standard .so naming scheme for Linux and it has been working fine for me on Ubuntu on which I have been building with both cmake and make and running the tests. It has nothing to do with OS X. What was the problem you were having?

I want to preserve built_dylib because I there are bug fixes in the built SDL included with KTX that enable me to reliably run tests using an OpenGL ES context as well as an OpenGL context. At present only gl3loadtests is being built for Linux but I am planning to at the es[13] tests.

from ktx-software.

rjktcby avatar rjktcby commented on June 19, 2024

Well i realized that i didn't install the git lfs extension, that's the problem, i'll check the builds with libs from repo and submit pull request. Should i do it against the issue-18 branch?

from ktx-software.

MarkCallow avatar MarkCallow commented on June 19, 2024

Yes it is Git LFS. I suddenly realized during the night and was about to add a comment to tell you. Please submit the pull request against the incoming branch.

from ktx-software.

rjktcby avatar rjktcby commented on June 19, 2024

Cmake build runs ok, but make build fails. It generates bad path to SDL libraries for the copy rules.
Right now i'm getting:

$(builddir)/libSDL2-2.0.so.0.4.0: TOOLSET := $(TOOLSET)
$(builddir)/libSDL2-2.0.so.0.4.0: other_lib/linux/$(BUILDTYPE)-x64/libSDL2-2.0.so.0.4.0 FORCE_DO_CMD
    $(call do_cmd,copy)

Which is obviously invalid build rule for building in build/make/linux
It should be either ../../../other_lib/linux/$(BUILDTYPE)-x64/libSDL2-2.0.so.0.4.0 or $(srcdir)/other_lib/linux/$(BUILDTYPE)-x64/libSDL2-2.0.so.0.4.0

Still not figured out how to change GYP configs to make it work

from ktx-software.

MarkCallow avatar MarkCallow commented on June 19, 2024

You need to use my bug fixed fork of GYP that I pointed at in my first comment.

If you don't want to do that, you can submit a PR against the issue-18 branch instead and I will regenerate the make files and merge to incoming.

from ktx-software.

rjktcby avatar rjktcby commented on June 19, 2024

No, i'm fine with your fork, everything builds and all tests pass now

from ktx-software.

MarkCallow avatar MarkCallow commented on June 19, 2024

I have merged your pull request #19. Thanks.

from ktx-software.

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.