Skip to content

Commit

Permalink
Fix building on linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
johanfforsberg committed Dec 30, 2018
1 parent f2ec6ba commit 2181ffa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ SOURCES += imgui/examples/libs/gl3w/GL/gl3w.c
OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))

UNAME_S := $(shell uname -s)
$(info Building for ${UNAME_S})


ifeq ($(UNAME_S), Linux) #LINUX
#untested - rotted now
ECHO_MESSAGE = "Linux"
LIBS = -lGL `pkg-config --static --libs glfw3`
LIBS = -lGL -lpthread -lportmidi `pkg-config --static --libs glfw3`

CXXFLAGS = -Iimgui/ -Iimgui/examples/libs/gl3w `pkg-config --cflags glfw3`
CXXFLAGS += -Wall -Wformat -O2
Expand Down Expand Up @@ -47,6 +47,7 @@ all: $(EXE)

$(EXE): $(OBJS) $(EXE).icns Info.plist
$(CXX) -o $@ $(OBJS) $(CXXFLAGS) $(LIBS)
ifeq ($(UNAME_S), Darwin) #APPLE
mkdir -p midi2osc.app/Contents/MacOS/
mkdir -p midi2osc.app/Contents/Resources/
cp midi2osc midi2osc.app/Contents/MacOS/
Expand All @@ -56,12 +57,14 @@ $(EXE): $(OBJS) $(EXE).icns Info.plist
-cp /usr/local/opt/portmidi/lib/libportmidi.dylib midi2osc.app/Contents/MacOS/
install_name_tool -change /usr/local/opt/glfw3/lib/libglfw3.3.dylib @executable_path/libglfw3.3.dylib midi2osc.app/Contents/MacOS/midi2osc
install_name_tool -change /usr/local/opt/portmidi/lib/libportmidi.dylib @executable_path/libportmidi.dylib midi2osc.app/Contents/MacOS/midi2osc
endif

clean:
rm -f $(EXE) $(OBJS)
rm -f $(EXE).icns

$(EXE).icns: $(EXE)Icon.png
ifeq ($(UNAME_S), Darwin) #APPLE
rm -rf $(EXE).iconset
mkdir $(EXE).iconset
sips -z 16 16 $(EXE)Icon.png --out $(EXE).iconset/icon_16x16.png
Expand All @@ -74,6 +77,7 @@ $(EXE).icns: $(EXE)Icon.png
sips -z 512 512 $(EXE)Icon.png --out $(EXE).iconset/[email protected]
sips -z 512 512 $(EXE)Icon.png --out $(EXE).iconset/icon_512x512.png
sips -z 1024 1024 $(EXE)Icon.png --out $(EXE).iconset/[email protected]
#cp $(EXE)Icon.png $(EXE).iconset/[email protected]
cp $(EXE)Icon.png $(EXE).iconset/[email protected]
iconutil -c icns -o $(EXE).icns $(EXE).iconset
rm -r $(EXE).iconset
endif
6 changes: 4 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ void usleep(int usec) { Sleep(usec/1000); }
#include <netdb.h>
#include <unistd.h>
#include <limits.h>
#ifdef __APPLE__
#include <CoreServices/CoreServices.h>
#endif
#endif
#define WINDOW_HEIGHT 500
#include "imgui.h"
#include "imgui/examples/imgui_impl_glfw.h"
Expand Down Expand Up @@ -268,7 +270,7 @@ void UpdateIP() {
}
int main(int argc, char**argv){
const char *home = 0;
#ifndef _WIN32
#ifdef __APPLE__
FSRef fsref;
unsigned char path[PATH_MAX];
if (FSFindFolder(kUserDomain, kCurrentUserFolderType, kDontCreateFolder, &fsref) == noErr && FSRefMakePath(&fsref, path, sizeof(path)) == noErr)
Expand Down Expand Up @@ -597,4 +599,4 @@ int CALLBACK WinMain(
WSAStartup(MAKEWORD(2, 2), &wsaData);
return main(0,0);
}
#endif
#endif

0 comments on commit 2181ffa

Please sign in to comment.