2021-07-16 23:11:59 +02:00
|
|
|
option(BUILD_SHARED_LIBS "Build shared library" TRUE)
|
2023-02-19 20:44:02 +01:00
|
|
|
option(USE_SDL2 "Use the SDL2 backend" FALSE)
|
2021-07-16 23:11:59 +02:00
|
|
|
|
|
|
|
# Compiler flags
|
|
|
|
|
|
|
|
add_definitions(-DIRRLICHT_EXPORTS)
|
2023-02-19 22:16:55 +01:00
|
|
|
if(BUILD_SHARED_LIBS)
|
|
|
|
if(WIN32)
|
2023-03-06 15:32:03 +01:00
|
|
|
set(API_IMPORT "__declspec(dllimport)")
|
|
|
|
set(API_EXPORT "__declspec(dllexport)")
|
2023-02-19 22:16:55 +01:00
|
|
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$")
|
2023-03-06 15:32:03 +01:00
|
|
|
set(API_EXPORT "__attribute__ ((visibility(\"default\")))") # only necessary if default visibility is set to hidden
|
2023-02-19 22:16:55 +01:00
|
|
|
endif()
|
|
|
|
else()
|
2021-07-16 23:11:59 +02:00
|
|
|
add_definitions(-D_IRR_STATIC_LIB_)
|
|
|
|
endif()
|
2023-03-06 15:32:03 +01:00
|
|
|
add_definitions("-DIRRLICHT_API=${API_EXPORT}")
|
|
|
|
|
2021-03-06 21:23:00 +01:00
|
|
|
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 -fno-rtti)
|
2021-12-11 12:43:23 +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)
|
|
|
|
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()
|
|
|
|
|
2021-03-06 21:23:00 +01:00
|
|
|
elseif(MSVC)
|
2021-03-26 16:48:28 +01:00
|
|
|
string(APPEND CMAKE_CXX_STANDARD_LIBRARIES " msvcrt.lib") # ???? fuck off
|
2021-03-06 21:23:00 +01:00
|
|
|
|
2021-03-26 16:48:28 +01:00
|
|
|
add_compile_options(/GR- /Zl)
|
2021-12-11 12:43:23 +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()
|
2023-10-05 17:55:55 +02:00
|
|
|
|
|
|
|
add_compile_options(/D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING)
|
2021-03-06 21:23:00 +01:00
|
|
|
endif()
|
|
|
|
|
2022-07-21 19:49:36 +02:00
|
|
|
# Sanity-check version
|
|
|
|
|
|
|
|
include(CheckCXXSourceCompiles)
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES ${PROJECT_SOURCE_DIR}/include)
|
|
|
|
unset(REVISION_SANITY_CHECK CACHE)
|
|
|
|
check_cxx_source_compiles("#include <IrrCompileConfig.h>\n\
|
|
|
|
#if IRRLICHT_VERSION_MT_REVISION != ${IRRLICHTMT_REVISION}\n\
|
|
|
|
#error\n\
|
|
|
|
#endif\n\
|
|
|
|
int main() {}" REVISION_SANITY_CHECK)
|
|
|
|
if(NOT REVISION_SANITY_CHECK)
|
|
|
|
message(FATAL_ERROR "IrrlichtMt revision number mismatches between CMake and headers.")
|
|
|
|
endif()
|
|
|
|
|
2023-02-19 22:55:45 +01:00
|
|
|
# Platform-independent configuration (hard-coded currently)
|
|
|
|
add_definitions(
|
|
|
|
-DIRR_ENABLE_BUILTIN_FONT
|
2023-04-06 11:58:18 +02:00
|
|
|
)
|
2023-02-19 22:55:45 +01:00
|
|
|
|
2023-02-19 20:44:02 +01:00
|
|
|
# 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")
|
2023-03-14 16:48:55 +01:00
|
|
|
elseif(APPLE)
|
2023-02-19 20:44:02 +01:00
|
|
|
add_definitions(-D_IRR_OSX_PLATFORM_)
|
|
|
|
set(DEVICE "OSX")
|
|
|
|
elseif(ANDROID)
|
2023-10-09 09:08:00 +02:00
|
|
|
add_definitions(-D_IRR_ANDROID_PLATFORM_)
|
2023-02-19 20:44:02 +01:00
|
|
|
if(USE_SDL2)
|
2023-04-06 11:58:18 +02:00
|
|
|
message(FATAL_ERROR "SDL2 device is not (yet) supported on Android")
|
2023-02-19 20:44:02 +01:00
|
|
|
endif()
|
2023-06-06 15:45:12 +02:00
|
|
|
set(DEVICE "ANDROID")
|
2023-02-19 20:44:02 +01:00
|
|
|
elseif(EMSCRIPTEN)
|
2023-10-04 23:29:59 +02:00
|
|
|
add_definitions(-D_IRR_EMSCRIPTEN_PLATFORM_ -D_IRR_COMPILE_WITH_EGL_MANAGER_)
|
2023-02-19 20:44:02 +01:00
|
|
|
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()
|
|
|
|
|
2023-03-06 12:21:58 +01:00
|
|
|
if(LINUX_PLATFORM)
|
|
|
|
add_definitions(-D_IRR_LINUX_PLATFORM_)
|
|
|
|
endif()
|
|
|
|
|
2023-02-19 20:44:02 +01:00
|
|
|
if(USE_SDL2)
|
|
|
|
set(DEVICE "SDL")
|
2023-04-06 11:58:18 +02:00
|
|
|
elseif(DEVICE STREQUAL "SDL")
|
|
|
|
message(FATAL_ERROR "SDL was used but not enabled?!")
|
2023-02-19 20:44:02 +01:00
|
|
|
endif()
|
|
|
|
|
2023-03-06 12:21:58 +01:00
|
|
|
add_definitions("-D_IRR_COMPILE_WITH_${DEVICE}_DEVICE_")
|
2023-02-19 20:44:02 +01:00
|
|
|
|
2023-03-06 12:21:58 +01:00
|
|
|
# X11
|
|
|
|
|
|
|
|
if(DEVICE STREQUAL "X11")
|
|
|
|
option(USE_X11 "Use X11" TRUE)
|
|
|
|
else()
|
|
|
|
set(USE_X11 FALSE)
|
2023-02-19 20:44:02 +01:00
|
|
|
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
|
|
|
|
|
2023-07-02 20:35:11 +02:00
|
|
|
if(USE_SDL2)
|
2023-07-02 20:35:58 +02:00
|
|
|
option(ENABLE_OPENGL3 "Enable OpenGL 3+" TRUE)
|
2023-07-02 20:35:11 +02:00
|
|
|
else()
|
|
|
|
set(ENABLE_OPENGL3 FALSE)
|
|
|
|
endif()
|
2023-02-27 14:47:30 +01:00
|
|
|
|
2023-03-14 16:48:55 +01:00
|
|
|
if(ANDROID OR EMSCRIPTEN)
|
2023-02-19 20:44:02 +01:00
|
|
|
set(ENABLE_OPENGL FALSE)
|
|
|
|
else()
|
|
|
|
option(ENABLE_OPENGL "Enable OpenGL" TRUE)
|
|
|
|
endif()
|
|
|
|
|
2023-03-14 16:48:55 +01:00
|
|
|
if(EMSCRIPTEN OR APPLE)
|
2023-02-19 20:44:02 +01:00
|
|
|
set(ENABLE_GLES1 FALSE)
|
|
|
|
else()
|
2023-03-14 16:48:55 +01:00
|
|
|
if(ANDROID)
|
2023-02-19 20:44:02 +01:00
|
|
|
set(DEFAULT_GLES1 TRUE)
|
|
|
|
endif()
|
|
|
|
option(ENABLE_GLES1 "Enable OpenGL ES" ${DEFAULT_GLES1})
|
|
|
|
endif()
|
|
|
|
|
2023-03-14 16:48:55 +01:00
|
|
|
if(APPLE)
|
2023-02-19 20:44:02 +01:00
|
|
|
set(ENABLE_GLES2 FALSE)
|
|
|
|
set(ENABLE_WEBGL1 FALSE)
|
|
|
|
else()
|
2023-03-14 16:48:55 +01:00
|
|
|
if(ANDROID OR EMSCRIPTEN)
|
2023-02-19 20:44:02 +01:00
|
|
|
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})
|
|
|
|
if(ENABLE_WEBGL1)
|
|
|
|
set(ENABLE_GLES2 TRUE)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_OPENGL)
|
|
|
|
add_definitions(-D_IRR_COMPILE_WITH_OPENGL_)
|
|
|
|
if(DEVICE STREQUAL "WINDOWS")
|
2023-10-04 23:29:59 +02:00
|
|
|
add_definitions(-D_IRR_COMPILE_WITH_WGL_MANAGER_ -D_IRR_OPENGL_USE_EXTPOINTER_)
|
2023-02-19 20:44:02 +01:00
|
|
|
elseif(DEVICE STREQUAL "X11")
|
|
|
|
add_definitions(-D_IRR_COMPILE_WITH_GLX_MANAGER_ -D_IRR_OPENGL_USE_EXTPOINTER_)
|
|
|
|
elseif(DEVICE STREQUAL "OSX")
|
|
|
|
add_definitions(-D_IRR_COMPILE_WITH_NSOGL_MANAGER_)
|
|
|
|
elseif(DEVICE STREQUAL "SDL")
|
|
|
|
add_definitions(-D_IRR_OPENGL_USE_EXTPOINTER_)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2023-03-03 18:29:36 +01:00
|
|
|
if(ENABLE_OPENGL3)
|
|
|
|
if (NOT USE_SDL2)
|
2023-04-06 11:58:18 +02:00
|
|
|
message(FATAL_ERROR "OpenGL 3 driver requires SDL2")
|
2023-03-03 18:29:36 +01:00
|
|
|
endif()
|
|
|
|
set(USE_SDLGL ON)
|
|
|
|
set(USE_SDLGL3 ON)
|
|
|
|
endif()
|
|
|
|
|
2023-02-19 20:44:02 +01:00
|
|
|
if(ENABLE_GLES1)
|
2023-03-13 17:16:06 +01:00
|
|
|
if (USE_SDL2)
|
2023-04-06 11:58:18 +02:00
|
|
|
message(FATAL_ERROR "OpenGL ES 1 is not supported with SDL2")
|
2023-03-13 17:16:06 +01:00
|
|
|
endif()
|
2023-02-19 20:44:02 +01:00
|
|
|
add_definitions(-D_IRR_COMPILE_WITH_OGLES1_)
|
2023-06-06 15:45:12 +02:00
|
|
|
if(DEVICE MATCHES "^(WINDOWS|X11|ANDROID)$")
|
2023-10-04 23:29:59 +02:00
|
|
|
add_definitions(-D_IRR_COMPILE_WITH_EGL_MANAGER_ -D_IRR_OGLES1_USE_EXTPOINTER_)
|
2023-02-19 20:44:02 +01:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_GLES2)
|
|
|
|
add_definitions(-D_IRR_COMPILE_WITH_OGLES2_)
|
2023-06-06 15:45:12 +02:00
|
|
|
if(DEVICE MATCHES "^(WINDOWS|X11|ANDROID)$" OR EMSCRIPTEN)
|
2023-10-04 23:29:59 +02:00
|
|
|
add_definitions(-D_IRR_COMPILE_WITH_EGL_MANAGER_ -D_IRR_OGLES2_USE_EXTPOINTER_)
|
2023-03-03 18:29:36 +01:00
|
|
|
elseif(DEVICE STREQUAL "SDL")
|
|
|
|
set(USE_SDLGL ON)
|
|
|
|
set(USE_SDLGLES2 ON)
|
2023-02-19 20:44:02 +01:00
|
|
|
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}")
|
2023-04-06 11:58:18 +02:00
|
|
|
message(STATUS "OpenGL 3: ${ENABLE_OPENGL3}")
|
2023-02-19 20:44:02 +01:00
|
|
|
message(STATUS "OpenGL ES: ${ENABLE_GLES1}")
|
2023-04-05 21:52:43 +02:00
|
|
|
if (USE_SDLGLES2)
|
|
|
|
message(STATUS "OpenGL ES 2: ON (unified)")
|
|
|
|
elseif (ENABLE_GLES2)
|
|
|
|
message(STATUS "OpenGL ES 2: ON (legacy)")
|
|
|
|
else()
|
|
|
|
message(STATUS "OpenGL ES 2: OFF")
|
|
|
|
endif()
|
2023-02-19 20:44:02 +01:00
|
|
|
message(STATUS "WebGL: ${ENABLE_WEBGL1}")
|
|
|
|
|
2021-03-06 22:14:46 +01:00
|
|
|
# Required libs
|
|
|
|
|
2021-03-06 21:23:00 +01:00
|
|
|
find_package(ZLIB REQUIRED)
|
|
|
|
find_package(JPEG REQUIRED)
|
|
|
|
find_package(PNG REQUIRED)
|
|
|
|
|
2022-05-21 14:26:52 +02:00
|
|
|
|
2023-02-19 20:44:02 +01:00
|
|
|
if(ENABLE_GLES1)
|
2021-03-07 01:08:58 +01:00
|
|
|
# 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()
|
2023-02-19 20:44:02 +01:00
|
|
|
if(ENABLE_GLES2)
|
2021-03-06 21:23:00 +01:00
|
|
|
find_package(OpenGLES2 REQUIRED)
|
|
|
|
endif()
|
2023-04-06 12:07:53 +02:00
|
|
|
if(ENABLE_OPENGL OR ENABLE_OPENGL3)
|
2021-03-06 21:23:00 +01:00
|
|
|
find_package(OpenGL REQUIRED)
|
|
|
|
endif()
|
2023-02-19 20:44:02 +01:00
|
|
|
if(USE_SDL2)
|
2022-01-16 12:16:15 +01:00
|
|
|
find_package(SDL2 CONFIG REQUIRED)
|
|
|
|
message(STATUS "Found SDL2: ${SDL2_LIBRARIES}")
|
|
|
|
endif()
|
|
|
|
|
2021-03-06 21:23:00 +01:00
|
|
|
# Platform-specific libs
|
|
|
|
|
|
|
|
if(ANDROID)
|
2021-04-09 21:28:31 +02:00
|
|
|
enable_language(C)
|
2021-03-06 21:23:00 +01:00
|
|
|
elseif(APPLE)
|
2021-03-06 22:14:46 +01:00
|
|
|
find_library(COCOA_LIB Cocoa REQUIRED)
|
|
|
|
find_library(IOKIT_LIB IOKit REQUIRED)
|
2021-03-08 13:36:44 +01:00
|
|
|
|
|
|
|
add_definitions(-DGL_SILENCE_DEPRECATION)
|
2023-04-06 11:41:12 +02:00
|
|
|
elseif(NOT USE_SDL2)
|
2021-03-06 21:23:00 +01:00
|
|
|
# Unix probably
|
|
|
|
find_package(X11 REQUIRED)
|
2023-03-04 20:27:43 +01:00
|
|
|
if(USE_XINPUT2 AND NOT X11_Xi_FOUND)
|
2022-07-18 21:34:47 +02:00
|
|
|
message(FATAL_ERROR "XInput not found")
|
|
|
|
endif()
|
2021-03-06 21:23:00 +01:00
|
|
|
endif()
|
|
|
|
|
2021-06-27 23:04:56 +02:00
|
|
|
set(link_includes
|
2021-05-24 20:32:26 +02:00
|
|
|
"${PROJECT_SOURCE_DIR}/include"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}"
|
|
|
|
|
|
|
|
"${ZLIB_INCLUDE_DIR}"
|
|
|
|
"${JPEG_INCLUDE_DIR}"
|
|
|
|
"${PNG_INCLUDE_DIR}"
|
2023-04-06 11:41:12 +02:00
|
|
|
"$<$<BOOL:${USE_SDL2}>:${SDL2_INCLUDE_DIRS}>"
|
2021-05-24 20:32:26 +02:00
|
|
|
|
|
|
|
${OPENGL_INCLUDE_DIR}
|
|
|
|
${OPENGLES2_INCLUDE_DIR}
|
|
|
|
${EGL_INCLUDE_DIR}
|
|
|
|
|
|
|
|
"$<$<PLATFORM_ID:Android>:${ANDROID_NDK}/sources/android/native_app_glue>"
|
2023-04-06 11:41:12 +02:00
|
|
|
"$<$<BOOL:${USE_X11}>:${X11_INCLUDE_DIR}>"
|
2021-05-24 20:32:26 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
set(link_libs
|
|
|
|
"${ZLIB_LIBRARY}"
|
|
|
|
"${JPEG_LIBRARY}"
|
|
|
|
"${PNG_LIBRARY}"
|
2023-04-06 15:00:12 +02:00
|
|
|
"$<$<BOOL:${USE_SDL2}>:${SDL2_LIBRARIES}>"
|
2021-05-24 20:32:26 +02:00
|
|
|
|
|
|
|
${OPENGL_LIBRARIES}
|
|
|
|
${OPENGLES_LIBRARY}
|
|
|
|
${OPENGLES2_LIBRARIES}
|
|
|
|
${EGL_LIBRARY}
|
|
|
|
|
2023-06-04 19:40:54 +02:00
|
|
|
"$<$<PLATFORM_ID:Android>:-landroid -llog>"
|
2021-05-24 20:32:26 +02:00
|
|
|
${COCOA_LIB}
|
|
|
|
${IOKIT_LIB}
|
|
|
|
"$<$<PLATFORM_ID:Windows>:gdi32>"
|
|
|
|
"$<$<PLATFORM_ID:Windows>:winmm>"
|
2023-04-06 11:41:12 +02:00
|
|
|
"$<$<BOOL:${USE_X11}>:${X11_X11_LIB}>"
|
|
|
|
"$<$<BOOL:${USE_X11}>:${X11_Xi_LIB}>"
|
2021-05-24 20:32:26 +02:00
|
|
|
)
|
|
|
|
|
2021-03-06 21:23:00 +01:00
|
|
|
# Source files
|
|
|
|
|
|
|
|
set(IRRMESHLOADER
|
2023-11-29 09:57:10 +01:00
|
|
|
# GLTFMeshFileLoader.cpp
|
2021-03-06 21:23:00 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
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
|
2021-08-24 23:51:48 +02:00
|
|
|
CSceneCollisionManager.cpp
|
2021-03-06 21:23:00 +01:00
|
|
|
CSceneManager.cpp
|
|
|
|
CMeshCache.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
set(IRRDRVROBJ
|
|
|
|
CNullDriver.cpp
|
|
|
|
CGLXManager.cpp
|
2023-10-04 23:29:59 +02:00
|
|
|
CWGLManager.cpp
|
|
|
|
CEGLManager.cpp
|
2022-05-21 15:19:57 +02:00
|
|
|
CSDLManager.cpp
|
2021-08-07 21:56:00 +02:00
|
|
|
mt_opengl_loader.cpp
|
2021-03-06 21:23:00 +01:00
|
|
|
)
|
|
|
|
|
2023-04-06 12:10:29 +02:00
|
|
|
if(ENABLE_OPENGL)
|
|
|
|
set(IRRDRVROBJ
|
|
|
|
${IRRDRVROBJ}
|
|
|
|
COpenGLCacheHandler.cpp
|
|
|
|
COpenGLDriver.cpp
|
|
|
|
COpenGLShaderMaterialRenderer.cpp
|
|
|
|
COpenGLSLMaterialRenderer.cpp
|
|
|
|
COpenGLExtensionHandler.cpp
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(ENABLE_GLES1)
|
|
|
|
set(IRRDRVROBJ
|
|
|
|
${IRRDRVROBJ}
|
|
|
|
COGLESDriver.cpp
|
|
|
|
COGLESExtensionHandler.cpp
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2021-03-06 21:23:00 +01:00
|
|
|
set(IRRIMAGEOBJ
|
|
|
|
CColorConverter.cpp
|
|
|
|
CImage.cpp
|
|
|
|
CImageLoaderBMP.cpp
|
|
|
|
CImageLoaderJPG.cpp
|
|
|
|
CImageLoaderPNG.cpp
|
2021-09-13 21:21:26 +02:00
|
|
|
CImageLoaderTGA.cpp
|
2021-03-06 21:23:00 +01:00
|
|
|
CImageWriterJPG.cpp
|
|
|
|
CImageWriterPNG.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
add_library(IRRVIDEOOBJ OBJECT
|
|
|
|
CFPSCounter.cpp
|
|
|
|
${IRRDRVROBJ}
|
|
|
|
${IRRIMAGEOBJ}
|
|
|
|
)
|
|
|
|
|
2023-03-03 18:29:36 +01:00
|
|
|
if(USE_SDLGL)
|
2023-03-25 09:26:52 +01:00
|
|
|
target_sources(IRRVIDEOOBJ PRIVATE
|
2023-02-27 14:47:30 +01:00
|
|
|
OpenGL/Driver.cpp
|
|
|
|
OpenGL/ExtensionHandler.cpp
|
|
|
|
OpenGL/FixedPipelineRenderer.cpp
|
|
|
|
OpenGL/MaterialRenderer.cpp
|
|
|
|
OpenGL/Renderer2D.cpp
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2023-03-03 18:29:36 +01:00
|
|
|
if(USE_SDLGL3)
|
2023-03-25 09:26:52 +01:00
|
|
|
target_sources(IRRVIDEOOBJ PRIVATE
|
2023-03-03 18:29:36 +01:00
|
|
|
OpenGL3/Driver.cpp
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(USE_SDLGLES2)
|
2023-03-25 09:26:52 +01:00
|
|
|
target_sources(IRRVIDEOOBJ PRIVATE
|
2023-03-03 18:29:36 +01:00
|
|
|
OpenGLES2/Driver.cpp
|
|
|
|
)
|
2023-04-06 12:10:29 +02:00
|
|
|
elseif(ENABLE_GLES2)
|
2023-03-25 09:26:52 +01:00
|
|
|
target_sources(IRRVIDEOOBJ PRIVATE
|
2023-03-03 18:29:36 +01:00
|
|
|
COGLES2Driver.cpp
|
|
|
|
COGLES2ExtensionHandler.cpp
|
|
|
|
COGLES2FixedPipelineRenderer.cpp
|
|
|
|
COGLES2MaterialRenderer.cpp
|
|
|
|
COGLES2Renderer2D.cpp
|
|
|
|
CWebGL1Driver.cpp
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2021-03-06 21:23:00 +01:00
|
|
|
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
|
2023-10-04 23:29:59 +02:00
|
|
|
CIrrDeviceWin32.cpp
|
2021-03-06 21:23:00 +01:00
|
|
|
CLogger.cpp
|
|
|
|
COSOperator.cpp
|
|
|
|
Irrlicht.cpp
|
|
|
|
os.cpp
|
|
|
|
)
|
|
|
|
|
2023-02-27 14:47:30 +01:00
|
|
|
if(ENABLE_OPENGL3)
|
|
|
|
target_compile_definitions(IRROTHEROBJ PRIVATE ENABLE_OPENGL3)
|
|
|
|
endif()
|
|
|
|
|
2021-03-07 01:08:58 +01:00
|
|
|
if(ANDROID)
|
|
|
|
target_sources(IRROTHEROBJ PRIVATE
|
|
|
|
Android/CIrrDeviceAndroid.cpp
|
|
|
|
Android/CAndroidAssetReader.cpp
|
|
|
|
Android/CAndroidAssetFileArchive.cpp
|
|
|
|
Android/CKeyEventWrapper.cpp
|
|
|
|
)
|
|
|
|
elseif(APPLE)
|
2021-03-06 22:14:46 +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()
|
|
|
|
|
2023-03-06 12:21:58 +01:00
|
|
|
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()
|
|
|
|
|
2021-03-06 21:23:00 +01:00
|
|
|
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
|
|
|
|
|
2021-06-27 23:04:56 +02:00
|
|
|
add_library(IrrlichtMt)
|
|
|
|
foreach(object_lib
|
2021-07-23 16:23:44 +02:00
|
|
|
IRRMESHOBJ IRROBJ IRRVIDEOOBJ
|
2021-06-27 23:04:56 +02:00
|
|
|
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()
|
2021-03-06 21:23:00 +01:00
|
|
|
|
2021-05-24 20:32:26 +02:00
|
|
|
# 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}>"
|
|
|
|
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/irrlichtmt>"
|
|
|
|
PRIVATE
|
2021-06-27 23:04:56 +02:00
|
|
|
${link_includes}
|
2021-05-24 20:32:26 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries(IrrlichtMt PRIVATE ${link_libs})
|
|
|
|
|
2023-02-19 20:44:02 +01:00
|
|
|
if(WIN32)
|
2023-03-06 15:32:03 +01:00
|
|
|
target_compile_definitions(IrrlichtMt INTERFACE _IRR_WINDOWS_API_) # used in _IRR_DEBUG_BREAK_IF definition in a public header
|
2023-02-19 22:16:55 +01:00
|
|
|
endif()
|
2023-03-06 15:32:03 +01:00
|
|
|
target_compile_definitions(IrrlichtMt INTERFACE "IRRLICHT_API=${API_IMPORT}")
|
2023-02-19 20:44:02 +01:00
|
|
|
if(APPLE OR ANDROID OR EMSCRIPTEN)
|
|
|
|
target_compile_definitions(IrrlichtMt PUBLIC IRR_MOBILE_PATHS)
|
|
|
|
endif()
|
2021-07-16 23:11:59 +02:00
|
|
|
|
2021-03-25 14:14:44 +01:00
|
|
|
set_target_properties(IrrlichtMt PROPERTIES
|
2021-04-13 21:08:16 +02:00
|
|
|
VERSION ${PROJECT_VERSION}
|
2021-03-06 21:23:00 +01:00
|
|
|
)
|
2021-03-06 22:14:46 +01:00
|
|
|
|
2021-03-25 14:14:44 +01:00
|
|
|
if(WIN32)
|
|
|
|
set_target_properties(IrrlichtMt PROPERTIES PREFIX "") # for DLL name
|
|
|
|
endif()
|
2021-04-17 17:30:45 +02:00
|
|
|
|
2021-04-24 11:03:09 +02:00
|
|
|
# Installation of library
|
2023-06-04 19:40:54 +02:00
|
|
|
install(TARGETS IrrlichtMt
|
2021-04-24 11:03:09 +02:00
|
|
|
EXPORT IrrlichtMt-export
|
|
|
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
|
|
)
|