GithubHelp home page GithubHelp logo

Support MinGW compiler about cake HOT 2 CLOSED

thradams avatar thradams commented on June 10, 2024
Support MinGW compiler

from cake.

Comments (2)

 avatar commented on June 10, 2024

Not to mention, you left out Cygwin, too.

from cake.

thradams avatar thradams commented on June 10, 2024

Yes. I am using only gcc on linux and msvc on windows.
I will check clang and write instructions how to add new platforms.

Basically, we use the same compiler used to compile build.c to generate cake. (except emscripten)
The compiler/platform is detected at build.h using ifdefs and then at build.c the command line
is selected. You can try adding a new platform.

#if defined(_WIN32) && defined(_MSC_VER) && !defined(__clang__)
#define BUILD_WINDOWS
#define BUILD_WINDOWS_MSC
#define COMPILER_NAME "cl"
#define RUN ""
#elif defined(_WIN32) && defined(__clang__)
#define BUILD_WINDOWS
#define BUILD_WINDOWS_CLANG
#define RUN ""
#define COMPILER_NAME "clang"
#elif defined(__linux__) && defined(__clang__)
#define BUILD_LINUX
#define BUILD_LINUX_CLANG
#define COMPILER_NAME "clang"
#define RUN "./"
#elif defined(__linux__) && defined(__GNUC__)
#define BUILD_LINUX
#define BUILD_LINUX_GCC
#define COMPILER_NAME "gcc"
#define RUN "./"
#else
#error Unknown Platform/Compiler
#endif

Then at build.c we call the appropriated command line. For instance:

#ifdef BUILD_LINUX_CLANG
    system("clang "
           SOURCE_FILES " main.c "
#ifdef TEST
           "-DTEST"
#endif
           " -std=c17 "
           " -Wall "
           " -o " OUTPUT);
#endif

from cake.

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.