Got SDL2 version compiling on Mac.

This commit is contained in:
xawotihs
2015-10-06 23:25:40 +02:00
parent 22d14b2a4f
commit 075d950249
8 changed files with 34 additions and 30 deletions

View File

@@ -85,7 +85,7 @@ endif()
if(WIN32 OR ANDROID OR UNIX)
WAGIC_OPTION(backend_sdl "build for sdl" (WIN32 OR ANDROID))
endif()
if(UNIX AND NOT ANDROID)
if(NOT backend_sdl AND UNIX AND NOT ANDROID)
WAGIC_OPTION(backend_qt_console "build qt-console version with testsuit" ON)
WAGIC_OPTION(backend_qt_widget "build qt-widget version" OFF)
endif()

View File

@@ -91,21 +91,24 @@ endmacro()
macro(FindOrBuildZLIB)
if(BUILD_ZLIB)
add_subdirectory(${CMAKE_SOURCE_DIR}/thirdparty/zlib)
set(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/zlib ${CMAKE_BINARY_DIR}/thirdparty/zlib)
set(ZLIB_LIBRARY zlib)
set(ZLIB_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/thirdparty/zlib ${CMAKE_BINARY_DIR}/thirdparty/zlib)
set(ZLIB_LIBRARIES zlib)
else()
if(WIN32)
set(ZLIB_ROOT ${CMAKE_SOURCE_DIR}/thirdparty/binary/win)
find_package(ZLIB)
else()
find_package(ZLIB)
if(backend_qt_console OR backend_qt_widget)
else()
find_package(ZLIB)
endif()
endif()
endif()
endmacro()
macro(FindOrBuildGIF)
if(BUILD_GIF)
message(WARNING "ZLIB sources are currently not included within the wagic tree")
message(WARNING "GIF sources are currently not included within the wagic tree")
else()
find_package(GIF)
endif()
@@ -202,6 +205,7 @@ macro(FindOrBuildOpenGL)
set(OPENGL_LIBRARIES "-ldl -lGLESv1_CM -lGLESv2 -llog -landroid")
else()
find_package(OpenGL)
find_package(GLUT)
endif()
endif()
endmacro()

View File

@@ -102,21 +102,21 @@ endif()
if(backend_sdl)
if(UNIX AND NOT ANDROID)
set(JGE_INTERNAL_INCLUDE_DIRS ${TINYXML_INCLUDE_DIR} ${ZIPFS_INCLUDE_DIR}
${SDL2_INCLUDE_DIR} ${UNZIP_INCLUDE_DIR} ${PNG_INCLUDE_DIRS} ${BOOST_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR})
set(JGE_INTERNAL_INCLUDE_DIRS ${TINYXML_INCLUDE_DIR} ${ZIPFS_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR} ${GLUT_INCLUDE_DIR}
${SDL2_INCLUDE_DIR} ${UNZIP_INCLUDE_DIR} ${PNG_INCLUDE_DIRS} ${JPEG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS})
set(JGE_SOURCES ${JGE_generic_src} ${JGE_graphics_src} ${JGE_linux_src} ${JGE_hge_src})
set(JGE_LINK_LIBRARIES ${ZIPFS_LIBRARY} ${UNZIP_LIRARY} ${JPEG_LIBRARY}
${PNG_LIBRARIES})
${PNG_LIBRARIES} ${OPENGL_LIBRARIES} ${GLUT_LIBRARY})
elseif(ANDROID)
set(JGE_INTERNAL_INCLUDE_DIRS ${BOOST_INCLUDE_DIRS} ${TINYXML_INCLUDE_DIR} ${ZIPFS_INCLUDE_DIR}
${SDL2_INCLUDE_DIR} ${UNZIP_INCLUDE_DIR} ${PNG_INCLUDE_DIRS} ${JPEG_INCLUDE_DIR}
${OPENSL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR})
${OPENSL_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS})
set(JGE_SOURCES ${JGE_generic_src} ${JGE_android_src} ${JGE_graphics_src} ${JGE_hge_src})
set(JGE_LINK_LIBRARIES ${ZIPFS_LIBRARY} ${UNZIP_LIRARY} ${JPEG_LIBRARY} ${PNG_LIBRARIES}
${OPENSL_LIBRARIES})
elseif(WIN32)
set(JGE_INTERNAL_INCLUDE_DIRS ${EXTRA_INCLUDE_DIR} ${TINYXML_INCLUDE_DIR} ${ZIPFS_INCLUDE_DIR} ${SDL2_INCLUDE_DIR}
${UNZIP_INCLUDE_DIR} ${PNG_INCLUDE_DIRS} ${JPEG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/thirdparty/binary/win/include)
${UNZIP_INCLUDE_DIR} ${PNG_INCLUDE_DIRS} ${JPEG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/thirdparty/binary/win/include)
set(JGE_SOURCES ${JGE_generic_src} ${JGE_graphics_src} ${JGE_linux_src} ${JGE_hge_src})
set(JGE_LINK_LIBRARIES ${ZIPFS_LIBRARY} ${UNZIP_LIRARY} ${JPEG_LIBRARY} ${PNG_LIBRARIES})
set(JGE_LINK_DIRECTORIES ${Boost_LIBRARY_DIR} ${SDL2_LIBRARY_DIR})

View File

@@ -144,9 +144,14 @@ typedef uint32_t u32;
#include <GLES/gl.h>
#include <GLES/glext.h>
#elif defined (WIN32) || defined (LINUX)
#if defined(__APPLE__)
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/gl.h>
#include <GL/glu.h>
#endif
#endif
#else
#include <QtOpenGL>
#endif

View File

@@ -30,6 +30,8 @@ The content that users should not be touching.
#include "../include/JGE.h"
#include "../include/JFileSystem.h"
#include "../include/JLogger.h"
#include "DebugRoutines.h"
#ifdef QT_CONFIG
#include <QDir>
@@ -137,9 +139,9 @@ JFileSystem::JFileSystem(const string & _userPath, const string & _systemPath)
userPath = QDir::toNativeSeparators(dir.absolutePath()).toStdString();
systemPath = QDir::toNativeSeparators(sysDir.absolutePath()).toStdString();
DebugTrace("User path " << userPath);
DebugTrace("System path " << systemPath);
DebugTrace("Current path " << QDir::currentPath().toStdString());
DebugTrace("User path " + userPath);
DebugTrace("System path " + systemPath);
DebugTrace("Current path " + QDir::currentPath().toStdString());
#else
//Find the Res.txt file and matching Res folders for backwards compatibility
ifstream mfile("Res.txt");

View File

@@ -1,3 +1,4 @@
add_definitions(-DLINUX)
add_definitions(-DUSERDIR=".wagic")
add_definitions(-DRESDIR="Res")
add_definitions(-DRESDIR="Res")
set(CMAKE_CXX_FLAGS "-stdlib=libc++ -std=c++0x")

View File

@@ -155,9 +155,7 @@ if(backend_qt_console)
else()
message(FATAL_ERROR "qt-console bilds are only supported on unix platforms")
endif()
endif()
if(backend_qt_widget)
elseif(backend_qt_widget)
if(UNIX AND NOT ANDROID)
include_directories(${MTG_INCLUDE_DIRS} ${JGE_INCLUDE_DIRS} ${ZIPFS_INCLUDE_DIR} ${Qt5Core_INCLUDE_DIRS} ${Qt5Multimedia_INCLUDE_DIRS}
${UNZIP_INCLUDE_DIR} ${HGE_INCLUDE_DIR} ${TINYXML_INCLUDE_DIR} ${QT_MKSPECS_DIR}/default)
@@ -167,15 +165,11 @@ if(backend_qt_widget)
else()
message(FATAL_ERROR "qt-widget bilds are only supported on unix platforms")
endif()
endif()
if(backend_sdl)
elseif(backend_sdl)
if(UNIX AND NOT ANDROID)
include_directories(${MTG_INCLUDE_DIRS} ${JGE_INCLUDE_DIRS} ${SDL2_INCLUDE_DIR} ${ZIPFS_INCLUDE_DIR}
${BOOST_INCLUDE_DIRS} ${UNZIP_INCLUDE_DIR} ${HGE_INCLUDE_DIR} ${TINYXML_INCLUDE_DIR})
include_directories(${MTG_INCLUDE_DIRS} ${JGE_INCLUDE_DIRS} ${SDL2_INCLUDE_DIR} ${ZIPFS_INCLUDE_DIR} ${UNZIP_INCLUDE_DIR} ${HGE_INCLUDE_DIR} ${TINYXML_INCLUDE_DIR})
add_executable(wagic ${MTG_generic_src} ${MTG_sdl_src})
target_link_libraries(wagic ${JGE_LIBRARY} ${SDL2_LIBRARY} ${OPENGL_LIBRARIES} ${TINYXML_LIBRARIES}
${Boost_LIBRARIES} ${HGE_LIBRARY})
target_link_libraries(wagic ${JGE_LIBRARY} ${SDL2_LIBRARY} ${OPENGL_LIBRARIES} ${TINYXML_LIBRARIES} ${HGE_LIBRARY} ${ZLIB_LIBRARIES})
elseif(ANDROID)
include_directories(${MTG_INCLUDE_DIRS} ${JGE_INCLUDE_DIRS} ${SDL2_INCLUDE_DIR} ${ZIPFS_INCLUDE_DIR}
${BOOST_INCLUDE_DIRS} ${UNZIP_INCLUDE_DIR} ${HGE_INCLUDE_DIR} ${TINYXML_INCLUDE_DIR})
@@ -190,15 +184,13 @@ if(backend_sdl)
elseif(WIN32)
include_directories(${EXTRA_INCLUDE_DIR} ${MTG_INCLUDE_DIRS} ${JGE_INCLUDE_DIRS} ${SDL2_INCLUDE_DIR} ${ZIPFS_INCLUDE_DIR}
${Boost_INCLUDE_DIRS} ${UNZIP_INCLUDE_DIR} ${HGE_INCLUDE_DIR} ${TINYXML_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/thirdparty/binary/win/include)
${ZLIB_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/thirdparty/binary/win/include)
add_executable(wagic ${MTG_generic_src} ${MTG_sdl_src} src/TestSuiteAI.cpp src/AIPlayerBakaB.cpp)
link_directories(${Boost_LIBRARY_DIR} ${SDL2_LIBRARY_DIR})
target_link_libraries(wagic ${JGE_LIBRARY} ${SDL2_LIBRARY} ${OPENGL_LIBRARIES} ${TINYXML_LIBRARIES}
${BOOST_date_time} ${HGE_LIBRARY} ${CMAKE_SOURCE_DIR}/thirdparty/binary/win/lib/fmodvc.lib)
endif()
endif()
if(backend_psp)
elseif(backend_psp)
if(PSP)
#${PSPSDK_PATH}/include
include_directories(${MTG_INCLUDE_DIRS} ${JGE_INCLUDE_DIRS} ${TINYXML_INCLUDE_DIR} ${ZIPFS_INCLUDE_DIR}

View File

@@ -6,7 +6,7 @@ set(SOURCES
ziphdr.cpp)
#FindOrBuildZLIB()
include_directories(${CMAKE_SOURCE_DIR}/JGE/include ${EXTRA_INCLUDES} ${ZLIB_INCLUDE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/JGE/include ${EXTRA_INCLUDES} ${ZLIB_INCLUDE_DIRS})
add_library(zipFS ${SOURCES})
#target_link_libraries(zipFS ${ZLIB_LIBRARY})
#target_link_libraries(zipFS ${ZLIB_LIBRARIES})