Integrates the nativeFileDialog library to enable native file dialogs on the major platforms. It is activated with SDL.

This commit is contained in:
Areloch 2016-04-30 15:48:33 -05:00
parent bab55d46a9
commit ec6f9c05a6
15 changed files with 2489 additions and 354 deletions

View file

@ -71,6 +71,9 @@ macro(addPath dir)
${dir}/*.h
#${dir}/*.asm
)
foreach(entry ${BLACKLIST})
list(REMOVE_ITEM tmp_files ${dir}/${entry})
endforeach()
LIST(APPEND ${PROJECT_NAME}_files "${tmp_files}")
LIST(APPEND ${PROJECT_NAME}_paths "${dir}")
#message(STATUS "addPath ${PROJECT_NAME} : ${tmp_files}")

View file

@ -0,0 +1,29 @@
# -----------------------------------------------------------------------------
# Copyright (c) 2014 GarageGames, LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
# -----------------------------------------------------------------------------
project(nativeFileDialogs)
addPath("${libDir}/nativeFileDialogs" REC)
addInclude(${libDir}/nativeFileDialogs/include)
finishLibrary()

View file

@ -195,7 +195,13 @@ addPath("${srcDir}/windowManager/test")
addPath("${srcDir}/math")
addPath("${srcDir}/math/util")
addPath("${srcDir}/math/test")
if(NOT TORQUE_SDL)
set(BLACKLIST "fileDialog.cpp" )
endif()
addPath("${srcDir}/platform")
set(BLACKLIST "" )
addPath("${srcDir}/cinterface")
addPath("${srcDir}/platform/nativeDialogs")
if( NOT TORQUE_DEDICATED )
@ -365,6 +371,28 @@ if(TORQUE_SDL)
else()
set(ENV{LDFLAGS} "${CXX_FLAG32} ${TORQUE_ADDITIONAL_LINKER_FLAGS}")
endif()
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
# Setup CMake to use GTK+, tell the compiler where to look for headers
# and to the linker where to look for libraries
include_directories(${GTK3_INCLUDE_DIRS})
link_directories(${GTK3_LIBRARY_DIRS})
# Add other flags to the compiler
add_definitions(${GTK3_CFLAGS_OTHER})
set(BLACKLIST "nfd_win.cpp" )
addLib(nativeFileDialogs)
set(BLACKLIST "" )
target_link_libraries(nativeFileDialogs ${GTK3_LIBRARIES})
else()
set(BLACKLIST "nfd_gtk.c" )
addLib(nativeFileDialogs)
set(BLACKLIST "" )
addLib(comctl32)
endif()
#override and hide SDL2 cache variables
@ -388,7 +416,11 @@ endforeach()
###############################################################################
if(WIN32)
addPath("${srcDir}/platformWin32")
if(TORQUE_SDL)
set(BLACKLIST "fileDialog.cpp" )
endif()
addPath("${srcDir}/platformWin32/nativeDialogs")
set(BLACKLIST "" )
addPath("${srcDir}/platformWin32/menus")
addPath("${srcDir}/platformWin32/threads")
addPath("${srcDir}/platformWin32/videoInfo")
@ -634,6 +666,9 @@ addInclude("${libDir}/libogg/include")
addInclude("${libDir}/opcode")
addInclude("${libDir}/collada/include")
addInclude("${libDir}/collada/include/1.4")
if(TORQUE_SDL)
addInclude("${libDir}/nativeFileDialogs/include")
endif()
if(TORQUE_OPENGL)
addInclude("${libDir}/glew/include")
endif()