OS X without Xcode

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
Post Reply
nicholaskell
Gnoblar
Posts: 4
Joined: Wed Nov 21, 2012 9:21 pm

OS X without Xcode

Post by nicholaskell » Wed Nov 21, 2012 9:32 pm

Greetings all,

I have searched for this without any luck. If it's here, I will gladly take the link.

A bit of background: We create all of our games to run on Linux, and are currently only doing 2d stuff, using SDL and SFML. I develop on my MBP, and currently hand spin all the Makefiles to be cross platform (for OS X and Linux, anyway).

I am wanting to compile Ogre from scratch on my OS X (10.8) machine. Now, I have tried using the cmake flag:

Code: Select all

-G Unix\ Makefiles
But it still produces .dylib files. I am looking for the .a and .so files, so in my Makefile I don't have to link to any frameworks and having to include any other OS X things. So far with SDL and SFML we are able to do this.

If it's possible, I would like to do a make install too.

Thank you in advance for any help.

Nicholas
0 x

User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
Contact:

Re: OS X without Xcode

Post by masterfalcon » Wed Nov 21, 2012 9:44 pm

Are you trying to cross compile for linux? If so you're going to need a custom toolchain installed, the compiler included with Xcode will NOT create linux compatible binaries.

.dylib is the OS X equivalent of .so. Both are extensions for shared libraries.
0 x

nicholaskell
Gnoblar
Posts: 4
Joined: Wed Nov 21, 2012 9:21 pm

Re: OS X without Xcode

Post by nicholaskell » Wed Nov 21, 2012 10:03 pm

Thank you for the quick reply.

No, I am not cross compiling. I am wanting to use the same linker statement on my OS X machine as my Linux machine for deployment.

So far we use the same Makefile without any custom rules for OS X versus Linux. I would like to keep that going to gain the necessary support from the rest of the team to hopefully break out of the 2d box with the help of Ogre.

I use Eclipse CDT and do all manual Makefile projects. I will do my development on a game locally on my mac compiling, testing, etc.. Then push to our git server, then pull on the deployment machine and make then run to test.

I hope this helps, here is a Makefile from one of the projects:

Code: Select all

SRC_DIR=src/

OBJDIR=$(SRC_DIR)_nv_obj/

EXECUTABLE_NAME=game

COMPILE_VERSION_MAJOR = 0
COMPILE_VERSION_MINOR = 0
COMPILE_VERSION_REVISION = "undefined in makefile"

SDL_LIBRARIES = -lSDL_image -lSDL_mixer -lSDL -lSDL_ttf
SFML_LIBRARIES = -lsfml-system -lsfml-window -lsfml-network -lsfml-graphics -lsfml-audio
MEDIA_LIBRARIES = $(SFML_LIBRARIES)
LIBRARIES = $(MEDIA_LIBRARIES) -lcups -lserial -ldl -lm
OPENGL_FLAGS = -lGLU -lGL 




MKDIR_P=mkdir -p
UNAME:=$(shell uname -s)

CPP_SOURCES:=$(shell find $(SRC_DIR) -type f -name '*.cpp')
CPP_OBJECTS=$(CPP_SOURCES:%.cpp=$(OBJDIR)%.o) 
OBJECTS=$(CPP_OBJECTS)

CPP_ONLY_WARNING_FLAGS:=  -Wsign-compare
WARNING_FLAGS_NO_WARNINGS:= -w
WARNING_FLAGS_ALL_WARNINGS:= -Wall

WARNING_FLAGS := $(CPP_ONLY_WARNING_FLAGS) -Wunreachable-code

# -O0 is the default Optimization flag
OPTIMIZE_FLAGS:= -O0 

CPP_C = g++
CPP_LINK_FLAGS = -g -o
CPP_FLAGS = 

SDL_CONFIG_DIR = 
SDL_CONFIG = sdl-config --cflags
SDL_CONFIG_COMMAND = $(SDL_CONFIG_DIR)$(SDL_CONFIG)



#This is redundant, since $USER is set in the OS 
# - But it will help remind me where it came from
USER := $(shell echo $(USER)) 



LINKER_EXTRAS =
COMPILER_EXTRAS =
#LIBRARIES =  -lSDL_image -lSDL_mixer -lSDL -lSDL_ttf -lcups -lserial -ldl -lm



#  Include Project specific Makefile include after the vars are set, bet before the rules are.
#  This way, any variable can be overriden, and a custom rule will be declared first - thus, 
#  will be executed, while the default will be ignored.

include $(SRC_DIR)project.mk

VERSION_DEFINES:= -D VERSION_MAJOR=$(COMPILE_VERSION_MAJOR) -D VERSION_MINOR=$(COMPILE_VERSION_MINOR) -D VERSION_REVISION=$(COMPILE_VERSION_REVISION)


COMPILE_DATE:= `date +'%y.%m.%d'`
COMPILE_TIME:= `date +'%H:%M:%S'`
COMPILE_DATE_TIME_DEFINES:= -D COMPILE_DATE=\"$(COMPILE_DATE)\" -D COMPILE_TIME=\"$(COMPILE_TIME)\"

EXECUTABLE?= $(EXECUTABLE_NAME)
DEFINES := $(VERSION_DEFINES) $(COMPILE_DATE_TIME_DEFINES)
COMPILER_FLAGS = -c -g $(OPTIMIZE_FLAGS)



all: $(OBJECTS)
	@echo -n 'Start executable linking.....'
	@if $(CPP_C) $(OPENGL_FLAGS) $(CPP_LINK_FLAGS) $(EXECUTABLE) $(DEFINES) $(OBJECTS) $(LINKER_EXTRAS) $(LIBRARIES) ;\
	then printf "SUCCESS!!\t\t\t";echo '';echo '-- Produced: '$(EXECUTABLE); echo '';\
	else echo ''; echo "FAIL"; echo ''; exit 1;\
	fi


$(OBJDIR)%.o : %.cpp
	@$(MKDIR_P) $(@D)
	@printf '%s' 'Compiling $*.cpp....'
	@if g++ -Wno-deprecated  $(DEFINES) $(COMPILER_FLAGS) $(COMPILER_EXTRAS) -I ./$(SRC_DIR) $< -o $@;\
	then echo "Success";\
	else echo "FAIL"; echo ''; exit 1;\
	fi


.PHONY: 	clean done start nick v_colonFile scrub game camera
.IGNORE: 	clean

clean:
	@echo '';echo '';echo '';
	@echo  "Starting the clean."
	-rm  $(OBJECTS) $(EXECUTABLE)
	@echo "cleaned up."
	@echo '';echo '';echo 'Files left behind:';
	ls -R $(OBJDIR) | grep "\.o"
	


done:
	@echo '';echo '';echo '';
	
start:
	clear;
	@echo '';echo '';echo '';
	@echo 'Start.'; 

scrub: start clean all done

	
v_colonFile:
	$(eval export DEFINES += -D VERBOSE_DEBUG_COLON_FILE)	

echo_vars:
	@echo "sdl-config: " $(SDL_CONFIG_COMMAND)



I am not a Makefile wizard, so I apologize for any confusion.

Thank you.
0 x

User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
Contact:

Re: OS X without Xcode

Post by masterfalcon » Wed Nov 21, 2012 10:28 pm

I'm not a Makefile expert either, but in this case files with a dylib extension are just fine and what you want if you are linking dynamically.
0 x

nicholaskell
Gnoblar
Posts: 4
Joined: Wed Nov 21, 2012 9:21 pm

Re: OS X without Xcode

Post by nicholaskell » Wed Nov 21, 2012 10:31 pm

Thank you masterfalcon. I will try to compile out something with the .dylib's. I appreciate your help.

Nicholas
0 x

Post Reply