Announcement

Collapse
No announcement yet.

CMake 3.1 Brings Windows Additions, Target Compile Feature

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • CMake 3.1 Brings Windows Additions, Target Compile Feature

    Phoronix: CMake 3.1 Brings Windows Additions, Target Compile Feature

    Version 3.1 of the CMake build system is now available with various improvements...

    Phoronix, Linux Hardware Reviews, Linux hardware benchmarks, Linux server benchmarks, Linux benchmarking, Desktop Linux, Linux performance, Open Source graphics, Linux How To, Ubuntu benchmarks, Ubuntu hardware, Phoronix Test Suite

  • #2
    Linker shortcuts.

    A nice feature for cmake would be something to streamline linking binary resources into binaries. Currently it takes at least 5 really long lines of platform-dependant code to link a binary file, and this also requires creating an extra target for each file.

    Comment


    • #3
      bin2c is platform-independent, fast, and uses short command-lines.

      You're welcome.

      Comment


      • #4
        Doing it that way could create some pretty huge headers though. I was doing that before for some fallback font textures. At the moment I'm using these lines to create the targets to include the binary files directly:
        Code:
        MAKE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/work)
        set(WORKDIR ${CMAKE_CURRENT_BINARY_DIR}/work)
        
        add_custom_command(OUTPUT ${WORKDIR}/thing_one.o
            COMMAND cd ${BINDIR} && ld -r -b binary -o ${WORKDIR}/thing_one.o pathto/thing_one.bin
        )
        add_library(thing_one STATIC ${WORKDIR}/thing_one.o)
        set_source_files_properties(thing_one PROPERTIES EXTERNAL_OBJECT true GENERATED true)
        set_target_properties(thing_one PROPERTIES LINKER_LANGUAGE C)
        
        add_custom_command(OUTPUT ${WORKDIR}/thing_two.o
            COMMAND cd ${BINDIR} && ld -r -b binary -o ${WORKDIR}/thing_two.o pathto/thing_two.bin
        )
        add_library(thing_one STATIC ${WORKDIR}/thing_two.o)
        set_source_files_properties(thing_two PROPERTIES EXTERNAL_OBJECT true GENERATED true)
        set_target_properties(thing_two PROPERTIES LINKER_LANGUAGE C)
        Although, could I just extern define the variables and use bin2c to create source files when cmake runs? I have little idea what I'm doing :P

        Comment

        Working...
        X