Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support compiling on Mac #204

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -484,9 +484,14 @@ INC = -Isrc -I3rd_party

DEFINES = -D_USE_MATH_DEFINES -DGLM_ENABLE_EXPERIMENTAL

OS_NAME = $(shell uname -s)

LIBS_COMMON = sqlite3 yaml-cpp
ifneq ($(OS),Windows_NT)
LIBS_COMMON += uuid
ifeq ($(OS),Windows_NT)
else
ifneq ($(OS_NAME),Darwin)
LIBS_COMMON += uuid
endif
endif
LIBS_ALL = $(LIBS_COMMON) gtkmm-3.0 epoxy cairomm-pdf-1.0 librsvg-2.0 libzmq libgit2 libcurl

Expand All @@ -501,7 +506,9 @@ ifeq ($(OS),Windows_NT)
DEFINES += -DWIN32_UUID
LDFLAGS_GUI = -Wl,-subsystem,windows
else
LDFLAGS += -fuse-ld=gold
ifneq ($(OS_NAME),Darwin)
LDFLAGS += -fuse-ld=gold
endif
endif

# Object files
Expand All @@ -511,10 +518,18 @@ OBJ_COMMON = $(SRC_COMMON:.cpp=.o)
OBJ_OCE = $(SRC_OCE:.cpp=.o)

INC_ROUTER = -I3rd_party/router/include/ -I3rd_party/router -I3rd_party
INC_OCE = -I/opt/opencascade/inc/ -I/mingw64/include/oce/ -I/usr/include/oce -I/usr/include/opencascade -I${CASROOT}/include/opencascade -I/usr/local/include/OpenCASCADE
LDFLAGS_OCE = -L /opt/opencascade/lib/ -L${CASROOT}/lib -lTKSTEP -lTKernel -lTKXCAF -lTKXSBase -lTKBRep -lTKCDF -lTKXDESTEP -lTKLCAF -lTKMath -lTKMesh -lTKTopAlgo -lTKPrim -lTKBO -lTKG3d
INC_OCE = -I/opt/opencascade/inc/ -I/mingw64/include/oce/ -I/usr/include/oce -I/usr/local/include/oce -I/usr/include/opencascade -I${CASROOT}/include/opencascade -I/usr/local/include/OpenCASCADE
LDFLAGS_OCE = -L${CASROOT}/lib -lTKSTEP -lTKernel -lTKXCAF -lTKXSBase -lTKBRep -lTKCDF -lTKXDESTEP -lTKLCAF -lTKMath -lTKMesh -lTKTopAlgo -lTKPrim -lTKBO -lTKG3d

ifeq ($(OS),Windows_NT)
LDFLAGS_OCE += -lTKV3d
LDFLAGS_OCE += -lTKV3d
LDFLAGS_OCE += -L/opt/opencascade/lib/
else
ifeq ($(OS_NAME),Darwin)
LDFLAGS_OCE += -L/usr/local/lib/oce
else
LDFLAGS_OCE += -L/opt/opencascade/lib/
endif
endif

SRC_RES =
Expand Down
14 changes: 14 additions & 0 deletions src/util/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,20 @@ std::string get_exe_dir()
return "";
}
}
#elif __APPLE__
#include <mach-o/dyld.h>
std::string get_exe_dir()
{
char buf[PATH_MAX];
uint32_t len = sizeof(buf);
if (_NSGetExecutablePath(buf, &len) == 0) {
return Glib::path_get_dirname(buf);
}
else {
throw std::runtime_error("can't find executable");
return "";
}
}
#else
#error Dont know how to find path to executable on your OS.
#endif
Expand Down
2 changes: 2 additions & 0 deletions src/util/uuid.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#pragma once
#ifdef WIN32_UUID
#include "uuid_win32.hpp"
#elif __APPLE__
#include <uuid/uuid.h>
#else
#include <uuid.h>
#endif
Expand Down