Changeset 15c7ed9 in opengl-game


Ignore:
Timestamp:
Feb 23, 2017, 2:28:24 AM (8 years ago)
Author:
Dmitry Portnoy <dmp1488@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
4d52702
Parents:
5540132
Message:

Change the makefile to fully support mac and linux and add preprocessor driectives to detect the OS in the C++ code

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • game.cpp

    r5540132 r15c7ed9  
    88#include <GLFW/glfw3.h>
    99
    10 #ifdef __APPLE__
    11    #define OSX
     10#if defined(__linux__)
     11   #define LINUX
     12#elif defined(__APPLE__)
     13   #define MAC
    1214#endif
    1315
     
    3234
    3335   // required in OSX
    34    #ifdef OSX
     36   #ifdef MAC
    3537      glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
    3638   #endif
  • makefile

    r5540132 r15c7ed9  
    11OS = $(shell uname)
     2CC = g++
     3CFLAGS = -std=c++0x -Wall -pedantic #-Wextra
    24
    35ifeq ($(OS),Darwin)
    4         CHECK = OSX
    5         CC = g++ game.cpp -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -lglfw3 -lglew -Wall -o game
     6        DEP = -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo -lglfw3 -lglew
    67endif
    7 ifeq ($(OS),Lolbol)
    8         CHECK = LINUX
    9         CC = g++ game.cpp -lglfw3 -lGLEW -lGL -ldl -lX11 -lXrandr -lXxf86vm -lXinerama -lXcursor  -pthread -Wall -std=c++0x -o game
     8ifeq ($(OS),Linux)
     9        DEP = -lglfw3 -lGLEW -lGL -ldl -lX11 -lXrandr -lXxf86vm -lXinerama -lXcursor  -pthread
    1010endif
    1111
    1212game: game.cpp
    13         @echo $(CHECK)
    14         $(CC)
     13        $(CC) $? $(DEP) $(CFLAGS) -o $@
    1514
    1615clean:
Note: See TracChangeset for help on using the changeset viewer.