Squashed 'deps/nostalgia/' changes from dd5d1bfb..976550ef
976550ef [nostalgia/sample_project] Add missing type descriptors 1fb0a866 [nostalgia/core] Fix CompactPalette TypeName and TypeVersion eb46aeeb [nfde] Fix compiler warnings on Gtk build 9244b735 [nostalgia] Fix non-Linux non-Apple systems not to build GLFW for Wayland 3fba36b4 [nfde] Make only option BUILD_SHARED_LIBS if not already set 6ddb6b42 Merge commit '5461f6700dac79e9e71e3966f8a1270706c385ba' 5461f670 Squashed 'deps/nfde/' changes from 28ade5a5c..5786fabce 1ecc7aa7 Merge commit '26c8cc348eacea01237cd64e1a68d0df8141e848' 26c8cc34 Squashed 'deps/glfw/' changes from 7d5a16ce7..7b6aead9f fc25c12d Merge commit 'ae51a422787bc3b720ff1748c0219c8f33363427' ae51a422 Squashed 'deps/imgui/' changes from f33737806..2db79d086 6c71e1e2 [nostalgia/core/studio,studio] Give TileSheetEditor Ctrl-A and Ctrl-G for selection 2ede01e7 [nostalgia/core/studio] Fix build deacd4ab [nostalgia/core/studio] Fix PaletteEditor add/remove color commands git-subtree-dir: deps/nostalgia git-subtree-split: 976550ef6fa269cf1e367e880f148b0ad7b1b163
This commit is contained in:
72
deps/nfde/src/CMakeLists.txt
vendored
72
deps/nfde/src/CMakeLists.txt
vendored
@ -25,17 +25,49 @@ if(nfd_PLATFORM STREQUAL PLATFORM_UNIX)
|
||||
endif()
|
||||
|
||||
if(nfd_PLATFORM STREQUAL PLATFORM_MACOS)
|
||||
# For setting the filter list, macOS introduced allowedContentTypes in version 11.0 and deprecated allowedFileTypes in 12.0.
|
||||
# By default (set to ON), NFDe will use allowedContentTypes when targeting macOS >= 11.0.
|
||||
# Set this option to OFF to always use allowedFileTypes regardless of the target macOS version.
|
||||
# This is mainly needed for applications that are built on macOS >= 11.0 but should be able to run on lower versions
|
||||
# and should not be used otherwise.
|
||||
option(NFD_USE_ALLOWEDCONTENTTYPES_IF_AVAILABLE "Use allowedContentTypes for filter lists on macOS >= 11.0" ON)
|
||||
|
||||
find_library(APPKIT_LIBRARY AppKit)
|
||||
if(NFD_USE_ALLOWEDCONTENTTYPES_IF_AVAILABLE)
|
||||
include(CheckCXXSourceCompiles)
|
||||
check_cxx_source_compiles(
|
||||
"
|
||||
#include <Availability.h>
|
||||
#if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || !defined(__MAC_11_0) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_11_0
|
||||
static_assert(false);
|
||||
#endif
|
||||
int main() { return 0; }
|
||||
"
|
||||
NFD_USE_ALLOWEDCONTENTTYPES
|
||||
)
|
||||
if(NFD_USE_ALLOWEDCONTENTTYPES)
|
||||
find_library(UNIFORMTYPEIDENTIFIERS_LIBRARY UniformTypeIdentifiers)
|
||||
if(NOT UNIFORMTYPEIDENTIFIERS_LIBRARY)
|
||||
message(FATAL_ERROR "UniformTypeIdentifiers framework is not available even though we are targeting macOS >= 11.0")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
list(APPEND SOURCE_FILES nfd_cocoa.m)
|
||||
endif()
|
||||
|
||||
# Define the library
|
||||
add_library(${TARGET_NAME}
|
||||
${SOURCE_FILES})
|
||||
add_library(${TARGET_NAME} ${SOURCE_FILES})
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(${TARGET_NAME} PRIVATE NFD_EXPORT INTERFACE NFD_SHARED)
|
||||
endif ()
|
||||
|
||||
# Allow includes from include/
|
||||
target_include_directories(${TARGET_NAME}
|
||||
PUBLIC include/)
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
|
||||
if(nfd_PLATFORM STREQUAL PLATFORM_UNIX)
|
||||
if(NOT NFD_PORTAL)
|
||||
@ -45,15 +77,25 @@ if(nfd_PLATFORM STREQUAL PLATFORM_UNIX)
|
||||
target_include_directories(${TARGET_NAME}
|
||||
PRIVATE ${DBUS_INCLUDE_DIRS})
|
||||
target_link_libraries(${TARGET_NAME}
|
||||
PRIVATE ${DBUS_LIBRARIES})
|
||||
PRIVATE ${DBUS_LINK_LIBRARIES})
|
||||
target_compile_definitions(${TARGET_NAME}
|
||||
PUBLIC NFD_PORTAL)
|
||||
endif()
|
||||
|
||||
option(NFD_APPEND_EXTENSION "Automatically append file extension to an extensionless selection in SaveDialog()" OFF)
|
||||
if(NFD_APPEND_EXTENSION)
|
||||
target_compile_definitions(${TARGET_NAME} PRIVATE NFD_APPEND_EXTENSION)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(nfd_PLATFORM STREQUAL PLATFORM_MACOS)
|
||||
target_link_libraries(${TARGET_NAME}
|
||||
PRIVATE ${APPKIT_LIBRARY})
|
||||
if(NFD_USE_ALLOWEDCONTENTTYPES)
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE ${APPKIT_LIBRARY} ${UNIFORMTYPEIDENTIFIERS_LIBRARY})
|
||||
target_compile_definitions(${TARGET_NAME} PRIVATE NFD_MACOS_ALLOWEDCONTENTTYPES=1)
|
||||
else()
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE ${APPKIT_LIBRARY})
|
||||
target_compile_definitions(${TARGET_NAME} PRIVATE NFD_MACOS_ALLOWEDCONTENTTYPES=0)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(nfd_COMPILER STREQUAL COMPILER_MSVC)
|
||||
@ -71,6 +113,20 @@ if(nfd_COMPILER STREQUAL COMPILER_GNU)
|
||||
target_compile_options(${TARGET_NAME} PRIVATE -nostdlib -fno-exceptions -fno-rtti)
|
||||
endif()
|
||||
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADER_FILES}")
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES
|
||||
PUBLIC_HEADER "${PUBLIC_HEADER_FILES}"
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR})
|
||||
|
||||
install(TARGETS ${TARGET_NAME} LIBRARY DESTINATION lib ARCHIVE DESTINATION lib PUBLIC_HEADER DESTINATION include)
|
||||
if (NFD_INSTALL)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
install(TARGETS ${TARGET_NAME} EXPORT ${TARGET_NAME}-export
|
||||
LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
)
|
||||
install(EXPORT ${TARGET_NAME}-export
|
||||
DESTINATION lib/cmake/${TARGET_NAME}
|
||||
NAMESPACE ${TARGET_NAME}::
|
||||
FILE ${TARGET_NAME}-config.cmake
|
||||
)
|
||||
endif()
|
||||
|
Reference in New Issue
Block a user