Commit f53b7f29 authored by French, Robert's avatar French, Robert
Browse files

Detect platform

parent 7a026a33
Loading
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -15,18 +15,12 @@ stages:
  - ./hello_world.exe

.mac_template: &mac
  variables:
    COMPILERS: gnu,clang
  tags:
  - mac
  environment: mac

.xk7_template: &xk7
  variables:
    COMPILERS: gnu,pgi,cce,intel
  tags:
  - xk7
  environment: xk7

build:mac:
  <<: *build
+14 −1
Original line number Diff line number Diff line
from breakable import *
import platform

class BreakTasks(object):
  CC = which("c++")

  @provides("hello_world.exe")
  def build_hello_world(self):
@@ -10,3 +10,16 @@ class BreakTasks(object):

  def clean(self):
    rm("*.exe")
  
  @belhorn_property
  def CC(self):
    if platform.system() == 'Linux':
      return self._linux_cc()
    else:
      return self._mac_cc()

  def _linux_cc(self):
    return which("CC")

  def _mac_cc(self):
    return which("c++")
+2 −1
Original line number Diff line number Diff line
#include <iostream>
#include "platform.h"

int main(int argc, char** argv) {
  std::cout << "Hello, World!\n";
  std::cout << "Hello from " << PLATFORM << "\n";
}

platform.h

0 → 100644
+7 −0
Original line number Diff line number Diff line
#ifdef __APPLE__
#define PLATFORM "OSX"
#endif

#ifdef __linux__
#define PLATFORM "LINUX"
#endif