Skip to content

Commit

Permalink
macOS build fix (#10)
Browse files Browse the repository at this point in the history
* Fix for macOS build

* Fixed SDL2 not building on macOS.
  • Loading branch information
Hotshot5000 committed Jun 15, 2022
1 parent a7036b8 commit 7b1344b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
35 changes: 21 additions & 14 deletions src/CMakeLists.txt
Expand Up @@ -7,6 +7,9 @@ if (WIN32)
option(OGREDEPS_BUILD_NVIDIA_NVAPI "Build NVIDIA NVAPI dependency" TRUE)
option(OGREDEPS_BUILD_SDL2 "Build SDL2 dependency" TRUE)
endif ()
if (APPLE AND NOT OGRE_BUILD_PLATFORM_APPLE_IOS)
option(OGREDEPS_BUILD_SDL2 "Build SDL2 dependency" TRUE)
endif ()
option(OGREDEPS_BUILD_FREEIMAGE "Build FreeImage dependency" TRUE)
option(OGREDEPS_BUILD_FREETYPE "Build FreeType dependency" TRUE)
option(OGREDEPS_BUILD_ZLIB "Build zlib dependency" TRUE)
Expand Down Expand Up @@ -184,6 +187,8 @@ if (OGREDEPS_BUILD_SDL2)
list(APPEND SDL2_CMAKE_ARGS "-DDIRECTX=0")
set(SDL2_BIN_NAME "libSDL2.dll")
# set(SDL2_LIB_NAME "libSDL2.a")
elseif (APPLE AND NOT OGRE_BUILD_PLATFORM_APPLE_IOS)
set(SDL2_BIN_NAME "SDL2.dylib")
else ()
set(SDL2_BIN_NAME "SDL2.dll")
set(SDL2_LIB_NAME "SDL2.lib")
Expand All @@ -202,21 +207,23 @@ if (OGREDEPS_BUILD_SDL2)
--config Release
BUILD_ALWAYS 1
)
ExternalProject_Add_Step(
SDL2
MoveInstallFiles
COMMENT "Move SDL2 install files into the Release and Debug folders."
DEPENDEES install
WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}
# For MinGW, the Release & Debug directories may not yet exist.
COMMAND ${CMAKE_COMMAND} -E make_directory bin/Release
COMMAND ${CMAKE_COMMAND} -E make_directory bin/RelWithDebInfo
COMMAND ${CMAKE_COMMAND} -E make_directory bin/Debug
COMMAND ${CMAKE_COMMAND} -E rename bin/${SDL2_BIN_NAME} bin/Debug/${SDL2_BIN_NAME}
COMMAND ${CMAKE_COMMAND} -E copy bin/Debug/${SDL2_BIN_NAME} bin/Release/${SDL2_BIN_NAME}
COMMAND ${CMAKE_COMMAND} -E copy bin/Debug/${SDL2_BIN_NAME} bin/RelWithDebInfo/${SDL2_BIN_NAME}
LOG 1
if (NOT APPLE AND NOT OGRE_BUILD_PLATFORM_APPLE_IOS)
ExternalProject_Add_Step(
SDL2
MoveInstallFiles
COMMENT "Move SDL2 install files into the Release and Debug folders."
DEPENDEES install
WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}
# For MinGW, the Release & Debug directories may not yet exist.
COMMAND ${CMAKE_COMMAND} -E make_directory bin/Release
COMMAND ${CMAKE_COMMAND} -E make_directory bin/RelWithDebInfo
COMMAND ${CMAKE_COMMAND} -E make_directory bin/Debug
COMMAND ${CMAKE_COMMAND} -E rename bin/${SDL2_BIN_NAME} bin/Debug/${SDL2_BIN_NAME}
COMMAND ${CMAKE_COMMAND} -E copy bin/Debug/${SDL2_BIN_NAME} bin/Release/${SDL2_BIN_NAME}
COMMAND ${CMAKE_COMMAND} -E copy bin/Debug/${SDL2_BIN_NAME} bin/RelWithDebInfo/${SDL2_BIN_NAME}
LOG 1
)
endif ()
endif ()
if (OGREDEPS_BUILD_SHADERC)
if( WIN32 )
Expand Down
2 changes: 1 addition & 1 deletion src/FreeImage/CMakeLists.txt
Expand Up @@ -769,7 +769,7 @@ else()
)
endif()

if( CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" OR OGRE_BUILD_PLATFORM_APPLE_IOS )
if( CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" OR OGRE_BUILD_PLATFORM_APPLE_IOS )
set( FreeImage_SOURCES ${FreeImage_SOURCES}
Source/LibPNG/arm/arm_init.c
Source/LibPNG/arm/filter_neon_intrinsics.c
Expand Down

0 comments on commit 7b1344b

Please sign in to comment.