Worked on windows and emscripten builds, still not perfect.

This commit is contained in:
xawotihs
2015-10-24 23:33:31 +02:00
parent daabce1d2f
commit 579d612397
9 changed files with 49 additions and 21 deletions

View File

@@ -24,15 +24,23 @@ macro(FindOrBuildTinyXML)
endmacro()
macro(FindOrBuildSDL2)
if(ANDROID)
set(ENV{SDL2DIR} "$ENV{ANDROID_SDL2_ROOT};$ENV{ANDROID_SDL2_ROOT}/libs/${ANDROID_NDK_ABI_NAME}/")
elseif(WIN32 OR UNIX)
# set(ENV{SDL2DIR} $ENV{WIN_SDL2_ROOT})
if(BUILD_SDL2)
if(WIN32)
#SDL2 DirectX build is somehow broken...
set(SDL_AUDIO FALSE)
set(SDL_JOYSTICK FALSE)
set(SDL_HAPTIC FALSE)
set(SDL_SHARED FALSE)
endif()
add_subdirectory(${CMAKE_SOURCE_DIR}/thirdparty/SDL2)
set(SDL2_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/SDL2/include ${CMAKE_BINARY_DIR}/thirdparty/SDL2)
set(SDL2_LIBRARY SDL2)
else()
find_package(SDL2)
if(EMSCRIPTEN OR WIN32)
set(SDL2_LIBRARY SDL2-static)
else()
set(SDL2_LIBRARY SDL2)
endif()
elseif(NOT EMSCRIPTEN)
find_package(SDL2)
endif()
endmacro()
@@ -90,7 +98,7 @@ endmacro()
macro(FindOrBuildZLIB)
if(BUILD_ZLIB)
add_subdirectory(${CMAKE_SOURCE_DIR}/thirdparty/zlib)
add_subdirectory(${CMAKE_SOURCE_DIR}/thirdparty/zlib)
set(ZLIB_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/thirdparty/zlib ${CMAKE_BINARY_DIR}/thirdparty/zlib)
set(ZLIB_LIBRARIES zlib)
else()
@@ -142,7 +150,8 @@ endmacro()
macro(FindOrBuildPNG)
if(BUILD_PNG)
add_subdirectory(${CMAKE_SOURCE_DIR}/thirdparty/libpng ${CMAKE_BINARY_DIR}/thirdparty/libpng)
find_path(PNG_INCLUDE_DIRS NAMES png.h HINTS ${CMAKE_SOURCE_DIR}/thirdparty/libpng)
set(PNG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/thirdparty/libpng)
# find_path(PNG_INCLUDE_DIRS NAMES png.h HINTS ${CMAKE_SOURCE_DIR}/thirdparty/libpng)
set(PNG_LIBRARIES png)
else()
if(WIN32)
@@ -202,6 +211,8 @@ macro(FindOrBuildOpenGL)
if(ANDROID)
#find openglesv on android
set(OPENGL_LIBRARIES "-ldl -lGLESv1_CM -lGLESv2 -llog -landroid")
elseif(EMSCRIPTEN)
set(OPENGL_LIBRARIES "")
else()
find_package(OpenGL)
# find_package(GLUT)