Skip to content

Instantly share code, notes, and snippets.

@j0uni
Last active December 24, 2015 20:19
Show Gist options
  • Save j0uni/6856711 to your computer and use it in GitHub Desktop.
Save j0uni/6856711 to your computer and use it in GitHub Desktop.
How to build / compile / make CuraEngine on OS X
Steps:
1. You need XCode developer tools (to get g++)
2. Below you can find the Makefile I'm using which on my system works. The paths are nasty hacks, but feel free to modify them..
3. make binary can be found from "/Applications/Xcode.app/Contents/Developer/usr/bin//make"
4. I hacked missing LONG_LONG_MAX by defining it in main.cpp as
#ifndef LONG_LONG_MAX
#define LONG_LONG_MAX LLONG_MAX
#endif
5. Copy compiled binary to "/Applications/Cura/Cura.app/Contents" to make Cura to use it
I needed to add following include paths:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib/
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/sys/
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/c++/4.2.1/
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/c++/4.2.1/tr1/
=============================================================================================
#
# Makefile for CuraEngine
#
# simplest working invocation to compile it
#g++ main.cpp modelFile/modelFile.cpp clipper/clipper.cpp -I. -o CuraEngine
CC = /Applications/Xcode.app/Contents/Developer/usr/bin/g++
CFLAGS += -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib/ -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/ -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/sys/ -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/ -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/c++/4.2.1/ -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/c++/4.2.1/tr1/ -c -Wall -Wextra -O3 -fomit-frame-pointer
# also include debug symbols
#CFLAGS+=-ggdb
LDFLAGS +=
SOURCES = main.cpp settings.cpp modelFile/modelFile.cpp clipper/clipper.cpp
OBJECTS = $(SOURCES:.cpp=.o)
EXECUTABLE = CuraEngine
UNAME := $(shell uname)
ifeq ($(UNAME), Linux)
OPEN_HTML=firefox
LDFLAGS += --static
endif
ifeq ($(UNAME), Darwin)
OPEN_HTML=open
#For MacOS force to build
CFLAGS += -force_cpusubtype_ALL -mmacosx-version-min=10.6 -arch x86_64 -arch i386
LDFLAGS += -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib/ -force_cpusubtype_ALL -mmacosx-version-min=10.6 -arch x86_64 -arch i386
endif
ifeq ($(UNAME), MINGW32_NT-6.1)
#For windows make it large address aware, which allows the process to use more then 2GB of memory.
CFLAGS += -march=pentium4
LDFLAGS += -Wl,--large-address-aware
endif
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
.cpp.o:
$(CC) $(CFLAGS) $< -o $@
tests: $(EXECUTABLE)
python run_tests.py
## clean stuff
clean:
rm -f $(EXECUTABLE) $(OBJECTS)
help:
@cat Makefile |grep \#\#| grep \: |cut -d\# -f3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment