Code Monkey home page Code Monkey logo

objcheck's Introduction

objcheck

objcheck, aka Objective-C Check, tests Objective-C and Objective-C++ code against both Clang and GCC automatically.

Warning

objcheck checks target source by compiling and executing it. Hence, DON'T use objcheck to test untrusted source.

Why objcheck?

Currently, the major Objective-C compilers, Clang and GCC, are not totally compatible at code level. If wanting to check compiler compatibility for our Objective-C code base, we have to compile it twice.

It is tedious to write Makefile or another project configuration file for each code base. To address this issue, objcheck automatically tests your code base against both Clang and GCC without any project configuration file.

objcheck intends to check small code base because objcheck doesn't rely on any external project configuration, unsuitable for large and complex projects.

System Requirements

objcheck itself is implemented in POSIX shell. Besides a shell, you need

  • GCC with Objective-C support
  • Clang
  • GNUstep

objcheck will check these dependencies, emitting an error message if one is not installed on your system.

We tested objcheck on Ubuntu 18.04 LTS and Amazon Linux. The latter is largely RHEL and CentOS compatible. It should work on other Unix-like OSes as well.

Supported File Formats

objcheck supports the following file extensions:

  • .m for Objective-C source
  • .mm for Objective-C++ source
  • .c for C source
  • .cpp, .cxx or .cc for C++ source

objcheck can handle Objective-C projects that mix these languages together.

Usage

Before using objcheck, add executable mode to it:

$ chmod +x path/to/objcheck

Then, copy objcheck to a valid $PATH like $HOME/bin to use it.

Check single file:

$ objcheck path/to/file.m

Check multiple files in a project:

$ objcheck path/to/*.m

Check for a static library:

$ objcheck static path/to/*.m

Check for a dynamic library:

$ objcheck dynamic path/to/*.m

Show help info:

$ objcheck help

Environment Variables

You can adjust the behavior of objcheck with the following environment variables:

  • GCC to set GCC compiler
  • GXX to set G++ compiler
  • CLANG to set Clang compiler
  • CLANGXX to set Clang++ compiler
  • OUT_FILE to set the name of a temporary output file
  • GNUSTEP_INCLUDE to set the include path of GNUstep
  • GNUSTEP_LIB to set the lib path of GNUstep
  • CFLAGS to set custom include paths and compiler flags for C
  • CXXFLAGS to set custom include paths and compiler flags for C++
  • LDFLAGS to set custom lib paths
  • LIBS to set custom library linkages
  • LD_LIBRARY_PATH to set custom binary file paths

All environment variables are optional, set with sensible default values.

License

Copyright 2019 (c) Michelle Chen. Licensed under MIT

objcheck's People

Contributors

cwchentw avatar opensourcedoc avatar

Watchers

 avatar

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.