Code Monkey home page Code Monkey logo

Comments (5)

g1mv avatar g1mv commented on August 14, 2024

Just to make this clear : can you not use libssc's makefile ? CMake does actually create makefiles if I remember well ?
In XCode you can use an external makefile to build your project so it's not a problem really.
But I do agree that for simplicity one .o file should correspond to one .c file, I'll have a look into that and see if I can avoid code duplication by some other means.

from density.

nemequ avatar nemequ commented on August 14, 2024

Just to make this clear : can you not use libssc's makefile ? CMake does actually create makefiles if I remember well ?

It's more complicated than that. CMake is interesting because it's really more of a meta-build-system. It can create GNU/BSD-style Makefiles, and that's how I use it. However, it can also be used to create, for example, Visual Studio project files so that people using VS have nice integration. There are also a bunch of other generators, but I chose VS for an example because (1) it's popular and (2) I know their Makefile support is very limited (nmake only supports a small subset of what GNU/BSD make do). There are also other build systems, like waf, scons, tup, shake, bake, etc., that may or may not support integrating Makefile-based sub-projects.

Even if it's possible, it's probably more work to figure out how to reliably use the Makefile (even with VS) then it is to just reproduce your logic in CMake.

from density.

g1mv avatar g1mv commented on August 14, 2024

OK I get your point : basically too much dependency on Makefile can render the building process difficult on some platforms which don't support it very well. I'll see what I can do to get a "cleaner", more standard compilation process.

from density.

nemequ avatar nemequ commented on August 14, 2024

I haven't really looked at the code, but couldn't you just do something like this?

/* file_to_use_in_makefile.c */
#define SSC_IN_FILE_TO_USE_IN_MAKEFILE
#  define SSC_CHAMELEON_1P
#    include "whatever.c"
#  undef SSC_CHAMELEON_1P
#  define SSC_CHAMELEON_2P
#    include "whatever.c"
#  undef SSC_CHAMELEON_2P
#undef SSC_IN_FILE_TO_USE_IN_MAKEFILE
/* whatever.c */
#ifndef SSC_IN_FILE_TO_USE_IN_MAKEFILE
#  error "Don't build whatever.c directly; it will be included by file_to_use_in_makefile.c"
#endif

#if !defined(SSC_CHAMELEON_1P) && !defined(SSC_CHAMELEON_2P)
#  error "One of SSC_CHAMELEON_{1P,2P} must be defined."
#endif

/* Existing content goes here */

I would think that would be the least invasive way to make such a change...

from density.

g1mv avatar g1mv commented on August 14, 2024

Yes we had roughly the same idea ! It's now fixed in a6970a5 .
Maybe I should rename the two .c files that are includes-only (kernel_chameleon_encode.c and kernel_chameleon_decode.c) to some other suffix so they don't get compiled at all ? Not sure about this one.
On OSX clang is not clever enough to avoid creating a .o even if the c source is empty.
Anyways now every .c is compiled into one and only one .o !

from density.

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.