2024-06-16 17:49:42 +02:00
|
|
|
# When enabling SDL2 by default on macOS, don't forget to change
|
|
|
|
# "NSHighResolutionCapable" to true in "Info.plist".
|
2024-03-25 23:06:51 +01:00
|
|
|
if(NOT APPLE)
|
2024-03-21 20:13:15 +01:00
|
|
|
set(DEFAULT_SDL2 ON)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
option(USE_SDL2 "Use the SDL2 backend" ${DEFAULT_SDL2})
|
|
|
|
|
|
|
|
# Compiler flags
|
|
|
|
|
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
|
|
add_definitions(-D_DEBUG)
|
|
|
|
endif()
|
|
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
|
|
|
|
|
|
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "-g")
|
|
|
|
|
|
|
|
add_compile_options(-Wall -pipe -fno-exceptions)
|
|
|
|
|
|
|
|
# Enable SSE for floating point math on 32-bit x86 by default
|
|
|
|
# reasoning see minetest issue #11810 and https://gcc.gnu.org/wiki/FloatingPointMath
|
|
|
|
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
|
|
|
include(CheckCXXSourceCompiles)
|
|
|
|
check_cxx_source_compiles("#ifndef __i686__\n#error\n#endif\nint main(){}" IS_I686)
|
|
|
|
if(IS_I686)
|
|
|
|
message(STATUS "Detected Intel x86: using SSE instead of x87 FPU")
|
|
|
|
add_compile_options(-mfpmath=sse -msse)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
elseif(MSVC)
|
|
|
|
string(APPEND CMAKE_CXX_STANDARD_LIBRARIES " msvcrt.lib") # ???? fuck off
|
|
|
|
|
2024-05-17 13:27:31 +02:00
|
|
|
add_compile_options(/Zl)
|
2024-03-21 20:13:15 +01:00
|
|
|
|
|
|
|
# Enable SSE for floating point math on 32-bit x86 by default
|
|
|
|
# reasoning see minetest issue #11810 and https://gcc.gnu.org/wiki/FloatingPointMath
|
|
|
|
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
|
|
|
add_compile_options(/arch:SSE)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Platform-independent configuration (hard-coded currently)
|
|
|
|
add_definitions(
|
|
|
|
-DIRR_ENABLE_BUILTIN_FONT
|
|
|
|
)
|
|
|
|
|
|
|
|
# Platform-specific configuration
|
|
|
|
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
|
|
|
|
set(SOLARIS TRUE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Device
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
add_definitions(-D_IRR_WINDOWS_ -D_IRR_WINDOWS_API_)
|
|
|
|
set(DEVICE "WINDOWS")
|
|
|
|
elseif(APPLE)
|
|
|
|
add_definitions(-D_IRR_OSX_PLATFORM_)
|
|
|
|
set(DEVICE "OSX")
|
|
|
|
elseif(ANDROID)
|
|
|
|
add_definitions(-D_IRR_ANDROID_PLATFORM_)
|
2024-03-25 23:06:51 +01:00
|
|
|
if(NOT USE_SDL2)
|
|
|
|
message(FATAL_ERROR "The Android build requires SDL2")
|
2024-03-21 20:13:15 +01:00
|
|
|
endif()
|
|
|
|
elseif(EMSCRIPTEN)
|
|
|
|
add_definitions(-D_IRR_EMSCRIPTEN_PLATFORM_ -D_IRR_COMPILE_WITH_EGL_MANAGER_)
|
|
|
|
set(LINUX_PLATFORM TRUE)
|
|
|
|
set(DEVICE "SDL")
|
|
|
|
elseif(SOLARIS)
|
|
|
|
add_definitions(-D_IRR_SOLARIS_PLATFORM_ -D_IRR_POSIX_API_)
|
|
|
|
set(DEVICE "X11")
|
|
|
|
else()
|
|
|
|
add_definitions(-D_IRR_POSIX_API_)
|
|
|
|
set(LINUX_PLATFORM TRUE)
|
|
|
|
set(DEVICE "X11")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(LINUX_PLATFORM)
|
|
|
|
add_definitions(-D_IRR_LINUX_PLATFORM_)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(USE_SDL2)
|
|
|
|
set(DEVICE "SDL")
|
|
|
|
elseif(DEVICE STREQUAL "SDL")
|
|
|
|
message(FATAL_ERROR "SDL was used but not enabled?!")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_definitions("-D_IRR_COMPILE_WITH_${DEVICE}_DEVICE_")
|
|
|
|
|
|
|
|
# X11
|
|
|
|
|
|
|
|
if(DEVICE STREQUAL "X11")
|
|
|
|
option(USE_X11 "Use X11" TRUE)
|
|
|
|
else()
|
|
|
|
set(USE_X11 FALSE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(LINUX_PLATFORM AND USE_X11)
|
|
|
|
option(USE_XINPUT2 "Use XInput2" TRUE)
|
|
|
|
option(USE_XCURSOR "Use XCursor" FALSE)
|
|
|
|
else()
|
|
|
|
set(USE_XINPUT2 FALSE)
|
|
|
|
set(USE_XCURSOR FALSE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Joystick
|
|
|
|
|
|
|
|
if(NOT (BSD OR SOLARIS OR EMSCRIPTEN))
|
|
|
|
add_definitions(-D_IRR_COMPILE_WITH_JOYSTICK_EVENTS_)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# OpenGL
|
|
|
|
|
|
|
|
if(USE_SDL2)
|
2024-03-25 23:06:51 +01:00
|
|
|
if(NOT ANDROID)
|
|
|
|
set(DEFAULT_OPENGL3 TRUE)
|
|
|
|
endif()
|
|
|
|
option(ENABLE_OPENGL3 "Enable OpenGL 3+" ${DEFAULT_OPENGL3})
|
2024-03-21 20:13:15 +01:00
|
|
|
else()
|
|
|
|
set(ENABLE_OPENGL3 FALSE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ANDROID OR EMSCRIPTEN)
|
|
|
|
set(ENABLE_OPENGL FALSE)
|
|
|
|
else()
|
|
|
|
option(ENABLE_OPENGL "Enable OpenGL" TRUE)
|
|
|
|
endif()
|
|
|
|
|
2024-03-25 23:06:51 +01:00
|
|
|
if(USE_SDL2 OR EMSCRIPTEN OR APPLE)
|
2024-03-21 20:13:15 +01:00
|
|
|
set(ENABLE_GLES1 FALSE)
|
|
|
|
else()
|
2024-03-25 23:06:51 +01:00
|
|
|
option(ENABLE_GLES1 "Enable OpenGL ES" FALSE)
|
2024-03-21 20:13:15 +01:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(APPLE)
|
|
|
|
set(ENABLE_GLES2 FALSE)
|
|
|
|
set(ENABLE_WEBGL1 FALSE)
|
|
|
|
else()
|
|
|
|
if(ANDROID OR EMSCRIPTEN)
|
|
|
|
set(DEFAULT_GLES2 TRUE)
|
|
|
|
endif()
|
|
|
|
if(EMSCRIPTEN)
|
|
|
|
set(DEFAULT_WEBGL1 TRUE)
|
|
|
|
endif()
|
|
|
|
option(ENABLE_GLES2 "Enable OpenGL ES 2+" ${DEFAULT_GLES2})
|
|
|
|
#option(ENABLE_WEBGL1 "Enable WebGL (requires GLES2)" ${DEFAULT_WEBGL1})
|
|
|
|
set(ENABLE_WEBGL1 FALSE) # not working currently
|
|
|
|
if(ENABLE_WEBGL1)
|
|
|
|
set(ENABLE_GLES2 TRUE)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_OPENGL)
|
|
|
|
add_definitions(-D_IRR_COMPILE_WITH_OPENGL_)
|
|
|
|
set(OPENGL_DIRECT_LINK TRUE) # driver relies on this
|
|
|
|
if(DEVICE STREQUAL "WINDOWS")
|
|
|
|
add_definitions(-D_IRR_COMPILE_WITH_WGL_MANAGER_)
|
|
|
|
elseif(DEVICE STREQUAL "X11")
|
|
|
|
add_definitions(-D_IRR_COMPILE_WITH_GLX_MANAGER_)
|
|
|
|
elseif(DEVICE STREQUAL "OSX")
|
|
|
|
add_definitions(-D_IRR_COMPILE_WITH_NSOGL_MANAGER_)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_OPENGL3)
|
|
|
|
if (NOT USE_SDL2)
|
|
|
|
message(FATAL_ERROR "OpenGL 3 driver requires SDL2")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_GLES1)
|
|
|
|
add_definitions(-D_IRR_COMPILE_WITH_OGLES1_)
|
|
|
|
set(OPENGLES_DIRECT_LINK TRUE)
|
2024-03-25 23:06:51 +01:00
|
|
|
if(DEVICE MATCHES "^(WINDOWS|X11)$")
|
2024-03-21 20:13:15 +01:00
|
|
|
add_definitions(-D_IRR_COMPILE_WITH_EGL_MANAGER_)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_GLES2)
|
|
|
|
add_definitions(-D_IRR_COMPILE_WITH_OGLES2_)
|
2024-03-25 23:06:51 +01:00
|
|
|
if(DEVICE MATCHES "^(WINDOWS|X11)$" OR EMSCRIPTEN)
|
2024-03-21 20:13:15 +01:00
|
|
|
add_definitions(-D_IRR_COMPILE_WITH_EGL_MANAGER_)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_WEBGL1)
|
|
|
|
add_definitions(-D_IRR_COMPILE_WITH_WEBGL1_)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Misc
|
|
|
|
|
|
|
|
include(TestBigEndian)
|
|
|
|
TEST_BIG_ENDIAN(BIG_ENDIAN)
|
|
|
|
if(BIG_ENDIAN)
|
|
|
|
add_definitions(-D__BIG_ENDIAN__)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Configuration report
|
|
|
|
|
|
|
|
message(STATUS "Device: ${DEVICE}")
|
|
|
|
message(STATUS "OpenGL: ${ENABLE_OPENGL}")
|
|
|
|
message(STATUS "OpenGL 3: ${ENABLE_OPENGL3}")
|
|
|
|
message(STATUS "OpenGL ES: ${ENABLE_GLES1}")
|
|
|
|
if (ENABLE_GLES2)
|
|
|
|
message(STATUS "OpenGL ES 2: ON (unified)")
|
|
|
|
else()
|
|
|
|
message(STATUS "OpenGL ES 2: OFF")
|
|
|
|
endif()
|
|
|
|
#message(STATUS "WebGL: ${ENABLE_WEBGL1}")
|
|
|
|
|
|
|
|
# Required libs
|
|
|
|
|
2024-03-27 12:00:39 +01:00
|
|
|
include(CheckCXXSourceCompiles)
|
|
|
|
|
2024-03-21 20:13:15 +01:00
|
|
|
find_package(ZLIB REQUIRED)
|
|
|
|
find_package(JPEG REQUIRED)
|
|
|
|
find_package(PNG REQUIRED)
|
|
|
|
|
|
|
|
if(ENABLE_GLES1)
|
|
|
|
# only tested on Android, probably works on Linux (is this needed anywhere else?)
|
|
|
|
find_library(OPENGLES_LIBRARY NAMES GLESv1_CM REQUIRED)
|
|
|
|
find_library(EGL_LIBRARY NAMES EGL REQUIRED)
|
|
|
|
|
|
|
|
message(STATUS "Found OpenGLES: ${OPENGLES_LIBRARY}")
|
|
|
|
endif()
|
|
|
|
if(ENABLE_GLES2)
|
|
|
|
find_package(OpenGLES2 REQUIRED)
|
|
|
|
endif()
|
2024-03-25 23:06:51 +01:00
|
|
|
if(ENABLE_OPENGL)
|
2024-03-21 20:13:15 +01:00
|
|
|
find_package(OpenGL REQUIRED)
|
|
|
|
endif()
|
|
|
|
if(USE_SDL2)
|
2024-03-25 23:06:51 +01:00
|
|
|
if(NOT ANDROID)
|
|
|
|
find_package(SDL2 REQUIRED)
|
|
|
|
else()
|
|
|
|
# provided by MinetestAndroidLibs.cmake
|
|
|
|
endif()
|
2024-03-21 20:13:15 +01:00
|
|
|
message(STATUS "Found SDL2: ${SDL2_LIBRARIES}")
|
|
|
|
|
|
|
|
# unfortunately older SDL does not provide its version to cmake, so check header.
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES ${SDL2_INCLUDE_DIRS})
|
|
|
|
unset(CHECK_SDL_VERSION CACHE)
|
|
|
|
check_cxx_source_compiles("#include <SDL_version.h>\n\
|
|
|
|
#if !SDL_VERSION_ATLEAST(2, 0, 10)\n\
|
|
|
|
#error\n\
|
|
|
|
#endif\n\
|
|
|
|
int main() {}" CHECK_SDL_VERSION)
|
|
|
|
if(NOT CHECK_SDL_VERSION)
|
|
|
|
message(FATAL_ERROR "SDL2 is too old, required is at least 2.0.10!")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# ...no target either.
|
|
|
|
if(NOT TARGET SDL2::SDL2)
|
|
|
|
add_library(SDL2::SDL2 SHARED IMPORTED)
|
|
|
|
set_target_properties(SDL2::SDL2 PROPERTIES
|
|
|
|
IMPORTED_LOCATION "${SDL2_LIBRARIES}")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# More special config
|
|
|
|
|
|
|
|
if(ENABLE_OPENGL AND DEVICE STREQUAL "SDL")
|
|
|
|
# The legacy GL driver requires some symbols from GL 4.5 to compile,
|
|
|
|
# which SDL only provides since 2.26.0 (Nov 2022).
|
|
|
|
# We have a fallback in case this isn't satisfied so test for it.
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES ${SDL2_INCLUDE_DIRS})
|
|
|
|
unset(CHECK_GL_VERSION_4_5 CACHE)
|
|
|
|
check_cxx_source_compiles("#include <SDL_opengl.h>\n\
|
|
|
|
#ifndef GL_VERSION_4_5\n\
|
|
|
|
#error\n\
|
|
|
|
#endif\n\
|
|
|
|
int main() {}" CHECK_GL_VERSION_4_5)
|
|
|
|
if(CHECK_GL_VERSION_4_5)
|
|
|
|
add_definitions(-DIRR_PREFER_SDL_GL_HEADER)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Platform-specific libs
|
|
|
|
|
|
|
|
if(ANDROID)
|
|
|
|
enable_language(C)
|
|
|
|
elseif(APPLE)
|
|
|
|
find_library(COCOA_LIB Cocoa REQUIRED)
|
|
|
|
find_library(IOKIT_LIB IOKit REQUIRED)
|
|
|
|
|
|
|
|
add_definitions(-DGL_SILENCE_DEPRECATION)
|
|
|
|
elseif(NOT USE_SDL2)
|
|
|
|
# Unix probably
|
|
|
|
find_package(X11 REQUIRED)
|
|
|
|
if(USE_XINPUT2 AND NOT X11_Xi_FOUND)
|
|
|
|
message(FATAL_ERROR "XInput not found")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(link_includes
|
|
|
|
"${PROJECT_SOURCE_DIR}/include"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}"
|
|
|
|
|
|
|
|
"${ZLIB_INCLUDE_DIR}"
|
|
|
|
"${JPEG_INCLUDE_DIR}"
|
|
|
|
"${PNG_INCLUDE_DIR}"
|
|
|
|
"$<$<BOOL:${USE_SDL2}>:${SDL2_INCLUDE_DIRS}>"
|
|
|
|
|
|
|
|
${OPENGL_INCLUDE_DIR}
|
|
|
|
${OPENGLES2_INCLUDE_DIR}
|
|
|
|
${EGL_INCLUDE_DIR}
|
|
|
|
|
|
|
|
"$<$<BOOL:${USE_X11}>:${X11_INCLUDE_DIR}>"
|
|
|
|
)
|
|
|
|
|
|
|
|
# Source files
|
|
|
|
|
|
|
|
set(IRRMESHLOADER
|
|
|
|
CB3DMeshFileLoader.cpp
|
|
|
|
COBJMeshFileLoader.cpp
|
|
|
|
CXMeshFileLoader.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
add_library(IRRMESHOBJ OBJECT
|
|
|
|
CSkinnedMesh.cpp
|
|
|
|
CBoneSceneNode.cpp
|
|
|
|
CMeshSceneNode.cpp
|
|
|
|
CAnimatedMeshSceneNode.cpp
|
|
|
|
${IRRMESHLOADER}
|
|
|
|
)
|
|
|
|
|
|
|
|
add_library(IRROBJ OBJECT
|
|
|
|
CBillboardSceneNode.cpp
|
|
|
|
CCameraSceneNode.cpp
|
|
|
|
CDummyTransformationSceneNode.cpp
|
|
|
|
CEmptySceneNode.cpp
|
|
|
|
CMeshManipulator.cpp
|
|
|
|
CSceneCollisionManager.cpp
|
|
|
|
CSceneManager.cpp
|
|
|
|
CMeshCache.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
set(IRRDRVROBJ
|
|
|
|
CNullDriver.cpp
|
|
|
|
CGLXManager.cpp
|
|
|
|
CWGLManager.cpp
|
|
|
|
CEGLManager.cpp
|
|
|
|
CSDLManager.cpp
|
|
|
|
mt_opengl_loader.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
# the two legacy drivers
|
|
|
|
|
|
|
|
if(ENABLE_OPENGL)
|
|
|
|
set(IRRDRVROBJ
|
|
|
|
${IRRDRVROBJ}
|
|
|
|
COpenGLCacheHandler.cpp
|
|
|
|
COpenGLDriver.cpp
|
|
|
|
COpenGLSLMaterialRenderer.cpp
|
|
|
|
COpenGLExtensionHandler.cpp
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_GLES1)
|
|
|
|
set(IRRDRVROBJ
|
|
|
|
${IRRDRVROBJ}
|
|
|
|
COGLESDriver.cpp
|
|
|
|
COGLESExtensionHandler.cpp
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# the unified drivers
|
|
|
|
|
|
|
|
if(ENABLE_OPENGL3 OR ENABLE_GLES2)
|
|
|
|
set(IRRDRVROBJ
|
|
|
|
${IRRDRVROBJ}
|
|
|
|
OpenGL/Driver.cpp
|
|
|
|
OpenGL/ExtensionHandler.cpp
|
|
|
|
OpenGL/FixedPipelineRenderer.cpp
|
|
|
|
OpenGL/MaterialRenderer.cpp
|
|
|
|
OpenGL/Renderer2D.cpp
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_OPENGL3)
|
|
|
|
set(IRRDRVROBJ
|
|
|
|
${IRRDRVROBJ}
|
|
|
|
OpenGL3/Driver.cpp
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_GLES2)
|
|
|
|
set(IRRDRVROBJ
|
|
|
|
${IRRDRVROBJ}
|
|
|
|
OpenGLES2/Driver.cpp
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(IRRIMAGEOBJ
|
|
|
|
CColorConverter.cpp
|
|
|
|
CImage.cpp
|
|
|
|
CImageLoaderBMP.cpp
|
|
|
|
CImageLoaderJPG.cpp
|
|
|
|
CImageLoaderPNG.cpp
|
|
|
|
CImageLoaderTGA.cpp
|
|
|
|
CImageWriterJPG.cpp
|
|
|
|
CImageWriterPNG.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
add_library(IRRVIDEOOBJ OBJECT
|
|
|
|
CFPSCounter.cpp
|
|
|
|
${IRRDRVROBJ}
|
|
|
|
${IRRIMAGEOBJ}
|
|
|
|
)
|
|
|
|
|
|
|
|
add_library(IRRIOOBJ OBJECT
|
|
|
|
CFileList.cpp
|
|
|
|
CFileSystem.cpp
|
|
|
|
CLimitReadFile.cpp
|
|
|
|
CMemoryFile.cpp
|
|
|
|
CReadFile.cpp
|
|
|
|
CWriteFile.cpp
|
|
|
|
CZipReader.cpp
|
|
|
|
CAttributes.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
add_library(IRROTHEROBJ OBJECT
|
|
|
|
CIrrDeviceSDL.cpp
|
|
|
|
CIrrDeviceLinux.cpp
|
|
|
|
CIrrDeviceStub.cpp
|
|
|
|
CIrrDeviceWin32.cpp
|
|
|
|
CLogger.cpp
|
|
|
|
COSOperator.cpp
|
|
|
|
Irrlicht.cpp
|
|
|
|
os.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
if(ENABLE_OPENGL3)
|
|
|
|
target_compile_definitions(IRROTHEROBJ PRIVATE ENABLE_OPENGL3)
|
|
|
|
endif()
|
|
|
|
|
2024-03-25 23:06:51 +01:00
|
|
|
if(APPLE)
|
2024-03-21 20:13:15 +01:00
|
|
|
# Build all IRROTHEROBJ sources as objc++, including the .cpp's
|
|
|
|
set_target_properties(IRROTHEROBJ PROPERTIES COMPILE_OPTIONS "-xobjective-c++")
|
|
|
|
target_sources(IRROTHEROBJ PRIVATE
|
|
|
|
CIrrDeviceOSX.mm
|
|
|
|
CNSOGLManager.mm
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(USE_X11)
|
|
|
|
target_compile_definitions(IRROTHEROBJ PRIVATE _IRR_COMPILE_WITH_X11_)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(USE_XINPUT2)
|
|
|
|
target_compile_definitions(IRROTHEROBJ PRIVATE _IRR_LINUX_X11_XINPUT2_)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(USE_XCURSOR)
|
|
|
|
target_compile_definitions(IRROTHEROBJ PRIVATE _IRR_LINUX_XCURSOR_)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_library(IRRGUIOBJ OBJECT
|
|
|
|
CGUIButton.cpp
|
|
|
|
CGUICheckBox.cpp
|
|
|
|
CGUIComboBox.cpp
|
|
|
|
CGUIEditBox.cpp
|
|
|
|
CGUIEnvironment.cpp
|
|
|
|
CGUIFileOpenDialog.cpp
|
|
|
|
CGUIFont.cpp
|
|
|
|
CGUIImage.cpp
|
|
|
|
CGUIListBox.cpp
|
|
|
|
CGUIScrollBar.cpp
|
|
|
|
CGUISkin.cpp
|
|
|
|
CGUIStaticText.cpp
|
|
|
|
CGUITabControl.cpp
|
|
|
|
CGUISpriteBank.cpp
|
|
|
|
CGUIImageList.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
# Library
|
|
|
|
|
2024-04-06 12:53:24 +02:00
|
|
|
add_library(IrrlichtMt STATIC)
|
2024-03-21 20:13:15 +01:00
|
|
|
foreach(object_lib
|
|
|
|
IRRMESHOBJ IRROBJ IRRVIDEOOBJ
|
|
|
|
IRRIOOBJ IRROTHEROBJ IRRGUIOBJ)
|
|
|
|
# Set include directories for object library compilation
|
|
|
|
target_include_directories(${object_lib} PRIVATE ${link_includes})
|
|
|
|
# Add objects from object library to main library
|
|
|
|
target_sources(IrrlichtMt PRIVATE $<TARGET_OBJECTS:${object_lib}>)
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
# Alias target provides add_submodule compatibility
|
|
|
|
add_library(IrrlichtMt::IrrlichtMt ALIAS IrrlichtMt)
|
|
|
|
|
|
|
|
target_include_directories(IrrlichtMt
|
|
|
|
PUBLIC
|
|
|
|
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/>"
|
|
|
|
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
|
|
|
|
PRIVATE
|
|
|
|
${link_includes}
|
|
|
|
)
|
|
|
|
|
|
|
|
# this needs to be here and not in a variable (like link_includes) due to issues
|
|
|
|
# with the generator expressions on at least CMake 3.22, but not 3.28 or later
|
|
|
|
target_link_libraries(IrrlichtMt PRIVATE
|
|
|
|
${ZLIB_LIBRARY}
|
|
|
|
${JPEG_LIBRARY}
|
|
|
|
${PNG_LIBRARY}
|
|
|
|
"$<$<BOOL:${USE_SDL2}>:SDL2::SDL2>"
|
|
|
|
|
|
|
|
"$<$<BOOL:${OPENGL_DIRECT_LINK}>:${OPENGL_LIBRARIES}>"
|
|
|
|
"$<$<BOOL:${OPENGLES_DIRECT_LINK}>:${OPENGLES_LIBRARY}>"
|
|
|
|
${EGL_LIBRARY}
|
|
|
|
|
2024-03-25 23:06:51 +01:00
|
|
|
# incl. transitive SDL2 dependencies for static linking
|
|
|
|
"$<$<PLATFORM_ID:Android>:-landroid -llog -lGLESv2 -lGLESv1_CM -lOpenSLES>"
|
2024-03-21 20:13:15 +01:00
|
|
|
${COCOA_LIB}
|
|
|
|
${IOKIT_LIB}
|
|
|
|
"$<$<PLATFORM_ID:Windows>:gdi32>"
|
|
|
|
"$<$<PLATFORM_ID:Windows>:winmm>"
|
|
|
|
"$<$<BOOL:${USE_X11}>:${X11_X11_LIB}>"
|
|
|
|
"$<$<BOOL:${USE_X11}>:${X11_Xi_LIB}>"
|
|
|
|
)
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
target_compile_definitions(IrrlichtMt INTERFACE _IRR_WINDOWS_API_) # used in _IRR_DEBUG_BREAK_IF definition in a public header
|
|
|
|
endif()
|
|
|
|
if(APPLE OR ANDROID OR EMSCRIPTEN)
|
|
|
|
target_compile_definitions(IrrlichtMt PUBLIC IRR_MOBILE_PATHS)
|
|
|
|
endif()
|