Skip to content
This repository has been archived by the owner on Jul 20, 2020. It is now read-only.

Commit

Permalink
Made building possible under OS X via CMake.
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianKniephoff committed Jan 16, 2011
1 parent 4f36130 commit 9756f92
Show file tree
Hide file tree
Showing 5 changed files with 698 additions and 19 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ image.jpg
*~
*.swp
*.o
cmake_install.cmake
CMakeFiles
CMakeCache.txt
36 changes: 36 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
cmake_minimum_required (VERSION 2.8)

project (seamless)

set (SOURCES
main.c
pixel_access.c
array_image.c
energy_functions.c
)

set_source_files_properties (main.c pixel_access.c array_image.c energy_functions.c
PROPERTIES COMPILE_FLAGS "-Wall -Werror -pedantic-errors -std=c99"
)

include (FindSDL)
include (FindSDL_image)

if (${APPLE})
set (SOURCES
${SOURCES}
SDLMain.m
)
endif (${APPLE})

include_directories (
${SDL_INCLUDE_DIR}
${SDLIMAGE_INCLUDE_DIR}
)

add_executable (seamless ${SOURCES})

target_link_libraries (seamless
${SDL_LIBRARY}
${SDLIMAGE_LIBRARY}
)
281 changes: 262 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,28 +1,271 @@
OBJS = main.o array_image.o energy_functions.o pixel_access.o
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 2.8

CFLAGS = -c -Wall -Werror -pedantic-errors -std=c99 -O3
ifeq ($(DEBUG),1)
CFLAGS += -g
endif
# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target

CFLAGS += `sdl-config --cflags`
LIBS = `sdl-config --libs` -lSDL_image
#=============================================================================
# Special targets provided by cmake.

seamless: $(OBJS)
gcc $(LIBS) $(OBJS) -o seamless
# Disable implicit rules so canoncical targets will work.
.SUFFIXES:

main.o: main.c array_image.h util.h
gcc $(CFLAGS) main.c
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =

array_image.o: array_image.c array_image.h pixel_access.h
gcc $(CFLAGS) array_image.c
.SUFFIXES: .hpux_make_needs_suffix_list

energy_functions.o: energy_functions.c util.h array_image.h
gcc $(CFLAGS) energy_functions.c
# Suppress display of executed commands.
$(VERBOSE).SILENT:

pixel_access.o: pixel_access.c pixel_access.h
gcc $(CFLAGS) pixel_access.c
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force

#=============================================================================
# Set environment variables for the build.

# The shell in which to execute make rules.
SHELL = /bin/sh

# The CMake executable.
CMAKE_COMMAND = "/Applications/CMake 2.8-3.app/Contents/bin/cmake"

# The command to remove a file.
RM = "/Applications/CMake 2.8-3.app/Contents/bin/cmake" -E remove -f

# The program to use to edit the cache.
CMAKE_EDIT_COMMAND = "/Applications/CMake 2.8-3.app/Contents/bin/ccmake"

# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /Users/julian/Documents/seamless

# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /Users/julian/Documents/seamless

#=============================================================================
# Targets provided globally by CMake.

# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
"/Applications/CMake 2.8-3.app/Contents/bin/ccmake" -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : edit_cache

# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast

# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
"/Applications/CMake 2.8-3.app/Contents/bin/cmake" -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache

# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast

# The main all target
all: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start /Users/julian/Documents/seamless/CMakeFiles /Users/julian/Documents/seamless/CMakeFiles/progress.marks
$(MAKE) -f CMakeFiles/Makefile2 all
$(CMAKE_COMMAND) -E cmake_progress_start /Users/julian/Documents/seamless/CMakeFiles 0
.PHONY : all

# The main clean target
clean:
rm -f $(OBJS)
rm seamless
$(MAKE) -f CMakeFiles/Makefile2 clean
.PHONY : clean

# The main clean target
clean/fast: clean
.PHONY : clean/fast

# Prepare targets for installation.
preinstall: all
$(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall

# Prepare targets for installation.
preinstall/fast:
$(MAKE) -f CMakeFiles/Makefile2 preinstall
.PHONY : preinstall/fast

# clear depends
depend:
$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend

#=============================================================================
# Target rules for targets named seamless

# Build rule for target.
seamless: cmake_check_build_system
$(MAKE) -f CMakeFiles/Makefile2 seamless
.PHONY : seamless

# fast build rule for target.
seamless/fast:
$(MAKE) -f CMakeFiles/seamless.dir/build.make CMakeFiles/seamless.dir/build
.PHONY : seamless/fast

SDLMain.o: SDLMain.m.o
.PHONY : SDLMain.o

# target to build an object file
SDLMain.m.o:
$(MAKE) -f CMakeFiles/seamless.dir/build.make CMakeFiles/seamless.dir/SDLMain.m.o
.PHONY : SDLMain.m.o

SDLMain.i: SDLMain.m.i
.PHONY : SDLMain.i

# target to preprocess a source file
SDLMain.m.i:
$(MAKE) -f CMakeFiles/seamless.dir/build.make CMakeFiles/seamless.dir/SDLMain.m.i
.PHONY : SDLMain.m.i

SDLMain.s: SDLMain.m.s
.PHONY : SDLMain.s

# target to generate assembly for a file
SDLMain.m.s:
$(MAKE) -f CMakeFiles/seamless.dir/build.make CMakeFiles/seamless.dir/SDLMain.m.s
.PHONY : SDLMain.m.s

array_image.o: array_image.c.o
.PHONY : array_image.o

# target to build an object file
array_image.c.o:
$(MAKE) -f CMakeFiles/seamless.dir/build.make CMakeFiles/seamless.dir/array_image.c.o
.PHONY : array_image.c.o

array_image.i: array_image.c.i
.PHONY : array_image.i

# target to preprocess a source file
array_image.c.i:
$(MAKE) -f CMakeFiles/seamless.dir/build.make CMakeFiles/seamless.dir/array_image.c.i
.PHONY : array_image.c.i

array_image.s: array_image.c.s
.PHONY : array_image.s

# target to generate assembly for a file
array_image.c.s:
$(MAKE) -f CMakeFiles/seamless.dir/build.make CMakeFiles/seamless.dir/array_image.c.s
.PHONY : array_image.c.s

energy_functions.o: energy_functions.c.o
.PHONY : energy_functions.o

# target to build an object file
energy_functions.c.o:
$(MAKE) -f CMakeFiles/seamless.dir/build.make CMakeFiles/seamless.dir/energy_functions.c.o
.PHONY : energy_functions.c.o

energy_functions.i: energy_functions.c.i
.PHONY : energy_functions.i

# target to preprocess a source file
energy_functions.c.i:
$(MAKE) -f CMakeFiles/seamless.dir/build.make CMakeFiles/seamless.dir/energy_functions.c.i
.PHONY : energy_functions.c.i

energy_functions.s: energy_functions.c.s
.PHONY : energy_functions.s

# target to generate assembly for a file
energy_functions.c.s:
$(MAKE) -f CMakeFiles/seamless.dir/build.make CMakeFiles/seamless.dir/energy_functions.c.s
.PHONY : energy_functions.c.s

main.o: main.c.o
.PHONY : main.o

# target to build an object file
main.c.o:
$(MAKE) -f CMakeFiles/seamless.dir/build.make CMakeFiles/seamless.dir/main.c.o
.PHONY : main.c.o

main.i: main.c.i
.PHONY : main.i

# target to preprocess a source file
main.c.i:
$(MAKE) -f CMakeFiles/seamless.dir/build.make CMakeFiles/seamless.dir/main.c.i
.PHONY : main.c.i

main.s: main.c.s
.PHONY : main.s

# target to generate assembly for a file
main.c.s:
$(MAKE) -f CMakeFiles/seamless.dir/build.make CMakeFiles/seamless.dir/main.c.s
.PHONY : main.c.s

pixel_access.o: pixel_access.c.o
.PHONY : pixel_access.o

# target to build an object file
pixel_access.c.o:
$(MAKE) -f CMakeFiles/seamless.dir/build.make CMakeFiles/seamless.dir/pixel_access.c.o
.PHONY : pixel_access.c.o

pixel_access.i: pixel_access.c.i
.PHONY : pixel_access.i

# target to preprocess a source file
pixel_access.c.i:
$(MAKE) -f CMakeFiles/seamless.dir/build.make CMakeFiles/seamless.dir/pixel_access.c.i
.PHONY : pixel_access.c.i

pixel_access.s: pixel_access.c.s
.PHONY : pixel_access.s

# target to generate assembly for a file
pixel_access.c.s:
$(MAKE) -f CMakeFiles/seamless.dir/build.make CMakeFiles/seamless.dir/pixel_access.c.s
.PHONY : pixel_access.c.s

# Help Target
help:
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... edit_cache"
@echo "... rebuild_cache"
@echo "... seamless"
@echo "... SDLMain.o"
@echo "... SDLMain.i"
@echo "... SDLMain.s"
@echo "... array_image.o"
@echo "... array_image.i"
@echo "... array_image.s"
@echo "... energy_functions.o"
@echo "... energy_functions.i"
@echo "... energy_functions.s"
@echo "... main.o"
@echo "... main.i"
@echo "... main.s"
@echo "... pixel_access.o"
@echo "... pixel_access.i"
@echo "... pixel_access.s"
.PHONY : help



#=============================================================================
# Special targets to cleanup operation of make.

# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system

16 changes: 16 additions & 0 deletions SDLMain.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
Feel free to customize this file to suit your needs
*/

#ifndef _SDLMain_h_
#define _SDLMain_h_

#import <Cocoa/Cocoa.h>

@interface SDLMain : NSObject
@end

#endif /* _SDLMain_h_ */
Loading

0 comments on commit 9756f92

Please sign in to comment.