From bfba19d67af8b38fcd37a154da5ca5d308b32cf8 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sat, 6 Mar 2021 22:14:46 +0100 Subject: [PATCH] Restore Windows and OSX support --- CMakeLists.txt | 1 + source/Irrlicht/CMakeLists.txt | 26 ++++++++++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e69737c..ba1e4f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,7 @@ else() set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/Linux) endif() set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Debug or Release" FORCE) diff --git a/source/Irrlicht/CMakeLists.txt b/source/Irrlicht/CMakeLists.txt index dae2f81..a311530 100644 --- a/source/Irrlicht/CMakeLists.txt +++ b/source/Irrlicht/CMakeLists.txt @@ -5,6 +5,8 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug") endif() set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) +# Compiler flags + if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") set(CMAKE_CXX_FLAGS_RELEASE "-O3") set(CMAKE_C_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE}) @@ -24,6 +26,8 @@ elseif(MSVC) set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS /OPT:REF /LTCG") endif() +# Required libs + find_package(ZLIB REQUIRED) find_package(JPEG REQUIRED) find_package(PNG REQUIRED) @@ -57,11 +61,11 @@ endif() if(ANDROID) # TODO elseif(APPLE) - # TODO probably these: - #find_library(COCOA_LIB Cocoa REQUIRED) - #find_library(IOKIT_LIB IOKit REQUIRED) + find_library(COCOA_LIB Cocoa REQUIRED) + find_library(IOKIT_LIB IOKit REQUIRED) + link_libraries(${COCOA_LIB} ${IOKIT_LIB}) elseif(WIN32) - # -lgdi32 -lwinmm? + link_libraries(gdi32 winmm) else() # Unix probably find_package(X11 REQUIRED) @@ -316,6 +320,15 @@ add_library(IRROTHEROBJ OBJECT utf8.cpp ) +if(APPLE) + # 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() + add_library(IRRGUIOBJ OBJECT CGUIButton.cpp CGUICheckBox.cpp @@ -368,3 +381,8 @@ set_target_properties(Irrlicht PROPERTIES VERSION ${VERSION} SOVERSION ${IRRLICHT_VERSION_MAJOR}.${IRRLICHT_VERSION_MINOR} ) + + +include(GNUInstallDirs) +install(TARGETS Irrlicht DESTINATION "${CMAKE_INSTALL_LIBDIR}") +install(DIRECTORY "${CMAKE_SOURCE_DIR}/include/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/irrlicht")