cmake_minimum_required (VERSION 2.6)
project (rube-sdl2)

#the top folder when you checkout the Box2D source - it should contain the 'Box2D' and 'Contributions' folders
set(BOX2D_ROOT .)


find_package(OpenGL REQUIRED)

add_definitions( -DGLIBCXX_FULLY_DYNAMIC_STRING=1 )

include_directories (
	${OPENGL_INCLUDE_DIR}
        ${BOX2D_ROOT}/Box2D
)

link_directories(
        ../src/Box2D/Build/Box2D
)

set(sourcefiles
	Window.cpp 
	PanZoomScene.cpp 
        b2dJsonImage_SDL2.cpp
	DebugDraw.cpp 
	RUBEScene.cpp 
	DestroyBodyScene.cpp 
	PinballScene.cpp 
	PlanetCuteScene.cpp
	rubestuff/jsoncpp.cpp 
	rubestuff/b2dJson.cpp 
	rubestuff/b2dJsonImage.cpp
)

if(APPLE)
        set(BINARY_NAME ../run/rube-sdl2-mac.app/Contents/MacOS/rube-sdl2-mac-bin)
elseif(WIN32)
        set(BINARY_NAME ../run/rube-sdl2-win32)
else()
	if(CMAKE_SIZEOF_VOID_P EQUAL 8)
                set(BINARY_NAME ../run/rube-sdl2-lin64)
	else()
                set(BINARY_NAME ../run/rube-sdl2-lin32)
	endif()
endif(APPLE)

add_executable(
	${BINARY_NAME}
	${sourcefiles}
)

target_link_libraries (
	${BINARY_NAME}
        SDL2
        SDL2_ttf
        SDL2_image
        SDL2_gfx
        SDL2_mixer
	Box2D
        ${OPENGL_LIBRARIES}
)

