various Mac OS X fixes

This commit is contained in:
Sebastian Krzyszkowiak 2012-09-30 10:02:07 +02:00
parent d83e40b357
commit 8ced946622
6 changed files with 28 additions and 19 deletions

View file

@ -2,11 +2,18 @@ cmake_minimum_required(VERSION 2.8)
project(SuperDerpy C)
include("cmake/SetPaths.cmake")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -g")
if(APPLE)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fnested-functions")
if(CMAKE_INSTALL_PREFIX MATCHES "/usr/local")
set(CMAKE_INSTALL_PREFIX "/Applications")
set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}")
endif(CMAKE_INSTALL_PREFIX MATCHES "/usr/local")
endif(APPLE)
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include("cmake/SetPaths.cmake")
if(MINGW)
# Guess MINGDIR from the value of CMAKE_C_COMPILER if it's not set.
if("$ENV{MINGDIR}" STREQUAL "")
@ -27,7 +34,7 @@ if(MINGW)
COMMAND ${CMAKE_WINDRES} -I${CMAKE_SOURCE_DIR} -i${CMAKE_SOURCE_DIR}/data/icons/icon.rc
-o ${CMAKE_CURRENT_BINARY_DIR}/icon.o )
set(VLMC_SRCS ${VLMC_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/icon.o)
set(LINK_FLAGS -Wl,-subsystem,windows)
#set(LINK_FLAGS -Wl,-subsystem,windows)
endif(MINGW)
@ -63,11 +70,12 @@ ELSE(WIN32 AND NOT UNIX)
SET(CPACK_GENERATOR "DEB" "RPM")
SET(CPACK_STRIP_FILES "bin/superderpy")
SET(CPACK_SOURCE_STRIP_FILES "")
IF(MACOSX)
SET(CPACK_GENERATOR "Bundle")
ENDIF(MACOSX)
IF(APPLE)
SET(CPACK_GENERATOR "DragNDrop")
ENDIF(APPLE)
ENDIF(WIN32 AND NOT UNIX)
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Sebastian Krzyszkowiak <dos@dosowisko.net>")
#SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3.1-6), libgcc1 (>= 1:3.4.2-12)")
SET(CPACK_SET_DESTDIR "ON")
include(CPack)

View file

@ -1,23 +1,19 @@
# Try to find allegro 5
#
# ALLEGRO5_MAIN_FOUND - system has allegro5
# ALLEGRO5_MAIN_INCLUDE_DIR - the allrgo5 include directory
# ALLEGRO5_MAIN_LIBRARIES - Link these to use allegro5
#
FIND_PATH(ALLEGRO5_MAIN_INCLUDE_DIR allegro5/allegro_main.h)
SET(ALLEGRO5_MAIN_NAMES ${ALLEGRO5_MAIN_NAMES} allegro_main allegro_main_static liballegro_main liballegro_main_static)
FIND_LIBRARY(ALLEGRO5_MAIN_LIBRARY NAMES ${ALLEGRO5_MAIN_NAMES} )
# handle the QUIETLY and REQUIRED arguments and set ALLEGRO5_MAIN_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALLEGRO5_MAIN DEFAULT_MSG ALLEGRO5_MAIN_LIBRARY ALLEGRO5_MAIN_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALLEGRO5_MAIN DEFAULT_MSG ALLEGRO5_MAIN_LIBRARY)
IF(ALLEGRO5_MAIN_FOUND)
SET(ALLEGRO5_MAIN_LIBRARIES ${ALLEGRO5_MAIN_LIBRARY})
ENDIF(ALLEGRO5_MAIN_FOUND)
MARK_AS_ADVANCED(ALLEGRO5_MAIN_LIBRARY ALLEGRO5_MAIN_INCLUDE_DIR )
MARK_AS_ADVANCED(ALLEGRO5_MAIN_LIBRARY )

View file

@ -47,15 +47,20 @@ IF(${PACKAGE_BUILD})
SET(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib/superderpy:\$ORIGIN")
ENDIF(${PACKAGE_BUILD})
add_executable(superderpy ${SRC_LIST})
if(APPLE)
set(EXECUTABLE "SuperDerpy")
else(APPLE)
set(EXECUTABLE "superderpy")
endif(APPLE)
add_executable(${EXECUTABLE} WIN32 MACOSX_BUNDLE ${SRC_LIST})
include_directories(${ALLEGRO5_INCLUDE_DIR} ${ALLEGRO5_FONT_INCLUDE_DIR} ${ALLEGRO5_TTF_INCLUDE_DIR} ${ALLEGRO5_PRIMITIVES_INCLUDE_DIR} ${ALLEGRO5_AUDIO_INCLUDE_DIR} ${ALLEGRO5_ACODEC_INCLUDE_DIR} ${ALLEGRO5_IMAGE_INCLUDE_DIR})
target_link_libraries(superderpy ${ALLEGRO5_LIBRARIES} ${ALLEGRO5_FONT_LIBRARIES} ${ALLEGRO5_TTF_LIBRARIES} ${ALLEGRO5_PRIMITIVES_LIBRARIES} ${ALLEGRO5_AUDIO_LIBRARIES} ${ALLEGRO5_ACODEC_LIBRARIES} ${ALLEGRO5_IMAGE_LIBRARIES} ${ALLEGRO5_MAIN_LIBRARIES} m)
target_link_libraries(${EXECUTABLE} ${ALLEGRO5_LIBRARIES} ${ALLEGRO5_FONT_LIBRARIES} ${ALLEGRO5_TTF_LIBRARIES} ${ALLEGRO5_PRIMITIVES_LIBRARIES} ${ALLEGRO5_AUDIO_LIBRARIES} ${ALLEGRO5_ACODEC_LIBRARIES} ${ALLEGRO5_IMAGE_LIBRARIES} ${ALLEGRO5_MAIN_LIBRARIES} m)
if(ALLEGRO5_MAIN_FOUND)
include_directories(${ALLEGRO5_MAIN_INCLUDE_DIR})
target_link_libraries(superderpy ${ALLEGRO5_MAIN_INCLUDE_DIR})
target_link_libraries(${EXECUTABLE} ${ALLEGRO5_MAIN_LIBRARIES})
endif(ALLEGRO5_MAIN_FOUND)
install(TARGETS superderpy DESTINATION ${BIN_INSTALL_DIR})
install(TARGETS ${EXECUTABLE} DESTINATION ${BIN_INSTALL_DIR})

View file

@ -18,7 +18,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <allegro5/allegro.h>
#include <allegro5/allegro_primitives.h>
#include <allegro5/allegro_font.h>

View file

@ -149,7 +149,7 @@ bool GenerateObstacles(struct Game *game, struct TM_Action *action, enum TM_Acti
} else {
obst->callback = &Obst_MoveUpDown;
obst->bitmap = &(game->level.dodger.obst_bmps.screwball);
obst->data = (void*)(rand()%2);
obst->data = (void*)(rand()%2); // FIXME: not portable!
obst->rows = 4;
obst->cols = 4;
obst->speed = 1.1;

View file

@ -103,6 +103,7 @@ char* GetDataFilePath(char* filename) {
}
TestPath("../share/superderpy/data/");
TestPath("../data/");
TestPath("../Resources/data/");
TestPath("data/");
if (!result) {