Merge de la v3 de Ryzom Core

This commit is contained in:
Sit Melai 2016-11-07 17:11:05 +01:00
commit ccb943b852
405 changed files with 63841 additions and 6300 deletions

View file

@ -36,7 +36,7 @@ IF(COMMAND cmake_policy)
IF(POLICY CMP0020)
CMAKE_POLICY(SET CMP0020 NEW)
ENDIF()
ENDIF(COMMAND cmake_policy)
ENDIF()
INCLUDE(nel)
INCLUDE(ConfigureChecks)
@ -76,15 +76,15 @@ SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
# DLL should be in the same directory as EXE under Windows
IF(WIN32)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
ELSE(WIN32)
ELSE()
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
ENDIF(WIN32)
ENDIF()
IF(WIN32)
IF(WITH_MFC)
FIND_PACKAGE(MFC QUIET)
ENDIF(WITH_MFC)
ENDIF(WIN32)
ENDIF()
ENDIF()
#-----------------------------------------------------------------------------
# Set default config options
@ -98,8 +98,6 @@ NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS()
NL_SETUP_PREFIX_PATHS()
RYZOM_SETUP_PREFIX_PATHS()
NL_CONFIGURE_CHECKS()
NL_SETUP_BUILD()
NL_SETUP_BUILD_FLAGS()
@ -113,8 +111,8 @@ IF(WIN32)
IF(WITH_MFC)
FIND_PACKAGE(CustomMFC REQUIRED)
ENDIF(WITH_MFC)
ENDIF(WIN32)
ENDIF()
ENDIF()
FIND_PACKAGE(ZLIB REQUIRED)
FIND_PACKAGE(LibXml2 REQUIRED)
@ -123,15 +121,25 @@ FIND_PACKAGE(OpenSSL REQUIRED)
FIND_PACKAGE(GIF)
FIND_PACKAGE(Jpeg)
IF(WITH_LIBOVR)
FIND_PACKAGE(LibOVR)
ENDIF()
IF(WITH_LIBVR)
FIND_PACKAGE(LibVR)
ENDIF()
NL_CONFIGURE_CHECKS()
IF(WITH_STATIC_LIBXML2)
SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC)
ENDIF(WITH_STATIC_LIBXML2)
ENDIF()
IF(WITH_LIBXML2_ICONV)
FIND_PACKAGE(Iconv REQUIRED)
INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICONV_LIBRARIES})
ENDIF(WITH_LIBXML2_ICONV)
ENDIF()
IF(WITH_STATIC)
# libxml2 could need winsock2 library
@ -146,20 +154,20 @@ IF(WITH_STATIC)
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${LIBLZMA_LIBRARIES})
ENDIF()
ENDIF()
ENDIF(WITH_STATIC)
ENDIF()
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/PCHSupport.cmake)
IF(FINAL_VERSION)
ADD_DEFINITIONS(-DFINAL_VERSION=1)
ENDIF(FINAL_VERSION)
ENDIF()
IF(WITH_SSE2)
ADD_DEFINITIONS(-DNL_HAS_SSE2)
IF(WITH_SSE3)
ADD_DEFINITIONS(-DNL_HAS_SSE3)
ENDIF(WITH_SSE3)
ENDIF(WITH_SSE2)
ENDIF()
ENDIF()
IF(APPLE_CERTIFICATE)
# Find codesign_allocate
@ -305,7 +313,7 @@ IF(WITH_QT5)
ADD_QT_LIBRARY(XcbQpa)
ADD_QT_LIBRARY(PlatformSupport)
SET(QT_LIBRARIES ${QT_LIBRARIES} -lX11-xcb -lXi -lSM -lICE -lxcb -lGL)
SET(QT_LIBRARIES ${QT_LIBRARIES} -lX11-xcb -lXi -lSM -lICE -lxcb -lGL -lxcb-glx)
IF(EXISTS "${QT_LIBRARY_DIR}/libxcb-static.a")
SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_LIBRARY_DIR}/libxcb-static.a")
ENDIF()
@ -400,16 +408,16 @@ IF(WITH_QT)
# Use Qt 4
FIND_PACKAGE(Qt4 COMPONENTS QtCore QtGui QtXml QtOpenGL REQUIRED)
ENDIF(WITH_QT)
ENDIF()
IF(WITH_ASSIMP)
FIND_PACKAGE(assimp REQUIRED)
ENDIF(WITH_ASSIMP)
ENDIF()
IF(WITH_NEL)
IF(WITH_NEL_TESTS)
FIND_PACKAGE(CppTest)
ENDIF(WITH_NEL_TESTS)
ENDIF()
IF(WITH_GUI)
FIND_PACKAGE(Luabind REQUIRED)
@ -447,19 +455,19 @@ IF(WITH_NEL)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nel/include)
ADD_SUBDIRECTORY(nel)
ENDIF(WITH_NEL)
ENDIF()
IF(WITH_RYZOM)
ADD_SUBDIRECTORY(ryzom)
ENDIF(WITH_RYZOM)
ENDIF()
IF(WITH_NELNS)
ADD_SUBDIRECTORY(nelns)
ENDIF(WITH_NELNS)
ENDIF()
IF(WITH_SNOWBALLS)
ADD_SUBDIRECTORY(snowballs2)
ENDIF(WITH_SNOWBALLS)
ENDIF()
IF(WITH_TOOLS)
ADD_SUBDIRECTORY(tool)
@ -467,22 +475,22 @@ ENDIF()
IF(WITH_STUDIO)
ADD_SUBDIRECTORY(studio)
ENDIF(WITH_STUDIO)
ENDIF()
# To build the documention, you will have to enable it
# and then do the equivalent of "make DoxygenDoc".
IF(BUILD_DOCUMENTATION)
IF(DOT)
SET(HAVE_DOT YES)
ELSE(DOT)
ELSE()
SET(HAVE_DOT NO)
ENDIF(DOT)
ENDIF()
# This processes our Doxyfile.in and substitutes paths to generate
# a final Doxyfile
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/doc/Doxyfile.cmake.in ${CMAKE_BINARY_DIR}/doc/Doxyfile)
ADD_CUSTOM_TARGET(DoxygenDoc ${DOXYGEN} ${CMAKE_BINARY_DIR}/doc/Doxyfile)
ENDIF(BUILD_DOCUMENTATION)
ENDIF()
IF(WITH_NEL_TESTS)
ENABLE_TESTING()
@ -492,8 +500,8 @@ IF(WITH_NEL_TESTS)
SET(SVNCOMMAND svn)
SET(SVNSOURCEDIR http://dev.ryzom.com/svn/trunk/nel)
SET(GENERATELOGS svn2cl)
ENDIF(BUILD_DASHBOARD)
ENDIF(WITH_NEL_TESTS)
ENDIF()
ENDIF()
# packaging information
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Ryzom Core MMORPG Framework")
@ -525,10 +533,10 @@ IF(WIN32)
#SET(CPACK_GENERATOR "NSIS")
SET(CPACK_GENERATOR "NSIS;ZIP")
SET(CPACK_SOURCE_GENERATOR "ZIP")
ELSE(WIN32)
ELSE()
SET(CPACK_GENERATOR "TGZ")
SET(CPACK_SOURCE_GENERATOR "TGZ")
ENDIF(WIN32)
ENDIF()
set(CPACK_SOURCE_IGNORE_FILES
"~$"
"\\\\.cvsignore$"
@ -546,8 +554,8 @@ IF(WIN32)
"${QT_LIBRARY_DIR}/../bin/QtXmld4.dll"
"${QT_LIBRARY_DIR}/../bin/QtCored4.dll"
DESTINATION ${NL_BIN_PREFIX})
ENDIF(WITH_QT)
ELSE(NOT CMAKE_BUILD_TYPE STREQUAL "Release")
ENDIF()
ELSE()
IF(WITH_QT)
INCLUDE(${QT_USE_FILE})
INSTALL(FILES
@ -555,8 +563,8 @@ IF(WIN32)
"${QT_LIBRARY_DIR}/../bin/QtXml4.dll"
"${QT_LIBRARY_DIR}/../bin/QtCore4.dll"
DESTINATION ${NL_BIN_PREFIX})
ENDIF(WITH_QT)
ENDIF(NOT CMAKE_BUILD_TYPE STREQUAL "Release")
ENDIF()
ENDIF()
# Install CEGUI and its dependencies.
IF(WITH_NEL_CEGUI)
@ -566,14 +574,14 @@ IF(WIN32)
INSTALL(FILES "${CEGUI_LIB_DIR}/CEGUIFalagardWRBase.dll" DESTINATION ${NL_BIN_PREFIX})
INSTALL(FILES "${CEGUI_LIB_DIR}/Devil.dll" DESTINATION ${NL_BIN_PREFIX})
INSTALL(FILES "${CEGUI_LIB_DIR}/ILU.dll" DESTINATION ${NL_BIN_PREFIX})
ENDIF(WITH_NEL_CEGUI)
ENDIF()
# Only the tools require MFC.
IF(WITH_TOOLS)
SET(CMAKE_INSTALL_MFC_LIBRARIES TRUE)
ENDIF(WITH_TOOLS)
ENDIF()
#INCLUDE(InstallRequiredSystemLibraries)
ENDIF(WIN32)
ENDIF()
INCLUDE(CPack)
@ -583,4 +591,4 @@ INCLUDE(CMakePackaging.txt)
#INCLUDE(UseDebian)
#IF(DEBIAN_FOUND)
# ADD_DEBIAN_TARGETS(nel)
#ENDIF(DEBIAN_FOUND)
#ENDIF()

View file

@ -24,8 +24,8 @@ MACRO(CHECK_UNDEFINED_SYMBOL MYLIBRARY SYMBOL SYMBOL_FOUND)
IF(NOT NM_SYMBOL MATCHES ${SYMBOL})
SET(${SYMBOL_FOUND} FALSE)
# MESSAGE(STATUS "Defined symbol ${SYMBOL} detected in ${${MYLIBRARY}}")
ENDIF(NOT NM_SYMBOL MATCHES ${SYMBOL})
ENDIF(CMAKE_NM)
ENDIF()
ENDIF()
ELSEIF(UNIX)
SET(CMAKE_OBJDUMP objdump)
IF(CMAKE_OBJDUMP)
@ -35,11 +35,11 @@ MACRO(CHECK_UNDEFINED_SYMBOL MYLIBRARY SYMBOL SYMBOL_FOUND)
IF(NOT OBJDUMP_SYMBOL MATCHES "UND")
#MESSAGE(STATUS "${${MYLIBRARY}} does not use symbol ${SYMBOL}")
SET(${SYMBOL_FOUND} FALSE)
ELSE(NOT OBJDUMP_SYMBOL MATCHES "UND")
ELSE()
#MESSAGE(STATUS "${${MYLIBRARY}} uses symbol ${SYMBOL}")
ENDIF(NOT OBJDUMP_SYMBOL MATCHES "UND")
ENDIF(CMAKE_OBJDUMP)
ENDIF(WIN32)
ENDIF()
ENDIF()
ENDIF()
ENDMACRO(CHECK_UNDEFINED_SYMBOL)
# CHECK_LINKED_LIBRARY
@ -66,8 +66,8 @@ MACRO(CHECK_LINKED_LIBRARY MYLIBRARY OTHERLIBRARY LIBRARY_FOUND)
IF(OTOOL_LIBRARY MATCHES "${LIBNAME}")
SET(${LIBRARY_FOUND} TRUE)
# MESSAGE(STATUS "Library ${LIBNAME} already linked to ${${MYLIBRARY}}")
ENDIF(OTOOL_LIBRARY MATCHES "${LIBNAME}")
ENDIF(CMAKE_OTOOL)
ENDIF()
ENDIF()
ELSEIF(UNIX)
SET(CMAKE_OBJDUMP objdump)
IF(CMAKE_OBJDUMP)
@ -79,11 +79,11 @@ MACRO(CHECK_LINKED_LIBRARY MYLIBRARY OTHERLIBRARY LIBRARY_FOUND)
IF(OBJDUMP_LIBRARY MATCHES "NEEDED")
#MESSAGE(STATUS "${${MYLIBRARY}} references to ${LIBNAME}.")
SET(${LIBRARY_FOUND} TRUE)
ELSE(OBJDUMP_LIBRARY MATCHES "NEEDED")
ELSE()
#MESSAGE(STATUS "${${MYLIBRARY}} does not reference to ${LIBNAME}!")
ENDIF(OBJDUMP_LIBRARY MATCHES "NEEDED")
ENDIF(CMAKE_OBJDUMP)
ENDIF(WIN32)
ENDIF()
ENDIF()
ENDIF()
ENDMACRO(CHECK_LINKED_LIBRARY)
MACRO(CHECK_DEPENDS MYLIBRARY OTHERLIBRARY SYMBOL MUSTLINK)
@ -91,13 +91,13 @@ MACRO(CHECK_DEPENDS MYLIBRARY OTHERLIBRARY SYMBOL MUSTLINK)
IF(SYMBOL_FOUND)
CHECK_LINKED_LIBRARY(MYLIBRARY OTHERLIBRARY LIBRARY_FOUND)
ENDIF(SYMBOL_FOUND)
ENDIF()
IF(SYMBOL_FOUND AND NOT LIBRARY_FOUND)
SET(${MUSTLINK} YES)
ELSE(SYMBOL_FOUND AND NOT LIBRARY_FOUND)
ELSE()
SET(${MUSTLINK} NO)
ENDIF(SYMBOL_FOUND AND NOT LIBRARY_FOUND)
ENDIF()
ENDMACRO(CHECK_DEPENDS)
# LINK_DEPENDS
@ -116,23 +116,23 @@ MACRO(LINK_DEPENDS LIBRARIES MYLIBRARY OTHERLIBRARY SYMBOL)
IF(WIN32 OR WITH_STATIC)
# In static, we link all libraries because it will keep only used symbols
SET(MUST_LINK TRUE)
ELSE(WIN32 OR WITH_STATIC)
ELSE()
CHECK_UNDEFINED_SYMBOL(${MYLIBRARY} ${SYMBOL} SYMBOL_FOUND)
IF(SYMBOL_FOUND)
CHECK_LINKED_LIBRARY(${MYLIBRARY} ${OTHERLIBRARY} LIBRARY_FOUND)
ENDIF(SYMBOL_FOUND)
ENDIF()
IF(SYMBOL_FOUND AND NOT LIBRARY_FOUND)
MESSAGE(STATUS "Underlinking found: ${${MYLIBRARY}} needs ${${OTHERLIBRARY}} but is not linked to, manually linking...")
SET(MUST_LINK TRUE)
ENDIF(SYMBOL_FOUND AND NOT LIBRARY_FOUND)
ENDIF(WIN32 OR WITH_STATIC)
ENDIF(${MYLIBRARY} AND ${OTHERLIBRARY} AND NOT ${OTHERLIBRARY}_LINKED)
ENDIF()
ENDIF()
ENDIF()
IF(MUST_LINK)
MESSAGE(STATUS "Linking with ${${OTHERLIBRARY}}")
SET(${LIBRARIES} ${${LIBRARIES}} ${${OTHERLIBRARY}})
SET(${OTHERLIBRARY}_LINKED TRUE)
ENDIF(MUST_LINK)
ENDIF()
ENDMACRO(LINK_DEPENDS)

View file

@ -40,7 +40,8 @@ MACRO(NL_CONFIGURE_CHECKS)
SET(NL_VERSION "${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}.${NL_VERSION_PATCH}.${REVISION}")
SET(NL_VERSION_RC "${NL_VERSION_MAJOR},${NL_VERSION_MINOR},${NL_VERSION_PATCH},${REVISION}")
SET(RYZOM_VERSION "${RYZOM_VERSION_MAJOR}.${RYZOM_VERSION_MINOR}.${RYZOM_VERSION_PATCH}.${REVISION}")
SET(RYZOM_VERSION_SHORT "${RYZOM_VERSION_MAJOR}.${RYZOM_VERSION_MINOR}.${RYZOM_VERSION_PATCH}")
SET(RYZOM_VERSION "${RYZOM_VERSION_SHORT}.${REVISION}")
SET(RYZOM_VERSION_RC "${RYZOM_VERSION_MAJOR},${RYZOM_VERSION_MINOR},${RYZOM_VERSION_PATCH},${REVISION}")
NOW(BUILD_DATE)

View file

@ -75,8 +75,8 @@ if(MAXSDK_FOUND)
${MAXSDK_PARAMBLK2_LIBRARY}
${MAXSDK_BMM_LIBRARY} )
else(MAXSDK_FOUND)
ELSE()
set(MAXSDK_LIBRARIES)
endif(MAXSDK_FOUND)
ENDIF()
mark_as_advanced(MAXSDK_INCLUDE_DIR MAXSDK_LIBRARY)

View file

@ -7,7 +7,7 @@
IF(CEGUI_LIBRARY AND CEGUI_INCLUDE_DIRS)
# in cache already
SET(CEGUI_FIND_QUIETLY TRUE)
ENDIF(CEGUI_LIBRARY AND CEGUI_INCLUDE_DIRS)
ENDIF()
FIND_PATH(CEGUI_INCLUDE_DIRS
@ -45,9 +45,9 @@ IF(CEGUI_LIBRARY AND CEGUI_INCLUDE_DIRS)
SET(CEGUI_INCLUDE_DIRS "${CEGUI_INCLUDE_DIRS}/CEGUI")
IF(NOT CEGUI_FIND_QUIETLY)
MESSAGE(STATUS "Found CEGUI: ${CEGUI_LIBRARY}")
ENDIF(NOT CEGUI_FIND_QUIETLY)
ELSE(CEGUI_LIBRARY AND CEGUI_INCLUDE_DIRS)
ENDIF()
ELSE()
IF(NOT CEGUI_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find CEGUI!")
ENDIF(NOT CEGUI_FIND_QUIETLY)
ENDIF(CEGUI_LIBRARY AND CEGUI_INCLUDE_DIRS)
ENDIF()
ENDIF()

View file

@ -10,7 +10,7 @@
IF(CPPTEST_LIBRARIES AND CPPTEST_INCLUDE_DIR)
# in cache already
SET(CPPTEST_FIND_QUIETLY TRUE)
ENDIF(CPPTEST_LIBRARIES AND CPPTEST_INCLUDE_DIR)
ENDIF()
FIND_PATH(CPPTEST_INCLUDE_DIR
cpptest.h
@ -30,7 +30,7 @@ SET(LIBRARY_NAME_DEBUG cpptestd)
IF(WITH_STLPORT)
SET(LIBRARY_NAME_RELEASE cpptest_stlport ${LIBRARY_NAME_RELEASE})
SET(LIBRARY_NAME_DEBUG cpptest_stlportd ${LIBRARY_NAME_DEBUG})
ENDIF(WITH_STLPORT)
ENDIF()
FIND_LIBRARY(CPPTEST_LIBRARY_RELEASE
${LIBRARY_NAME_RELEASE}
@ -67,18 +67,18 @@ IF(CPPTEST_INCLUDE_DIR)
SET(CPPTEST_LIBRARIES "optimized;${CPPTEST_LIBRARY_RELEASE}")
IF(CPPTEST_LIBRARY_DEBUG)
SET(CPPTEST_LIBRARIES "${CPPTEST_LIBRARIES};debug;${CPPTEST_LIBRARY_DEBUG}")
ENDIF(CPPTEST_LIBRARY_DEBUG)
ENDIF(CPPTEST_LIBRARY_RELEASE)
ENDIF(CPPTEST_INCLUDE_DIR)
ENDIF()
ENDIF()
ENDIF()
IF(CPPTEST_FOUND)
IF(NOT CPPTEST_FIND_QUIETLY)
MESSAGE(STATUS "Found CppTest: ${CPPTEST_LIBRARIES}")
ENDIF(NOT CPPTEST_FIND_QUIETLY)
ELSE(CPPTEST_FOUND)
ENDIF()
ELSE()
IF(NOT CPPTEST_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find CppTest!")
ENDIF(NOT CPPTEST_FIND_QUIETLY)
ENDIF(CPPTEST_FOUND)
ENDIF()
ENDIF()
MARK_AS_ADVANCED(CPPTEST_LIBRARY_RELEASE CPPTEST_LIBRARY_DEBUG)

View file

@ -6,20 +6,20 @@
IF(CustomMFC_FIND_REQUIRED)
SET(MFC_FIND_REQUIRED TRUE)
ENDIF(CustomMFC_FIND_REQUIRED)
ENDIF()
IF(NOT MFC_DIR)
# If MFC have been found, remember their directory
IF(VC_DIR)
SET(MFC_STANDARD_DIR "${VC_DIR}/atlmfc")
ENDIF(VC_DIR)
ENDIF()
FIND_PATH(MFC_DIR
include/afxwin.h
HINTS
${MFC_STANDARD_DIR}
)
ENDIF(NOT MFC_DIR)
ENDIF()
# Display an error message if MFC are not found, MFC_FOUND is updated
# User will be able to update MFC_DIR to the correct directory
@ -33,9 +33,9 @@ IF(MFC_FOUND)
# Using 32 or 64 bits libraries
IF(TARGET_X64)
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib/amd64")
ELSE(TARGET_X64)
ELSE()
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib")
ENDIF(TARGET_X64)
ENDIF()
# Add MFC libraries directory to default library path
LINK_DIRECTORIES(${MFC_LIBRARY_DIR})

View file

@ -8,7 +8,7 @@
if(DSOUND_INCLUDE_DIR)
# Already in cache, be silent
set(DSOUND_FIND_QUIETLY TRUE)
endif(DSOUND_INCLUDE_DIR)
ENDIF()
find_path(DSOUND_INCLUDE_DIR dsound.h
"$ENV{DXSDK_DIR}"
@ -29,8 +29,8 @@ find_package_handle_standard_args(DSOUND DEFAULT_MSG
if(DSOUND_FOUND)
set(DSOUND_LIBRARIES ${DSOUND_LIBRARY})
else(DSOUND_FOUND)
ELSE()
set(DSOUND_LIBRARIES)
endif(DSOUND_FOUND)
ENDIF()
mark_as_advanced(DSOUND_INCLUDE_DIR DSOUND_LIBRARY)

View file

@ -8,7 +8,7 @@
IF(DXSDK_DIR)
# Already in cache, be silent
SET(DXSDK_FIND_QUIETLY TRUE)
ENDIF(DXSDK_DIR)
ENDIF()
FIND_PATH(DXSDK_DIR
"Include/dxsdkver.h"

View file

@ -7,7 +7,7 @@
IF(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR)
# in cache already
SET(EFXUTIL_FIND_QUIETLY TRUE)
ENDIF(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR)
ENDIF()
FIND_PATH(EFXUTIL_INCLUDE_DIR
@ -42,9 +42,9 @@ IF(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR)
SET(EFXUTIL_FOUND "YES")
IF(NOT EFXUTIL_FIND_QUIETLY)
MESSAGE(STATUS "Found EFX-Util: ${EFXUTIL_LIBRARY}")
ENDIF(NOT EFXUTIL_FIND_QUIETLY)
ELSE(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR)
ENDIF()
ELSE()
IF(NOT EFXUTIL_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find EFX-Util!")
ENDIF(NOT EFXUTIL_FIND_QUIETLY)
ENDIF(EFXUTIL_LIBRARY AND EFXUTIL_INCLUDE_DIR)
ENDIF()
ENDIF()

View file

@ -16,7 +16,7 @@ IF(WITH_STLPORT)
SET(EXTERNAL_TEMP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external_stlport ${CMAKE_CURRENT_SOURCE_DIR}/../external_stlport ${EXTERNAL_TEMP_PATH})
SET(EXTERNAL_TEMP_FILE "include/stlport/string")
SET(EXTERNAL_NAME "external with STLport")
ENDIF(WITH_STLPORT)
ENDIF()
FIND_PATH(EXTERNAL_PATH
${EXTERNAL_TEMP_FILE}

View file

@ -7,7 +7,7 @@
IF(FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
# in cache already
SET(FMOD_FIND_QUIETLY TRUE)
ENDIF(FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
ENDIF()
FIND_PATH(FMOD_INCLUDE_DIR
@ -25,9 +25,9 @@ FIND_PATH(FMOD_INCLUDE_DIR
IF(TARGET_X64)
SET(FMOD_LIBRARY_NAMES fmod64 fmod)
ELSE(TARGET_X64)
ELSE()
SET(FMOD_LIBRARY_NAMES fmodvc fmod)
ENDIF(TARGET_X64)
ENDIF()
FIND_LIBRARY(FMOD_LIBRARY
NAMES
@ -49,9 +49,9 @@ IF(FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
SET(FMOD_FOUND "YES")
IF(NOT FMOD_FIND_QUIETLY)
MESSAGE(STATUS "Found FMOD: ${FMOD_LIBRARY}")
ENDIF(NOT FMOD_FIND_QUIETLY)
ELSE(FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
ENDIF()
ELSE()
IF(NOT FMOD_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find FMOD!")
ENDIF(NOT FMOD_FIND_QUIETLY)
ENDIF(FMOD_LIBRARY AND FMOD_INCLUDE_DIR)
ENDIF()
ENDIF()

View file

@ -7,7 +7,7 @@
IF(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIRS)
# in cache already
SET(Freetype_FIND_QUIETLY TRUE)
ENDIF(FREETYPE_LIBRARIES AND FREETYPE_INCLUDE_DIRS)
ENDIF()
FIND_PATH(FREETYPE_INCLUDE_DIRS
freetype
@ -24,7 +24,7 @@ FIND_PATH(FREETYPE_INCLUDE_DIRS
IF(NOT FREETYPE_INCLUDE_DIRS)
SET(FREETYPE_INCLUDE_DIRS "")
ENDIF(NOT FREETYPE_INCLUDE_DIRS)
ENDIF()
# ft2build.h does not reside in the freetype include dir
FIND_PATH(FREETYPE_ADDITIONAL_INCLUDE_DIR
@ -42,7 +42,7 @@ FIND_PATH(FREETYPE_ADDITIONAL_INCLUDE_DIR
# combine both include directories into one variable
IF(FREETYPE_ADDITIONAL_INCLUDE_DIR)
SET(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${FREETYPE_ADDITIONAL_INCLUDE_DIR})
ENDIF(FREETYPE_ADDITIONAL_INCLUDE_DIR)
ENDIF()
FIND_LIBRARY(FREETYPE_LIBRARY_RELEASE
NAMES freetype libfreetype freetype219 freetype246
@ -89,8 +89,8 @@ IF(FREETYPE_INCLUDE_DIRS)
# Case where Freetype is compiled from sources (debug version is compiled by default)
SET(FREETYPE_FOUND ON)
SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY_DEBUG})
ENDIF(FREETYPE_LIBRARY_RELEASE AND FREETYPE_LIBRARY_DEBUG)
ENDIF(FREETYPE_INCLUDE_DIRS)
ENDIF()
ENDIF()
IF(FREETYPE_FOUND)
IF(WITH_STATIC_EXTERNAL AND APPLE)
@ -98,13 +98,13 @@ IF(FREETYPE_FOUND)
IF(BZIP2_FOUND)
SET(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIRS} ${BZIP2_INCLUDE_DIR})
SET(FREETYPE_LIBRARIES ${FREETYPE_LIBRARIES} ${BZIP2_LIBRARIES})
ENDIF(BZIP2_FOUND)
ENDIF(WITH_STATIC_EXTERNAL AND APPLE)
ENDIF()
ENDIF()
IF(NOT Freetype_FIND_QUIETLY)
MESSAGE(STATUS "Found FreeType: ${FREETYPE_LIBRARIES}")
ENDIF(NOT Freetype_FIND_QUIETLY)
ELSE(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS)
ENDIF()
ELSE()
IF(NOT Freetype_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find FreeType!")
ENDIF(NOT Freetype_FIND_QUIETLY)
ENDIF(FREETYPE_FOUND)
ENDIF()
ENDIF()

View file

@ -20,7 +20,7 @@ FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv c PATHS /opt/local)
IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
SET(ICONV_FOUND TRUE)
ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
ENDIF()
set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})
@ -29,7 +29,7 @@ IF(ICONV_FOUND)
set (CMAKE_C_FLAGS_BACKUP "${CMAKE_C_FLAGS}")
if(ICONV_HAVE_WERROR)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
endif(ICONV_HAVE_WERROR)
ENDIF()
check_c_source_compiles("
#include <iconv.h>
int main(){
@ -43,19 +43,19 @@ IF(ICONV_FOUND)
}
" ICONV_SECOND_ARGUMENT_IS_CONST )
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_BACKUP}")
ENDIF(ICONV_FOUND)
ENDIF()
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_LIBRARIES)
IF(ICONV_FOUND)
IF(NOT ICONV_FIND_QUIETLY)
MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}")
ENDIF(NOT ICONV_FIND_QUIETLY)
ELSE(ICONV_FOUND)
ENDIF()
ELSE()
IF(Iconv_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find Iconv")
ENDIF(Iconv_FIND_REQUIRED)
ENDIF(ICONV_FOUND)
ENDIF()
ENDIF()
MARK_AS_ADVANCED(
ICONV_INCLUDE_DIR

View file

@ -7,7 +7,7 @@
IF(JPEG_LIBRARY AND JPEG_INCLUDE_DIR)
# in cache already
SET(JPEG_FIND_QUIETLY TRUE)
ENDIF(JPEG_LIBRARY AND JPEG_INCLUDE_DIR)
ENDIF()
FIND_PATH(JPEG_INCLUDE_DIR
@ -42,9 +42,9 @@ IF(JPEG_LIBRARY AND JPEG_INCLUDE_DIR)
SET(JPEG_FOUND "YES")
IF(NOT JPEG_FIND_QUIETLY)
MESSAGE(STATUS "Found Jpeg: ${JPEG_LIBRARY}")
ENDIF(NOT JPEG_FIND_QUIETLY)
ELSE(JPEG_LIBRARY AND JPEG_INCLUDE_DIR)
ENDIF()
ELSE()
IF(NOT JPEG_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Jpeg!")
ENDIF(NOT JPEG_FIND_QUIETLY)
ENDIF(JPEG_LIBRARY AND JPEG_INCLUDE_DIR)
ENDIF()
ENDIF()

View file

@ -7,10 +7,11 @@
IF(LIBOVR_LIBRARIES AND LIBOVR_INCLUDE_DIR)
# in cache already
SET(LIBOVR_FIND_QUIETLY TRUE)
ENDIF(LIBOVR_LIBRARIES AND LIBOVR_INCLUDE_DIR)
ENDIF()
FIND_PATH(LIBOVR_INCLUDE_DIR
OVR.h
NAMES
OVR.h OVR_CAPI.h
PATHS
$ENV{LIBOVR_DIR}/Include
/usr/local/include
@ -24,18 +25,18 @@ FIND_PATH(LIBOVR_INCLUDE_DIR
IF(UNIX)
IF(TARGET_X64)
SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/Linux/Release/x86_64")
ELSE(TARGET_X64)
ELSE()
SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/Linux/Release/i386")
ENDIF(TARGET_X64)
ENDIF()
ELSEIF(APPLE)
SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/MacOS/Release")
ELSEIF(WIN32)
IF(TARGET_X64)
SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/x64")
ELSE(TARGET_X64)
ELSE()
SET(LIBOVR_LIBRARY_BUILD_PATH "Lib/Win32")
ENDIF(TARGET_X64)
ENDIF(UNIX)
ENDIF()
ENDIF()
FIND_LIBRARY(LIBOVR_LIBRARY
NAMES ovr libovr
@ -55,17 +56,17 @@ FIND_LIBRARY(LIBOVR_LIBRARY
IF(LIBOVR_LIBRARY AND LIBOVR_INCLUDE_DIR)
IF(NOT LIBOVR_FIND_QUIETLY)
MESSAGE(STATUS "Found LibOVR: ${LIBOVR_LIBRARY}")
ENDIF(NOT LIBOVR_FIND_QUIETLY)
ENDIF()
SET(LIBOVR_FOUND "YES")
SET(LIBOVR_DEFINITIONS "-DHAVE_LIBOVR")
SET(NL_STEREO_AVAILABLE ON)
IF(UNIX)
SET(LIBOVR_LIBRARIES ${LIBOVR_LIBRARY} X11 Xinerama udev pthread)
ELSE(UNIX)
ELSE()
SET(LIBOVR_LIBRARIES ${LIBOVR_LIBRARY})
ENDIF(UNIX)
ELSE(LIBOVR_LIBRARY AND LIBOVR_INCLUDE_DIR)
ENDIF()
ELSE()
IF(NOT LIBOVR_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find LibOVR!")
ENDIF(NOT LIBOVR_FIND_QUIETLY)
ENDIF(LIBOVR_LIBRARY AND LIBOVR_INCLUDE_DIR)
ENDIF()
ENDIF()

View file

@ -7,7 +7,7 @@
IF(LIBVR_LIBRARIES AND LIBVR_INCLUDE_DIR)
# in cache already
SET(LIBVR_FIND_QUIETLY TRUE)
ENDIF(LIBVR_LIBRARIES AND LIBVR_INCLUDE_DIR)
ENDIF()
FIND_PATH(LIBVR_INCLUDE_DIR hmd.h
PATH_SUFFIXES include/LibVR
@ -22,12 +22,12 @@ FIND_LIBRARY(LIBVR_LIBRARY
IF(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR)
IF(NOT LIBVR_FIND_QUIETLY)
MESSAGE(STATUS "Found LibVR: ${LIBVR_LIBRARY}")
ENDIF(NOT LIBVR_FIND_QUIETLY)
ENDIF()
SET(LIBVR_FOUND "YES")
SET(LIBVR_DEFINITIONS "-DHAVE_LIBVR")
SET(NL_STEREO_AVAILABLE ON)
ELSE(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR)
ELSE()
IF(NOT LIBVR_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find LibVR!")
ENDIF(NOT LIBVR_FIND_QUIETLY)
ENDIF(LIBVR_LIBRARY AND LIBVR_INCLUDE_DIR)
ENDIF()
ENDIF()

View file

@ -143,7 +143,7 @@ ENDIF()
IF(WITH_STLPORT)
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlportd)
ENDIF(WITH_STLPORT)
ENDIF()
# generic libraries names
LIST(APPEND LIBRARY_NAME_RELEASE luabind libluabind)
@ -194,7 +194,7 @@ IF(LUABIND_INCLUDE_DIR AND Boost_INCLUDE_DIR)
# Case where Luabind is compiled from sources (debug version is compiled by default)
SET(LUABIND_FOUND TRUE)
SET(LUABIND_LIBRARIES ${LUABIND_LIBRARY_DEBUG})
ENDIF(LUABIND_LIBRARY_RELEASE AND LUABIND_LIBRARY_DEBUG)
ENDIF()
ENDIF()
IF(LUABIND_FOUND)
@ -209,11 +209,11 @@ IF(LUABIND_FOUND)
IF(NOT Luabind_FIND_QUIETLY)
MESSAGE(STATUS "Found Luabind: ${LUABIND_LIBRARIES}")
ENDIF(NOT Luabind_FIND_QUIETLY)
ENDIF()
ELSE()
IF(NOT Luabind_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Luabind!")
ENDIF()
ENDIF(LUABIND_FOUND)
ENDIF()
MARK_AS_ADVANCED(LUABIND_LIBRARY_RELEASE LUABIND_LIBRARY_DEBUG Boost_LIB_DIAGNOSTIC_DEFINITIONS)

View file

@ -7,7 +7,7 @@
IF(OGG_LIBRARY AND OGG_INCLUDE_DIR)
# in cache already
SET(OGG_FIND_QUIETLY TRUE)
ENDIF(OGG_LIBRARY AND OGG_INCLUDE_DIR)
ENDIF()
FIND_PATH(OGG_INCLUDE_DIR
@ -41,9 +41,9 @@ IF(OGG_LIBRARY AND OGG_INCLUDE_DIR)
SET(OGG_FOUND "YES")
IF(NOT OGG_FIND_QUIETLY)
MESSAGE(STATUS "Found Ogg: ${OGG_LIBRARY}")
ENDIF(NOT OGG_FIND_QUIETLY)
ELSE(OGG_LIBRARY AND OGG_INCLUDE_DIR)
ENDIF()
ELSE()
IF(NOT OGG_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Ogg!")
ENDIF(NOT OGG_FIND_QUIETLY)
ENDIF(OGG_LIBRARY AND OGG_INCLUDE_DIR)
ENDIF()
ENDIF()

View file

@ -43,7 +43,7 @@ IF(OPENGLES_GLES_LIBRARY)
IF(OPENGLES_EGL_LIBRARY)
SET(OPENGLES_EGL_FOUND "YES")
SET(OPENGLES_LIBRARIES ${OPENGLES_EGL_LIBRARY} ${OPENGLES_LIBRARIES})
ELSE(OPENGLES_EGL_LIBRARY)
ELSE()
SET(OPENGLES_EGL_FOUND "NO")
ENDIF(OPENGLES_EGL_LIBRARY)
ENDIF(OPENGLES_GLES_LIBRARY)
ENDIF()
ENDIF()

View file

@ -9,7 +9,7 @@
IF(STLPORT_LIBRARIES AND STLPORT_INCLUDE_DIR)
# in cache already
SET(STLPORT_FIND_QUIETLY TRUE)
ENDIF(STLPORT_LIBRARIES AND STLPORT_INCLUDE_DIR)
ENDIF()
FIND_PATH(STLPORT_INCLUDE_DIR
iostream
@ -74,18 +74,18 @@ IF(STLPORT_INCLUDE_DIR)
SET(STLPORT_LIBRARIES ${STLPORT_LIBRARY_RELEASE})
IF(STLPORT_LIBRARY_DEBUG)
SET(STLPORT_LIBRARIES optimized ${STLPORT_LIBRARIES} debug ${STLPORT_LIBRARY_DEBUG})
ENDIF(STLPORT_LIBRARY_DEBUG)
ENDIF(STLPORT_LIBRARY_RELEASE)
ENDIF(STLPORT_INCLUDE_DIR)
ENDIF()
ENDIF()
ENDIF()
IF(STLPORT_FOUND)
IF(NOT STLPORT_FIND_QUIETLY)
MESSAGE(STATUS "Found STLport: ${STLPORT_LIBRARIES}")
ENDIF(NOT STLPORT_FIND_QUIETLY)
ELSE(STLPORT_FOUND)
ENDIF()
ELSE()
IF(NOT STLPORT_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find STLport!")
ENDIF(NOT STLPORT_FIND_QUIETLY)
ENDIF(STLPORT_FOUND)
ENDIF()
ENDIF()
MARK_AS_ADVANCED(STLPORT_LIBRARY_RELEASE STLPORT_LIBRARY_DEBUG)

View file

@ -10,7 +10,7 @@
IF(SQUISH_LIBRARIES AND SQUISH_INCLUDE_DIR)
# in cache already
SET(SQUISH_FIND_QUIETLY TRUE)
ENDIF(SQUISH_LIBRARIES AND SQUISH_INCLUDE_DIR)
ENDIF()
FIND_PATH(SQUISH_INCLUDE_DIR
squish.h
@ -58,26 +58,26 @@ IF(SQUISH_INCLUDE_DIR)
SET(SQUISH_LIBRARIES "optimized;${SQUISH_LIBRARY_RELEASE}")
IF(SQUISH_LIBRARY_DEBUG)
SET(SQUISH_LIBRARIES "${SQUISH_LIBRARIES};debug;${SQUISH_LIBRARY_DEBUG}")
ELSE(SQUISH_LIBRARY_DEBUG)
ELSE()
SET(SQUISH_LIBRARIES "${SQUISH_LIBRARIES};debug;${SQUISH_LIBRARY_RELEASE}")
MESSAGE("Debug Squish NOT found, using the release version!")
ENDIF(SQUISH_LIBRARY_DEBUG)
ENDIF(SQUISH_LIBRARY_RELEASE)
ENDIF(SQUISH_INCLUDE_DIR)
ENDIF()
ENDIF()
ENDIF()
IF(SQUISH_FOUND)
IF(NOT SQUISH_FIND_QUIETLY)
MESSAGE(STATUS "Found Squish: ${SQUISH_LIBRARIES}")
ENDIF(NOT SQUISH_FIND_QUIETLY)
ENDIF()
FILE(STRINGS ${SQUISH_INCLUDE_DIR}/squish.h METRIC REGEX "metric = 0")
IF(METRIC)
SET(SQUISH_COMPRESS_HAS_METRIC ON)
SET(SQUISH_DEFINITIONS -DSQUISH_COMPRESS_HAS_METRIC)
ENDIF(METRIC)
ELSE(SQUISH_FOUND)
ENDIF()
ELSE()
IF(NOT SQUISH_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Squish!")
ENDIF(NOT SQUISH_FIND_QUIETLY)
ENDIF(SQUISH_FOUND)
ENDIF()
ENDIF()
MARK_AS_ADVANCED(SQUISH_LIBRARY_RELEASE SQUISH_LIBRARY_DEBUG)

View file

@ -7,7 +7,7 @@
IF(VORBIS_LIBRARY AND VORBIS_INCLUDE_DIR)
# in cache already
SET(VORBIS_FIND_QUIETLY TRUE)
ENDIF(VORBIS_LIBRARY AND VORBIS_INCLUDE_DIR)
ENDIF()
FIND_PATH(VORBIS_INCLUDE_DIR
@ -57,9 +57,9 @@ IF(VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBIS_INCLUDE_DIR)
SET(VORBIS_LIBRARIES ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY})
IF(NOT VORBIS_FIND_QUIETLY)
MESSAGE(STATUS "Found Vorbis: ${VORBIS_LIBRARY}")
ENDIF(NOT VORBIS_FIND_QUIETLY)
ELSE(VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBIS_INCLUDE_DIR)
ENDIF()
ELSE()
IF(NOT VORBIS_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Vorbis!")
ENDIF(NOT VORBIS_FIND_QUIETLY)
ENDIF(VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBIS_INCLUDE_DIR)
ENDIF()
ENDIF()

View file

@ -7,7 +7,7 @@
IF(XF86VidMode_LIBRARY AND XF86VidMode_INCLUDE_DIR)
# in cache already
SET(XF86VidMode_FIND_QUIETLY TRUE)
ENDIF(XF86VidMode_LIBRARY AND XF86VidMode_INCLUDE_DIR)
ENDIF()
FIND_PATH(XF86VidMode_INCLUDE_DIR
@ -37,10 +37,10 @@ IF(XF86VidMode_LIBRARY AND XF86VidMode_INCLUDE_DIR)
SET(XF86VidMode_DEFINITIONS -DXF86VIDMODE)
IF(NOT XF86VidMode_FIND_QUIETLY)
MESSAGE(STATUS "Found XF86VidMode: ${XF86VidMode_LIBRARY}")
ENDIF(NOT XF86VidMode_FIND_QUIETLY)
ELSE(XF86VidMode_LIBRARY AND XF86VidMode_INCLUDE_DIR)
ENDIF()
ELSE()
IF(NOT XF86VidMode_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find XF86VidMode!")
ENDIF(NOT XF86VidMode_FIND_QUIETLY)
ENDIF(XF86VidMode_LIBRARY AND XF86VidMode_INCLUDE_DIR)
ENDIF()
ENDIF()

View file

@ -33,17 +33,29 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
SET(PCH_ARCHS)
SET(_FLAGS)
LIST(APPEND _FLAGS ${CMAKE_CXX_FLAGS})
# C++ flags
SET(_FLAG ${CMAKE_CXX_FLAGS})
SEPARATE_ARGUMENTS(_FLAG)
LIST(APPEND _FLAGS ${_FLAG})
# C++ config flags
STRING(TOUPPER "${CMAKE_BUILD_TYPE}" _UPPER_BUILD)
LIST(APPEND _FLAGS " ${CMAKE_CXX_FLAGS_${_UPPER_BUILD}}")
SET(_FLAG ${CMAKE_CXX_FLAGS_${_UPPER_BUILD}})
SEPARATE_ARGUMENTS(_FLAG)
LIST(APPEND _FLAGS ${_FLAG})
GET_TARGET_PROPERTY(_targetType ${_target} TYPE)
SET(_USE_PIC OFF)
IF(${_targetType} STREQUAL "SHARED_LIBRARY" OR ${_targetType} STREQUAL "MODULE_LIBRARY")
LIST(APPEND _FLAGS " ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}")
SET(_FLAG ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
SEPARATE_ARGUMENTS(_FLAG)
LIST(APPEND _FLAGS ${_FLAG})
ELSE()
GET_TARGET_PROPERTY(_pic ${_target} POSITION_INDEPENDENT_CODE)
IF(_pic)
@ -53,67 +65,71 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES)
FOREACH(item ${DIRINC})
LIST(APPEND _FLAGS " -I\"${item}\"")
LIST(APPEND _FLAGS -I"${item}")
ENDFOREACH()
# NOTE: As cmake files (eg FindQT4) may now use generator expressions around their defines that evaluate
# to an empty string, wrap all "items" in an expression that outputs a -D IFF the generated
# expression is not empty.
# Required for CMake 2.6
SET(GLOBAL_DEFINITIONS)
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS)
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
LIST(APPEND GLOBAL_DEFINITIONS "$<$<BOOL:${item}>:-D$<JOIN:${item},-D>>")
ENDFOREACH()
ENDIF()
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS_${_UPPER_BUILD})
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
LIST(APPEND GLOBAL_DEFINITIONS "$<$<BOOL:${item}>:-D$<JOIN:${item},-D>>")
ENDFOREACH()
ENDIF()
GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS)
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
LIST(APPEND GLOBAL_DEFINITIONS "$<$<BOOL:${item}>:-D$<JOIN:${item},-D>>")
ENDFOREACH()
ENDIF()
GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS_${_UPPER_BUILD})
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
LIST(APPEND GLOBAL_DEFINITIONS "$<$<BOOL:${item}>:-D$<JOIN:${item},-D>>")
ENDFOREACH()
ENDIF()
GET_TARGET_PROPERTY(oldProps ${_target} COMPILE_FLAGS)
IF(oldProps)
LIST(APPEND _FLAGS " ${oldProps}")
LIST(APPEND _FLAGS ${oldProps})
ENDIF()
GET_TARGET_PROPERTY(oldPropsBuild ${_target} COMPILE_FLAGS_${_UPPER_BUILD})
IF(oldPropsBuild)
LIST(APPEND _FLAGS " ${oldPropsBuild}")
LIST(APPEND _FLAGS ${oldPropsBuild})
ENDIF()
GET_TARGET_PROPERTY(DIRINC ${_target} INCLUDE_DIRECTORIES)
IF(DIRINC)
FOREACH(item ${DIRINC})
LIST(APPEND _FLAGS " -I\"${item}\"")
LIST(APPEND _FLAGS -I"${item}")
ENDFOREACH()
ENDIF()
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS)
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
LIST(APPEND GLOBAL_DEFINITIONS "$<$<BOOL:${item}>:-D$<JOIN:${item},-D>>")
ENDFOREACH()
ENDIF()
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS_${_UPPER_BUILD})
IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS})
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
LIST(APPEND GLOBAL_DEFINITIONS "$<$<BOOL:${item}>:-D$<JOIN:${item},-D>>")
ENDFOREACH()
ENDIF()
@ -126,7 +142,7 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
IF(_DIRS)
FOREACH(item ${_DIRS})
LIST(APPEND GLOBAL_DEFINITIONS " -I\"${item}\"")
LIST(APPEND GLOBAL_DEFINITIONS -I"${item}")
ENDFOREACH()
ENDIF()
@ -135,10 +151,7 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
IF(_DEFINITIONS)
FOREACH(item ${_DEFINITIONS})
# don't use dynamic expressions
IF(NOT item MATCHES "\\$<")
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
ENDIF()
LIST(APPEND GLOBAL_DEFINITIONS "$<$<BOOL:${item}>:-D$<JOIN:${item},-D>>")
ENDFOREACH()
ENDIF()
ENDIF()
@ -158,28 +171,26 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
ENDIF()
IF(_USE_PIC)
LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIC}")
LIST(APPEND _FLAGS ${CMAKE_CXX_COMPILE_OPTIONS_PIC})
ENDIF()
ENDIF()
LIST(APPEND _FLAGS " ${GLOBAL_DEFINITIONS}")
IF(CMAKE_VERSION VERSION_LESS "3.3.0")
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS)
LIST(APPEND _FLAGS " ${_directory_flags}")
LIST(APPEND _FLAGS " ${_directory_definitions}")
LIST(APPEND _FLAGS ${_directory_flags})
LIST(APPEND _FLAGS ${_directory_definitions})
ENDIF()
# Format definitions
IF(MSVC)
# Fix path with space
SEPARATE_ARGUMENTS(_FLAGS UNIX_COMMAND "${_FLAGS}")
ELSE()
STRING(REGEX REPLACE " +" " " _FLAGS ${_FLAGS})
SEPARATE_ARGUMENTS(_FLAGS)
ENDIF()
# Already in list form and items may contain non-leading spaces that should not be split on
LIST(INSERT _FLAGS 0 "${GLOBAL_DEFINITIONS}")
IF(CLANG)
# Determining all architectures and get common flags
SET(_ARCH_NEXT)
@ -236,6 +247,7 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
ENDIF()
IF(PCH_FLAGS)
LIST(REMOVE_ITEM PCH_FLAGS "")
LIST(REMOVE_DUPLICATES PCH_FLAGS)
ENDIF()
ENDMACRO()
@ -247,16 +259,16 @@ MACRO(GET_PDB_FILENAME _out_filename _target)
SET(_targetOutput ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
ELSEIF(${_targetType} STREQUAL STATIC_LIBRARY)
SET(_targetOutput ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
ELSE(${_targetType} STREQUAL EXECUTABLE)
ELSE()
SET(_targetOutput ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
ENDIF(${_targetType} STREQUAL EXECUTABLE)
ENDIF()
# determine target postfix
STRING(TOUPPER "${CMAKE_BUILD_TYPE}_POSTFIX" _postfix_var_name)
GET_TARGET_PROPERTY(_targetPostfix ${_target} ${_postfix_var_name})
IF(${_targetPostfix} MATCHES NOTFOUND)
SET(_targetPostfix "")
ENDIF(${_targetPostfix} MATCHES NOTFOUND)
ENDIF()
SET(${_out_filename} "${_targetOutput}/${_target}${_targetPostfix}.pdb")
ENDMACRO(GET_PDB_FILENAME)

View file

@ -4,7 +4,7 @@ SET(CMAKE_TRY_COMPILE_CONFIGURATION "Release")
# Force Release configuration by default
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
ENDIF()
# Declare CMAKE_CONFIGURATION_TYPES before PROJECT
SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
@ -17,7 +17,7 @@ MACRO(NL_GEN_PC name)
IF(NOT WIN32 AND WITH_INSTALL_LIBRARIES)
CONFIGURE_FILE(${name}.in "${CMAKE_CURRENT_BINARY_DIR}/${name}")
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}" DESTINATION ${NL_LIB_PREFIX}/pkgconfig)
ENDIF(NOT WIN32 AND WITH_INSTALL_LIBRARIES)
ENDIF()
ENDMACRO(NL_GEN_PC)
###
@ -26,9 +26,9 @@ ENDMACRO(NL_GEN_PC)
MACRO(NL_TARGET_LIB name)
IF(WITH_STATIC)
ADD_LIBRARY(${name} STATIC ${ARGN})
ELSE(WITH_STATIC)
ELSE()
ADD_LIBRARY(${name} SHARED ${ARGN})
ENDIF(WITH_STATIC)
ENDIF()
ENDMACRO(NL_TARGET_LIB)
###
@ -37,9 +37,9 @@ ENDMACRO(NL_TARGET_LIB)
MACRO(NL_TARGET_DRIVER name)
IF(WITH_STATIC_DRIVERS)
ADD_LIBRARY(${name} STATIC ${ARGN})
ELSE(WITH_STATIC_DRIVERS)
ELSE()
ADD_LIBRARY(${name} MODULE ${ARGN})
ENDIF(WITH_STATIC_DRIVERS)
ENDIF()
ENDMACRO(NL_TARGET_DRIVER)
###
@ -64,16 +64,35 @@ MACRO(NL_DEFAULT_PROPS name label)
VERSION ${NL_VERSION} SOVERSION ${NL_VERSION_MAJOR})
IF(NL_LIB_PREFIX)
SET_TARGET_PROPERTIES(${name} PROPERTIES INSTALL_NAME_DIR ${NL_LIB_PREFIX})
ENDIF(NL_LIB_PREFIX)
ENDIF(${type} STREQUAL SHARED_LIBRARY)
ENDIF()
ENDIF()
IF(${type} STREQUAL EXECUTABLE AND WIN32 AND NOT MINGW)
# check if using a GUI
GET_TARGET_PROPERTY(_VALUE ${name} WIN32_EXECUTABLE)
IF(TARGET_X64)
# Target Windows XP 64 bits
SET(_SUBSYSTEM_VERSION "5.02")
ELSE()
# Target Windows XP
SET(_SUBSYSTEM_VERSION "5.01")
ENDIF()
IF(_VALUE)
# GUI
SET(_SUBSYSTEM "WINDOWS")
ELSE()
# Console
SET(_SUBSYSTEM "CONSOLE")
ENDIF()
SET_TARGET_PROPERTIES(${name} PROPERTIES
VERSION ${NL_VERSION}
SOVERSION ${NL_VERSION_MAJOR}
COMPILE_FLAGS "/GA"
LINK_FLAGS "/VERSION:${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}")
ENDIF(${type} STREQUAL EXECUTABLE AND WIN32 AND NOT MINGW)
LINK_FLAGS "/VERSION:${NL_VERSION_MAJOR}.${NL_VERSION_MINOR} /SUBSYSTEM:${_SUBSYSTEM},${_SUBSYSTEM_VERSION}")
ENDIF()
ENDMACRO(NL_DEFAULT_PROPS)
###
@ -83,7 +102,7 @@ ENDMACRO(NL_DEFAULT_PROPS)
MACRO(NL_ADD_LIB_SUFFIX name)
IF(WIN32)
SET_TARGET_PROPERTIES(${name} PROPERTIES DEBUG_POSTFIX "_d" RELEASE_POSTFIX "_r")
ENDIF(WIN32)
ENDIF()
ENDMACRO(NL_ADD_LIB_SUFFIX)
###
@ -95,10 +114,10 @@ MACRO(NL_ADD_RUNTIME_FLAGS name)
# SET_TARGET_PROPERTIES(${name} PROPERTIES
# LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}"
# LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}")
ENDIF(WIN32)
ENDIF()
IF(WITH_STLPORT)
TARGET_LINK_LIBRARIES(${name} ${STLPORT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
ENDIF(WITH_STLPORT)
ENDIF()
ENDMACRO(NL_ADD_RUNTIME_FLAGS)
MACRO(NL_ADD_STATIC_VID_DRIVERS name)
@ -106,25 +125,25 @@ MACRO(NL_ADD_STATIC_VID_DRIVERS name)
IF(WIN32)
IF(WITH_DRIVER_DIRECT3D)
TARGET_LINK_LIBRARIES(${name} nel_drv_direct3d_win)
ENDIF(WITH_DRIVER_DIRECT3D)
ENDIF(WIN32)
ENDIF()
ENDIF()
IF(WITH_DRIVER_OPENGL)
IF(WIN32)
TARGET_LINK_LIBRARIES(${name} nel_drv_opengl_win)
ELSE(WIN32)
ELSE()
TARGET_LINK_LIBRARIES(${name} nel_drv_opengl)
ENDIF(WIN32)
ENDIF(WITH_DRIVER_OPENGL)
ENDIF()
ENDIF()
IF(WITH_DRIVER_OPENGLES)
IF(WIN32)
TARGET_LINK_LIBRARIES(${name} nel_drv_opengles_win)
ELSE(WIN32)
ELSE()
TARGET_LINK_LIBRARIES(${name} nel_drv_opengles)
ENDIF(WIN32)
ENDIF(WITH_DRIVER_OPENGLES)
ENDIF(WITH_STATIC_DRIVERS)
ENDIF()
ENDIF()
ENDIF()
ENDMACRO(NL_ADD_STATIC_VID_DRIVERS)
MACRO(NL_ADD_STATIC_SND_DRIVERS name)
@ -132,30 +151,30 @@ MACRO(NL_ADD_STATIC_SND_DRIVERS name)
IF(WIN32)
IF(WITH_DRIVER_DSOUND)
TARGET_LINK_LIBRARIES(${name} nel_drv_dsound_win)
ENDIF(WITH_DRIVER_DSOUND)
ENDIF()
IF(WITH_DRIVER_XAUDIO2)
TARGET_LINK_LIBRARIES(${name} nel_drv_xaudio2_win)
ENDIF(WITH_DRIVER_XAUDIO2)
ENDIF()
IF(WITH_DRIVER_OPENAL)
TARGET_LINK_LIBRARIES(${name} nel_drv_openal_win)
ENDIF(WITH_DRIVER_OPENAL)
ENDIF()
IF(WITH_DRIVER_FMOD)
TARGET_LINK_LIBRARIES(${name} nel_drv_fmod_win)
ENDIF(WITH_DRIVER_FMOD)
ELSE(WIN32)
ENDIF()
ELSE()
IF(WITH_DRIVER_OPENAL)
TARGET_LINK_LIBRARIES(${name} nel_drv_openal)
ENDIF(WITH_DRIVER_OPENAL)
ENDIF()
IF(WITH_DRIVER_FMOD)
TARGET_LINK_LIBRARIES(${name} nel_drv_fmod)
ENDIF(WITH_DRIVER_FMOD)
ENDIF(WIN32)
ENDIF()
ENDIF()
ENDIF(WITH_STATIC_DRIVERS)
ENDIF()
ENDMACRO(NL_ADD_STATIC_SND_DRIVERS)
###
@ -173,14 +192,14 @@ Remove the CMakeCache.txt file and try again from another folder, e.g.:
cd cmake
cmake ..
")
ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
ENDIF()
ENDMACRO(CHECK_OUT_OF_SOURCE)
MACRO(NL_SETUP_DEFAULT_OPTIONS)
IF(WITH_QT)
OPTION(WITH_STUDIO "Build Core Studio" OFF )
ENDIF(WITH_QT)
ENDIF()
###
# Features
@ -194,30 +213,30 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS)
# Default to static building on Windows.
IF(WIN32)
OPTION(WITH_STATIC "With static libraries." ON )
ELSE(WIN32)
ELSE()
OPTION(WITH_STATIC "With static libraries." OFF)
ENDIF(WIN32)
ENDIF()
IF (WITH_STATIC)
OPTION(WITH_STATIC_LIBXML2 "With static libxml2" ON )
ELSE(WITH_STATIC)
ELSE()
OPTION(WITH_STATIC_LIBXML2 "With static libxml2" OFF)
ENDIF(WITH_STATIC)
ENDIF()
IF (WITH_STATIC)
OPTION(WITH_STATIC_CURL "With static curl" ON )
ELSE(WITH_STATIC)
ELSE()
OPTION(WITH_STATIC_CURL "With static curl" OFF)
ENDIF(WITH_STATIC)
ENDIF()
IF(APPLE)
OPTION(WITH_LIBXML2_ICONV "With libxml2 using iconv" ON )
ELSE(APPLE)
ELSE()
OPTION(WITH_LIBXML2_ICONV "With libxml2 using iconv" OFF)
ENDIF(APPLE)
ENDIF()
OPTION(WITH_STATIC_DRIVERS "With static drivers." OFF)
IF(WIN32)
OPTION(WITH_EXTERNAL "With provided external." ON )
ELSE(WIN32)
ELSE()
OPTION(WITH_EXTERNAL "With provided external." OFF)
ENDIF(WIN32)
ENDIF()
OPTION(WITH_STATIC_EXTERNAL "With static external libraries" OFF)
IF(UNIX AND NOT APPLE)
OPTION(WITH_UNIX_STRUCTURE "Use UNIX structure (bin, include, lib)" ON )
@ -237,9 +256,9 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS)
IF(WIN32 AND MFC_FOUND)
OPTION(WITH_MFC "With MFC Support" ON )
ELSE(WIN32 AND MFC_FOUND)
ELSE()
OPTION(WITH_MFC "With MFC Support" OFF)
ENDIF(WIN32 AND MFC_FOUND)
ENDIF()
###
# Optional support
@ -304,7 +323,7 @@ MACRO(NL_SETUP_NEL_DEFAULT_OPTIONS)
IF(NOT MSVC)
OPTION(WITH_GCC_FPMATH_BOTH "With GCC -mfpmath=both" OFF)
ENDIF(NOT MSVC)
ENDIF()
ENDMACRO(NL_SETUP_NEL_DEFAULT_OPTIONS)
MACRO(NL_SETUP_NELNS_DEFAULT_OPTIONS)
@ -334,6 +353,7 @@ MACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS)
OPTION(WITH_RYZOM_PATCH "Enable Ryzom in-game patch support" OFF)
OPTION(WITH_RYZOM_CUSTOM_PATCH_SERVER "Only use patch server from CFG file" OFF)
OPTION(WITH_RYZOM_STEAM "Enable Steam features" OFF)
OPTION(WITH_RYZOM_SANDBOX "Enable Sandbox under OS X" OFF)
ENDMACRO(NL_SETUP_RYZOM_DEFAULT_OPTIONS)
MACRO(NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS)
@ -360,15 +380,15 @@ MACRO(NL_SETUP_BUILD)
IF(CMAKE_BUILD_TYPE MATCHES "Debug")
SET(NL_BUILD_MODE "NL_DEBUG")
ELSE(CMAKE_BUILD_TYPE MATCHES "Debug")
ELSE()
IF(CMAKE_BUILD_TYPE MATCHES "Release")
SET(NL_BUILD_MODE "NL_RELEASE")
ELSE(CMAKE_BUILD_TYPE MATCHES "Release")
ELSE()
SET(NL_BUILD_MODE "NL_RELEASE")
# enforce release mode if it's neither Debug nor Release
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
ENDIF(CMAKE_BUILD_TYPE MATCHES "Release")
ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug")
ENDIF()
ENDIF()
SET(HOST_CPU ${CMAKE_HOST_SYSTEM_PROCESSOR})
@ -376,35 +396,35 @@ MACRO(NL_SETUP_BUILD)
SET(HOST_CPU "x86_64")
ELSEIF(HOST_CPU MATCHES "i.86")
SET(HOST_CPU "x86")
ENDIF(HOST_CPU MATCHES "(amd|AMD)64")
ENDIF()
# Determine target CPU
# If not specified, use the same CPU as host
IF(NOT TARGET_CPU)
SET(TARGET_CPU ${CMAKE_SYSTEM_PROCESSOR})
ENDIF(NOT TARGET_CPU)
ENDIF()
IF(TARGET_CPU MATCHES "(amd|AMD)64")
SET(TARGET_CPU "x86_64")
ELSEIF(TARGET_CPU MATCHES "i.86")
SET(TARGET_CPU "x86")
ENDIF(TARGET_CPU MATCHES "(amd|AMD)64")
ENDIF()
IF(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
SET(CLANG ON)
MESSAGE(STATUS "Using Clang compiler")
ENDIF(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
ENDIF()
IF(CMAKE_GENERATOR MATCHES "Xcode")
SET(XCODE ON)
MESSAGE(STATUS "Generating Xcode project")
ENDIF(CMAKE_GENERATOR MATCHES "Xcode")
ENDIF()
IF(CMAKE_GENERATOR MATCHES "NMake")
SET(NMAKE ON)
MESSAGE(STATUS "Generating NMake project")
ENDIF(CMAKE_GENERATOR MATCHES "NMake")
ENDIF()
# If target and host CPU are the same
IF("${HOST_CPU}" STREQUAL "${TARGET_CPU}" AND NOT CMAKE_CROSSCOMPILING)
@ -413,24 +433,24 @@ MACRO(NL_SETUP_BUILD)
IF(NOT CMAKE_SIZEOF_VOID_P)
INCLUDE (CheckTypeSize)
CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P)
ENDIF(NOT CMAKE_SIZEOF_VOID_P)
ENDIF()
# Using 32 or 64 bits libraries
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(TARGET_CPU "x86_64")
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
ELSE()
SET(TARGET_CPU "x86")
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
ENDIF()
ELSEIF(HOST_CPU MATCHES "arm")
SET(TARGET_CPU "arm")
ELSE(HOST_CPU MATCHES "x86")
ELSE()
SET(TARGET_CPU "unknown")
MESSAGE(STATUS "Unknown architecture: ${HOST_CPU}")
ENDIF(HOST_CPU MATCHES "x86")
ENDIF()
# TODO: add checks for PPC
ELSE("${HOST_CPU}" STREQUAL "${TARGET_CPU}" AND NOT CMAKE_CROSSCOMPILING)
ELSE()
MESSAGE(STATUS "Compiling on ${HOST_CPU} for ${TARGET_CPU}")
ENDIF("${HOST_CPU}" STREQUAL "${TARGET_CPU}" AND NOT CMAKE_CROSSCOMPILING)
ENDIF()
# Use values from environment variables
SET(PLATFORM_CFLAGS "$ENV{CFLAGS} $ENV{CPPFLAGS} ${PLATFORM_CFLAGS}")
@ -470,36 +490,36 @@ MACRO(NL_SETUP_BUILD)
SET(TARGET_ARM 1)
ELSEIF(TARGET_CPU STREQUAL "mips")
SET(TARGET_MIPS 1)
ENDIF(TARGET_CPU STREQUAL "x86_64")
ENDIF()
IF(TARGET_ARM)
IF(TARGET_ARMV7S)
ADD_PLATFORM_FLAGS("-DHAVE_ARMV7S")
ENDIF(TARGET_ARMV7S)
ENDIF()
IF(TARGET_ARMV7)
ADD_PLATFORM_FLAGS("-DHAVE_ARMV7")
ENDIF(TARGET_ARMV7)
ENDIF()
IF(TARGET_ARMV6)
ADD_PLATFORM_FLAGS("-HAVE_ARMV6")
ENDIF(TARGET_ARMV6)
ENDIF()
ADD_PLATFORM_FLAGS("-DHAVE_ARM")
ENDIF(TARGET_ARM)
ENDIF()
IF(TARGET_X86)
ADD_PLATFORM_FLAGS("-DHAVE_X86")
ENDIF(TARGET_X86)
ENDIF()
IF(TARGET_X64)
ADD_PLATFORM_FLAGS("-DHAVE_X64 -DHAVE_X86_64")
ENDIF(TARGET_X64)
ENDIF()
IF(TARGET_MIPS)
ADD_PLATFORM_FLAGS("-DHAVE_MIPS")
ENDIF(TARGET_MIPS)
ENDIF(NOT CMAKE_OSX_ARCHITECTURES)
ENDIF()
ENDIF()
# Fix library paths suffixes for Debian MultiArch
IF(LIBRARY_ARCHITECTURE)
@ -508,22 +528,22 @@ MACRO(NL_SETUP_BUILD)
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib64 /usr/lib64)
ELSEIF(TARGET_X86)
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib32 /usr/lib32)
ENDIF(TARGET_X64)
ENDIF(LIBRARY_ARCHITECTURE)
ENDIF()
ENDIF()
IF(APPLE AND NOT IOS)
SET(CMAKE_INCLUDE_PATH /opt/local/include ${CMAKE_INCLUDE_PATH})
SET(CMAKE_LIBRARY_PATH /opt/local/lib ${CMAKE_LIBRARY_PATH})
ENDIF(APPLE AND NOT IOS)
ENDIF()
IF(WITH_LOGGING)
ADD_PLATFORM_FLAGS("-DENABLE_LOGS")
ENDIF(WITH_LOGGING)
ENDIF()
IF(MSVC)
IF(MSVC_VERSION EQUAL "1700" AND NOT MSVC11)
SET(MSVC11 ON)
ENDIF(MSVC_VERSION EQUAL "1700" AND NOT MSVC11)
ENDIF()
# Ignore default include paths
ADD_PLATFORM_FLAGS("/X")
@ -564,9 +584,9 @@ MACRO(NL_SETUP_BUILD)
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again
SET(DEBUG_CFLAGS "/Od /Ob1 ${DEBUG_CFLAGS}")
ELSE(MSVC12)
ELSE()
MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}")
ENDIF(MSVC14)
ENDIF()
ADD_PLATFORM_FLAGS("/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /wd4250")
@ -575,10 +595,10 @@ MACRO(NL_SETUP_BUILD)
ADD_PLATFORM_FLAGS("/D_WIN64")
# Fix a compilation error for some big C++ files
SET(RELEASE_CFLAGS "${RELEASE_CFLAGS} /bigobj")
ELSE(TARGET_X64)
ELSE()
# Allows 32 bits applications to use 3 GB of RAM
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /LARGEADDRESSAWARE")
ENDIF(TARGET_X64)
ENDIF()
# Exceptions are only set for C++
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} /EHa")
@ -586,9 +606,9 @@ MACRO(NL_SETUP_BUILD)
IF(WITH_SYMBOLS)
SET(NL_RELEASE_CFLAGS "/Zi ${NL_RELEASE_CFLAGS}")
SET(NL_RELEASE_LINKFLAGS "/DEBUG ${NL_RELEASE_LINKFLAGS}")
ELSE(WITH_SYMBOLS)
ELSE()
SET(NL_RELEASE_LINKFLAGS "/RELEASE ${NL_RELEASE_LINKFLAGS}")
ENDIF(WITH_SYMBOLS)
ENDIF()
SET(NL_DEBUG_CFLAGS "/Zi /MDd /RTC1 /D_DEBUG ${DEBUG_CFLAGS} ${NL_DEBUG_CFLAGS}")
SET(NL_RELEASE_CFLAGS "/MD /DNDEBUG ${RELEASE_CFLAGS} ${NL_RELEASE_CFLAGS}")
@ -597,25 +617,25 @@ MACRO(NL_SETUP_BUILD)
IF(WITH_WARNINGS)
SET(DEBUG_CFLAGS "/W4 ${DEBUG_CFLAGS}")
ELSE(WITH_WARNINGS)
ELSE()
SET(DEBUG_CFLAGS "/W3 ${DEBUG_CFLAGS}")
ENDIF(WITH_WARNINGS)
ELSE(MSVC)
ENDIF()
ELSE()
IF(WIN32)
ADD_PLATFORM_FLAGS("-DWIN32 -D_WIN32")
IF(CLANG)
ADD_PLATFORM_FLAGS("-nobuiltininc")
ENDIF(CLANG)
ENDIF(WIN32)
ENDIF()
ENDIF()
IF(WITH_SSE3)
ADD_PLATFORM_FLAGS("-msse3")
ENDIF(WITH_SSE3)
ENDIF()
IF(WITH_GCC_FPMATH_BOTH)
ADD_PLATFORM_FLAGS("-mfpmath=both")
ENDIF(WITH_GCC_FPMATH_BOTH)
ENDIF()
IF(APPLE)
IF(NOT XCODE)
@ -650,97 +670,97 @@ MACRO(NL_SETUP_BUILD)
SET(_ARCHS "${_ARCHS} mips")
SET(TARGET_MIPS 1)
MATH(EXPR TARGETS_COUNT "${TARGETS_COUNT}+1")
ELSE(_ARCH STREQUAL "i386")
ELSE()
SET(_ARCHS "${_ARCHS} unknwon(${_ARCH})")
ENDIF(_ARCH STREQUAL "i386")
ENDIF()
ENDFOREACH(_ARCH)
MESSAGE(STATUS "Compiling under Mac OS X for ${TARGETS_COUNT} architectures: ${_ARCHS}")
ELSE(CMAKE_OSX_ARCHITECTURES)
ELSE()
SET(TARGETS_COUNT 0)
ENDIF(CMAKE_OSX_ARCHITECTURES)
ENDIF()
IF(TARGETS_COUNT EQUAL 1)
IF(TARGET_ARM)
IF(TARGET_ARMV7S)
ADD_PLATFORM_FLAGS("-arch armv7s -DHAVE_ARMV7S")
ENDIF(TARGET_ARMV7S)
ENDIF()
IF(TARGET_ARMV7)
ADD_PLATFORM_FLAGS("-arch armv7 -DHAVE_ARMV7")
ENDIF(TARGET_ARMV7)
ENDIF()
IF(TARGET_ARMV6)
ADD_PLATFORM_FLAGS("-arch armv6 -DHAVE_ARMV6")
ENDIF(TARGET_ARMV6)
ENDIF()
IF(TARGET_ARMV5)
ADD_PLATFORM_FLAGS("-arch armv5 -DHAVE_ARMV5")
ENDIF(TARGET_ARMV5)
ENDIF()
ADD_PLATFORM_FLAGS("-mthumb -DHAVE_ARM")
ENDIF(TARGET_ARM)
ENDIF()
IF(TARGET_X64)
ADD_PLATFORM_FLAGS("-arch x86_64 -DHAVE_X64 -DHAVE_X86_64 -DHAVE_X86")
ELSEIF(TARGET_X86)
ADD_PLATFORM_FLAGS("-arch i386 -DHAVE_X86")
ENDIF(TARGET_X64)
ENDIF()
IF(TARGET_MIPS)
ADD_PLATFORM_FLAGS("-arch mips -DHAVE_MIPS")
ENDIF(TARGET_MIPS)
ENDIF()
ELSEIF(TARGETS_COUNT EQUAL 0)
# Not using CMAKE_OSX_ARCHITECTURES, HAVE_XXX already defined before
IF(TARGET_ARM)
IF(TARGET_ARMV7S)
ADD_PLATFORM_FLAGS("-arch armv7s")
ENDIF(TARGET_ARMV7S)
ENDIF()
IF(TARGET_ARMV7)
ADD_PLATFORM_FLAGS("-arch armv7")
ENDIF(TARGET_ARMV7)
ENDIF()
IF(TARGET_ARMV6)
ADD_PLATFORM_FLAGS("-arch armv6")
ENDIF(TARGET_ARMV6)
ENDIF()
IF(TARGET_ARMV5)
ADD_PLATFORM_FLAGS("-arch armv5")
ENDIF(TARGET_ARMV5)
ENDIF()
ADD_PLATFORM_FLAGS("-mthumb")
ENDIF(TARGET_ARM)
ENDIF()
IF(TARGET_X64)
ADD_PLATFORM_FLAGS("-arch x86_64")
ELSEIF(TARGET_X86)
ADD_PLATFORM_FLAGS("-arch i386")
ENDIF(TARGET_X64)
ENDIF()
IF(TARGET_MIPS)
ADD_PLATFORM_FLAGS("-arch mips")
ENDIF(TARGET_MIPS)
ELSE(TARGETS_COUNT EQUAL 1)
ENDIF()
ELSE()
IF(TARGET_ARMV6)
ADD_PLATFORM_FLAGS("-Xarch_armv6 -mthumb -Xarch_armv6 -DHAVE_ARM -Xarch_armv6 -DHAVE_ARMV6")
ENDIF(TARGET_ARMV6)
ENDIF()
IF(TARGET_ARMV7)
ADD_PLATFORM_FLAGS("-Xarch_armv7 -mthumb -Xarch_armv7 -DHAVE_ARM -Xarch_armv7 -DHAVE_ARMV7")
ENDIF(TARGET_ARMV7)
ENDIF()
IF(TARGET_X86)
ADD_PLATFORM_FLAGS("-Xarch_i386 -DHAVE_X86")
ENDIF(TARGET_X86)
ENDIF()
IF(TARGET_X64)
ADD_PLATFORM_FLAGS("-Xarch_x86_64 -DHAVE_X64 -Xarch_x86_64 -DHAVE_X86_64")
ENDIF(TARGET_X64)
ENDIF()
IF(TARGET_MIPS)
ADD_PLATFORM_FLAGS("-Xarch_mips -DHAVE_MIPS")
ENDIF(TARGET_MIPS)
ENDIF(TARGETS_COUNT EQUAL 1)
ENDIF()
ENDIF()
IF(IOS)
SET(CMAKE_OSX_SYSROOT "" CACHE PATH "" FORCE)
@ -750,73 +770,73 @@ MACRO(NL_SETUP_BUILD)
CONVERT_VERSION_NUMBER(${IOS_VERSION_MAJOR} ${IOS_VERSION_MINOR} ${IOS_VERSION_PATCH} IOS_VERSION_NUMBER)
ADD_PLATFORM_FLAGS("-D__IPHONE_OS_VERSION_MIN_REQUIRED=${IOS_VERSION_NUMBER}")
ENDIF(IOS_VERSION)
ENDIF()
IF(CMAKE_IOS_SYSROOT)
IF(TARGET_ARMV7S)
IF(TARGETS_COUNT GREATER 1)
SET(XARCH "-Xarch_armv7s ")
ENDIF(TARGETS_COUNT GREATER 1)
ENDIF()
ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SYSROOT}")
ADD_PLATFORM_FLAGS("${XARCH}-miphoneos-version-min=${IOS_VERSION}")
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${XARCH}-Wl,-iphoneos_version_min,${IOS_VERSION}")
ENDIF(TARGET_ARMV7S)
ENDIF()
IF(TARGET_ARMV7)
IF(TARGETS_COUNT GREATER 1)
SET(XARCH "-Xarch_armv7 ")
ENDIF(TARGETS_COUNT GREATER 1)
ENDIF()
ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SYSROOT}")
ADD_PLATFORM_FLAGS("${XARCH}-miphoneos-version-min=${IOS_VERSION}")
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${XARCH}-Wl,-iphoneos_version_min,${IOS_VERSION}")
ENDIF(TARGET_ARMV7)
ENDIF()
IF(TARGET_ARMV6)
IF(TARGETS_COUNT GREATER 1)
SET(XARCH "-Xarch_armv6 ")
ENDIF(TARGETS_COUNT GREATER 1)
ENDIF()
ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SYSROOT}")
ADD_PLATFORM_FLAGS("${XARCH}-miphoneos-version-min=${IOS_VERSION}")
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${XARCH}-Wl,-iphoneos_version_min,${IOS_VERSION}")
ENDIF(TARGET_ARMV6)
ENDIF(CMAKE_IOS_SYSROOT)
ENDIF()
ENDIF()
IF(CMAKE_IOS_SIMULATOR_SYSROOT AND TARGET_X86)
IF(TARGETS_COUNT GREATER 1)
SET(XARCH "-Xarch_i386 ")
ENDIF(TARGETS_COUNT GREATER 1)
ENDIF()
ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SIMULATOR_SYSROOT}")
ADD_PLATFORM_FLAGS("${XARCH}-mios-simulator-version-min=${IOS_VERSION}")
IF(CMAKE_OSX_DEPLOYMENT_TARGET)
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${XARCH}-Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}")
ENDIF(CMAKE_OSX_DEPLOYMENT_TARGET)
ENDIF(CMAKE_IOS_SIMULATOR_SYSROOT AND TARGET_X86)
ELSE(IOS)
ENDIF()
ENDIF()
ELSE()
# Always force -mmacosx-version-min to override environement variable
IF(CMAKE_OSX_DEPLOYMENT_TARGET)
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}")
ENDIF(CMAKE_OSX_DEPLOYMENT_TARGET)
ENDIF(IOS)
ENDIF()
ENDIF()
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-headerpad_max_install_names")
IF(HAVE_FLAG_SEARCH_PATHS_FIRST)
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-search_paths_first")
ENDIF(HAVE_FLAG_SEARCH_PATHS_FIRST)
ENDIF(NOT XCODE)
ELSE(APPLE)
ENDIF()
ENDIF()
ELSE()
IF(HOST_CPU STREQUAL "x86_64" AND TARGET_CPU STREQUAL "x86")
ADD_PLATFORM_FLAGS("-m32 -march=i686")
ENDIF(HOST_CPU STREQUAL "x86_64" AND TARGET_CPU STREQUAL "x86")
ENDIF()
IF(HOST_CPU STREQUAL "x86" AND TARGET_CPU STREQUAL "x86_64")
ADD_PLATFORM_FLAGS("-m64")
ENDIF(HOST_CPU STREQUAL "x86" AND TARGET_CPU STREQUAL "x86_64")
ENDIF(APPLE)
ENDIF()
ENDIF()
ADD_PLATFORM_FLAGS("-D_REENTRANT -fno-strict-aliasing")
@ -826,11 +846,11 @@ MACRO(NL_SETUP_BUILD)
IF(WITH_COVERAGE)
ADD_PLATFORM_FLAGS("-fprofile-arcs -ftest-coverage")
ENDIF(WITH_COVERAGE)
ENDIF()
IF(WITH_WARNINGS)
ADD_PLATFORM_FLAGS("-Wall -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-unused")
ENDIF(WITH_WARNINGS)
ENDIF()
IF(ANDROID)
ADD_PLATFORM_FLAGS("--sysroot=${PLATFORM_ROOT}")
@ -847,17 +867,17 @@ MACRO(NL_SETUP_BUILD)
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -march=armv7-a -Wl,--fix-cortex-a8")
ELSEIF(TARGET_ARMV5)
ADD_PLATFORM_FLAGS("-march=armv5te -mtune=xscale -msoft-float")
ENDIF(TARGET_ARMV7)
ENDIF()
SET(TARGET_THUMB ON)
IF(TARGET_THUMB)
ADD_PLATFORM_FLAGS("-mthumb -fno-strict-aliasing -finline-limit=64")
SET(DEBUG_CFLAGS "${DEBUG_CFLAGS} -marm")
ELSE(TARGET_THUMB)
ELSE()
ADD_PLATFORM_FLAGS("-funswitch-loops -finline-limit=300")
SET(DEBUG_CFLAGS "${DEBUG_CFLAGS} -fno-strict-aliasing")
SET(RELEASE_CFLAGS "${RELEASE_CFLAGS} -fstrict-aliasing")
ENDIF(TARGET_THUMB)
ENDIF()
ELSEIF(TARGET_X86)
# Optimizations for Intel Atom
ADD_PLATFORM_FLAGS("-march=i686 -mtune=atom -mstackrealign -msse3 -mfpmath=sse -m32 -flto -ffast-math -funroll-loops")
@ -867,39 +887,39 @@ MACRO(NL_SETUP_BUILD)
ELSEIF(TARGET_MIPS)
ADD_PLATFORM_FLAGS("-fpic -finline-functions -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers -fno-strict-aliasing")
SET(RELEASE_CFLAGS "${RELEASE_CFLAGS} -funswitch-loops -finline-limit=300")
ENDIF(TARGET_ARM)
ENDIF()
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now")
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -L${PLATFORM_ROOT}/usr/lib")
ENDIF(ANDROID)
ENDIF()
IF(APPLE)
ADD_PLATFORM_FLAGS("-gdwarf-2 -D_DARWIN_UNLIMITED_STREAMS")
ENDIF(APPLE)
ENDIF()
# Fix "relocation R_X86_64_32 against.." error on x64 platforms
IF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS AND NOT MINGW)
ADD_PLATFORM_FLAGS("-fPIC")
ENDIF(TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS AND NOT MINGW)
ENDIF()
SET(PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -ftemplate-depth-48")
IF(NOT APPLE)
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,--no-undefined -Wl,--as-needed")
ENDIF(NOT APPLE)
ENDIF()
IF(WITH_SYMBOLS)
SET(NL_RELEASE_CFLAGS "${NL_RELEASE_CFLAGS} -g")
ELSE(WITH_SYMBOLS)
ELSE()
IF(APPLE)
SET(NL_RELEASE_LINKFLAGS "-Wl,-dead_strip ${NL_RELEASE_LINKFLAGS}")
ELSE(APPLE)
ELSE()
SET(NL_RELEASE_LINKFLAGS "-Wl,-s ${NL_RELEASE_LINKFLAGS}")
ENDIF(APPLE)
ENDIF(WITH_SYMBOLS)
ENDIF()
ENDIF()
SET(NL_DEBUG_CFLAGS "-g -DNL_DEBUG -D_DEBUG ${NL_DEBUG_CFLAGS}")
SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -DNDEBUG -O3 ${NL_RELEASE_CFLAGS}")
ENDIF(MSVC)
ENDIF()
ENDMACRO(NL_SETUP_BUILD)
MACRO(NL_SETUP_BUILD_FLAGS)
@ -934,7 +954,7 @@ MACRO(NL_MAKE_ABSOLUTE_PREFIX NAME_RELATIVE NAME_ABSOLUTE)
ELSE()
SET(${NAME_ABSOLUTE} ${${NAME_RELATIVE}})
ENDIF()
ENDIF(IS_ABSOLUTE "${${NAME_RELATIVE}}")
ENDIF()
ENDMACRO(NL_MAKE_ABSOLUTE_PREFIX)
MACRO(NL_SETUP_PREFIX_PATHS)
@ -1011,7 +1031,7 @@ MACRO(RYZOM_SETUP_PREFIX_PATHS)
ELSE()
SET(RYZOM_ETC_PREFIX "." CACHE PATH "Installation path for configurations")
ENDIF()
ENDIF(NOT RYZOM_ETC_PREFIX)
ENDIF()
NL_MAKE_ABSOLUTE_PREFIX(RYZOM_ETC_PREFIX RYZOM_ETC_ABSOLUTE_PREFIX)
## Allow override of install_prefix/share path.
@ -1051,7 +1071,7 @@ MACRO(RYZOM_SETUP_PREFIX_PATHS)
ELSE()
SET(RYZOM_LIB_PREFIX "lib" CACHE PATH "Installation path for libraries.")
ENDIF()
ENDIF(NOT RYZOM_LIB_PREFIX)
ENDIF()
NL_MAKE_ABSOLUTE_PREFIX(RYZOM_LIB_PREFIX RYZOM_LIB_ABSOLUTE_PREFIX)
## Allow override of install_prefix/games path.
@ -1069,7 +1089,7 @@ ENDMACRO(RYZOM_SETUP_PREFIX_PATHS)
MACRO(SETUP_EXTERNAL)
IF(WITH_EXTERNAL)
FIND_PACKAGE(External REQUIRED)
ENDIF(WITH_EXTERNAL)
ENDIF()
IF(WIN32)
FIND_PACKAGE(External REQUIRED)
@ -1078,8 +1098,8 @@ MACRO(SETUP_EXTERNAL)
IF(DEFINED BOOST_DIR)
SET(BOOST_INCLUDEDIR ${BOOST_DIR}/include)
SET(BOOST_LIBRARYDIR ${BOOST_DIR}/lib)
ENDIF(DEFINED BOOST_DIR)
ELSE(WIN32)
ENDIF()
ELSE()
FIND_PACKAGE(External QUIET)
IF(APPLE)
@ -1088,28 +1108,28 @@ MACRO(SETUP_EXTERNAL)
ELSE()
SET(CMAKE_FIND_LIBRARY_SUFFIXES .dylib .so .a)
ENDIF()
ELSE(APPLE)
ELSE()
IF(WITH_STATIC_EXTERNAL)
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a .so)
ELSE()
SET(CMAKE_FIND_LIBRARY_SUFFIXES .so .a)
ENDIF()
ENDIF(APPLE)
ENDIF(WIN32)
ENDIF()
ENDIF()
# Android and iOS have pthread
IF(ANDROID OR IOS)
SET(CMAKE_USE_PTHREADS_INIT 1)
SET(Threads_FOUND TRUE)
ELSE(ANDROID OR IOS)
ELSE()
FIND_PACKAGE(Threads REQUIRED)
# TODO: replace all -l<lib> by absolute path to <lib> in CMAKE_THREAD_LIBS_INIT
ENDIF(ANDROID OR IOS)
ENDIF()
IF(WITH_STLPORT)
FIND_PACKAGE(STLport REQUIRED)
INCLUDE_DIRECTORIES(${STLPORT_INCLUDE_DIR})
ENDIF(WITH_STLPORT)
ENDIF()
IF(WIN32)
# Must include DXSDK before WINSDK
@ -1117,10 +1137,10 @@ MACRO(SETUP_EXTERNAL)
# IF(DXSDK_INCLUDE_DIR)
# INCLUDE_DIRECTORIES(${DXSDK_INCLUDE_DIR})
# ENDIF()
ENDIF(WIN32)
ENDIF()
IF(MSVC)
FIND_PACKAGE(MSVC REQUIRED)
FIND_PACKAGE(WindowsSDK REQUIRED)
ENDIF(MSVC)
ENDIF()
ENDMACRO(SETUP_EXTERNAL)

View file

@ -2,23 +2,23 @@ PROJECT(NeL CXX C)
IF(WITH_STATIC_DRIVERS)
ADD_DEFINITIONS(-DNL_STATIC)
ENDIF(WITH_STATIC_DRIVERS)
ENDIF()
IF(WIN32)
# On Win32 we can also build the MAX plugins.
IF(WITH_NEL_MAXPLUGIN)
FIND_PACKAGE(3dsMaxSDK)
ENDIF(WITH_NEL_MAXPLUGIN)
ENDIF(WIN32)
ENDIF()
ENDIF()
IF(WITH_3D)
FIND_PACKAGE(FreeType)
IF(WITH_NEL_CEGUI)
FIND_PACKAGE(CEGUI)
ENDIF(WITH_NEL_CEGUI)
ENDIF()
ENDIF(WITH_3D)
ENDIF()
IF(WITH_SOUND)
FIND_PACKAGE(Ogg)
@ -26,24 +26,16 @@ IF(WITH_SOUND)
IF(WITH_DRIVER_OPENAL)
FIND_PACKAGE(OpenAL)
ENDIF(WITH_DRIVER_OPENAL)
ENDIF()
IF(WITH_DRIVER_FMOD)
FIND_PACKAGE(FMOD)
ENDIF(WITH_DRIVER_FMOD)
ENDIF(WITH_SOUND)
ENDIF()
ENDIF()
IF(WITH_GTK)
FIND_PACKAGE(GTK2)
ENDIF(WITH_GTK)
IF(WITH_LIBOVR)
FIND_PACKAGE(LibOVR)
ENDIF(WITH_LIBOVR)
IF(WITH_LIBVR)
FIND_PACKAGE(LibVR)
ENDIF(WITH_LIBVR)
ENDIF()
IF(WITH_INSTALL_LIBRARIES)
IF(UNIX)
@ -61,7 +53,7 @@ IF(WITH_INSTALL_LIBRARIES)
CONFIGURE_FILE(nel-config.in ${CMAKE_CURRENT_BINARY_DIR}/nel-config)
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/nel-config DESTINATION ${NL_BIN_PREFIX})
ENDIF(UNIX)
ENDIF()
ADD_SUBDIRECTORY(include)
ENDIF()

View file

@ -61,6 +61,10 @@ public:
sint32 Top; // Distance between origin and top of the texture
sint32 Left; // Distance between origin and left of the texture
sint32 AdvX; // Advance to the next caracter
SLetterInfo():Char(0), FontGenerator(NULL), Size(0), Embolden(false), Oblique(false), Next(NULL), Prev(NULL), Cat(0), CharWidth(0), CharHeight(0), GlyphIndex(0), Top(0), Left(0), AdvX(0)
{
}
};
struct SLetterKey
@ -74,6 +78,10 @@ public:
uint32 getVal();
//bool operator < (const SLetterKey&k) const;
//bool operator == (const SLetterKey&k) const;
SLetterKey():Char(0), FontGenerator(NULL), Size(0), Embolden(false), Oblique(false)
{
}
};
public:

View file

@ -320,7 +320,7 @@ public:
// For edition: change the tileVegetableDesc. NB: only the TileVegetableDescFileName is serialised.
void setTileVegetableDesc (const CTileVegetableDesc &tvd);
/** try to load the vegetable tile desc associated with the fileName (nlinfo() if can't)
* lookup into CPath. no-op if string=="".
* lookup into CPath. no-op if string empty
*/
void loadTileVegetableDesc();

View file

@ -2,36 +2,36 @@ SUBDIRS(misc)
IF(WITH_3D)
SUBDIRS(3d)
ENDIF(WITH_3D)
ENDIF()
IF(WITH_GUI)
ADD_SUBDIRECTORY(gui)
ENDIF(WITH_GUI)
ENDIF()
IF(WITH_GEORGES)
SUBDIRS(georges)
ENDIF(WITH_GEORGES)
ENDIF()
IF(WITH_LIGO)
SUBDIRS(ligo)
ENDIF(WITH_LIGO)
ENDIF()
IF(WITH_LOGIC)
SUBDIRS(logic)
ENDIF(WITH_LOGIC)
ENDIF()
IF(WITH_NET)
SUBDIRS(net)
ENDIF(WITH_NET)
ENDIF()
IF(WITH_SOUND)
SUBDIRS(sound)
ENDIF(WITH_SOUND)
ENDIF()
IF(WITH_PACS)
SUBDIRS(pacs)
ENDIF(WITH_PACS)
ENDIF()
IF(WITH_NEL_CEGUI)
SUBDIRS(cegui)
ENDIF(WITH_NEL_CEGUI)
ENDIF()

View file

@ -253,6 +253,7 @@ namespace NLGUI
int luaEndElement(CLuaState &ls);
int luaShowDiv(CLuaState &ls);
int luaParseHtml(CLuaState &ls);
int luaRenderHtml(CLuaState &ls);
REFLECT_EXPORT_START(CGroupHTML, CGroupScrollText)
REFLECT_LUA_METHOD("browse", luaBrowse)
@ -265,6 +266,7 @@ namespace NLGUI
REFLECT_LUA_METHOD("endElement", luaEndElement)
REFLECT_LUA_METHOD("showDiv", luaShowDiv)
REFLECT_LUA_METHOD("parseHtml", luaParseHtml)
REFLECT_LUA_METHOD("renderHtml", luaRenderHtml)
REFLECT_STRING("url", getURL, setURL)
REFLECT_FLOAT("timeout", getTimeout, setTimeout)
REFLECT_EXPORT_END

View file

@ -375,6 +375,12 @@ public:
void makeOpaque();
/**
* Make fully transparent pixels (alpha 0) black.
*/
void makeTransparentPixelsBlack();
/**
* Return if the bitmap has uniform alpha values for all pixels.
* \param alpha return the uniform value if return is true
@ -609,7 +615,7 @@ public:
/**
* Extended version of blit. The destinaion of the blit is 'this' bitmap
* Source and dest rect are clamped as necessary.
* For now, only RGBA is uspported (an asertion occurs otherwise)
* For now, only RGBA is supported (an asertion occurs otherwise)
* mipmap are not updated.
* IMPORTANT : copy to self is not handled correctly
*/

View file

@ -21,7 +21,7 @@
namespace STRING_MANAGER
{
const ucstring nl("\r\n");
const ucstring nl("\n");
struct TStringInfo

View file

@ -144,12 +144,10 @@ public:
* 16 bits encoding can be recognized by the official header :
* FF, FE, witch can be reversed if the data are MSB first.
*
* Optionally, you can force the reader to consider the file as
* UTF-8 encoded.
* Optionally, you can ask the reader to interpret #include commands.
*/
static void readTextFile(const std::string &filename,
ucstring &result, bool forceUtf8 = false,
ucstring &result,
bool fileLookup = true,
bool preprocess = false,
TLineFormat lineFmt = LINE_FMT_NO_CARE,
@ -162,11 +160,8 @@ public:
* EF,BB, BF.
* 16 bits encoding can be recognized by the official header :
* FF, FE, witch can be reversed if the data are MSB first.
*
* Optionally, you can force the reader to consider the file as
* UTF-8 encoded.
*/
static void readTextBuffer(uint8 *buffer, uint size, ucstring &result, bool forceUtf8 = false);
static void readTextBuffer(uint8 *buffer, uint size, ucstring &result);
/** Remove any C style comment from the passed string.
*/
@ -262,7 +257,7 @@ private:
/// The internal read function, it does the real job of readTextFile
static void _readTextFile(const std::string &filename,
ucstring &result, bool forceUtf8,
ucstring &result,
bool fileLookup,
bool preprocess,
TLineFormat lineFmt,

View file

@ -48,7 +48,7 @@ public:
/// Constructor
CPacsClient()
{
// No connexion
// No connection
_Server=NULL;
}
@ -567,7 +567,7 @@ static TCallbackItem PacsCallbackArray[] =
inline bool CPacsClient::connect ()
{
// Create a connexion
// Create a connection
_Server = new CCallbackClient;
// Look up for PACS service

View file

@ -67,7 +67,7 @@ public:
static IAudioDecoder *createAudioDecoder(const std::string &type, NLMISC::IStream *stream, bool loop);
/// Get information on a music file (only artist and title at the moment).
static bool getInfo(const std::string &filepath, std::string &artist, std::string &title);
static bool getInfo(const std::string &filepath, std::string &artist, std::string &title, float &length);
/// Get audio/container extensions that are currently supported by the nel sound library.
static void getMusicExtensions(std::vector<std::string> &extensions);

View file

@ -77,7 +77,7 @@ public:
inline sint32 getStreamOffset() { return _StreamOffset; }
/// Get information on a music file (only artist and title at the moment).
static bool getInfo(NLMISC::IStream *stream, std::string &artist, std::string &title);
static bool getInfo(NLMISC::IStream *stream, std::string &artist, std::string &title, float &length);
/// Get how many bytes the music buffer requires for output minimum.
virtual uint32 getRequiredBytes();

View file

@ -332,7 +332,7 @@ public:
virtual bool isMusicEnded();
virtual void setMusicVolume(float gain);
virtual float getMusicLength();
virtual bool getSongTitle(const std::string &filename, std::string &result);
virtual bool getSongTitle(const std::string &filename, std::string &result, float &length);
virtual void enableBackgroundMusic(bool enable);
virtual void enableBackgroundMusicTimeConstraint(bool enable);
CMusicSoundManager *getBackgroundMusicManager() const {return _BackgroundMusicManager;}

View file

@ -192,7 +192,7 @@ public:
* \param artist returns the song artist (empty if not available)
* \param title returns the title (empty if not available)
*/
virtual bool getMusicInfo(const std::string &/* filepath */, std::string &artist, std::string &title) { artist.clear(); title.clear(); return false; }
virtual bool getMusicInfo(const std::string &/* filepath */, std::string &artist, std::string &title, float &length) { artist.clear(); title.clear(); length = 0.f; return false; }
/// Get audio/container extensions that are supported natively by the driver implementation.
virtual void getMusicExtensions(std::vector<std::string> &extensions) const = 0;
/// Return if a music extension is supported by the driver's music channel.

View file

@ -432,7 +432,7 @@ public:
/** Get the song title. Returns false if the song is not found or the function is not implemented.
* If the song as no name, result is filled with the filename.
*/
virtual bool getSongTitle(const std::string &filename, std::string &result) =0;
virtual bool getSongTitle(const std::string &filename, std::string &result, float &length) =0;
/** enable or disable the background music system. disable it when you want to play your own mp3 for instance
*/
virtual void enableBackgroundMusic(bool enable) =0;

View file

@ -4,8 +4,8 @@ ADD_SUBDIRECTORY(shape_viewer)
IF(WITH_NEL_CEGUI)
ADD_SUBDIRECTORY(cegui)
ENDIF(WITH_NEL_CEGUI)
ENDIF()
#IF(WITH_QT)
# ADD_SUBDIRECTORY(qtnel)
#ENDIF(WITH_QT)
#ENDIF()

View file

@ -2,20 +2,20 @@ ADD_SUBDIRECTORY(misc)
IF(WITH_3D)
ADD_SUBDIRECTORY(3d)
ENDIF(WITH_3D)
ENDIF()
IF(WITH_GEORGES)
ADD_SUBDIRECTORY(georges)
ENDIF(WITH_GEORGES)
ENDIF()
IF(WITH_NET)
ADD_SUBDIRECTORY(net)
ENDIF(WITH_NET)
ENDIF()
IF(WITH_PACS)
ADD_SUBDIRECTORY(pacs)
ENDIF(WITH_PACS)
ENDIF()
IF(WITH_SOUND)
ADD_SUBDIRECTORY(sound)
ENDIF(WITH_SOUND)
ENDIF()

View file

@ -8,7 +8,7 @@ ADD_DEFINITIONS(-DUDP_DIR="\\"${NL_SHARE_ABSOLUTE_PREFIX}/nl_sample_udp/\\"")
IF(WITH_3D)
ADD_DEFINITIONS(-DUSE_3D)
ENDIF(WITH_3D)
ENDIF()
TARGET_LINK_LIBRARIES(nl_sample_udpclient nelmisc nelnet nel3d)
TARGET_LINK_LIBRARIES(nl_sample_udpserver nelmisc nelnet)
@ -22,4 +22,4 @@ INSTALL(FILES bench_service.cfg client.cfg readme.txt DESTINATION ${NL_SHARE_PRE
IF(WITH_3D)
INSTALL(FILES n019003l.pfb DESTINATION ${NL_SHARE_PREFIX}/nl_sample_udp COMPONENT samplesnet)
ENDIF(WITH_3D)
ENDIF()

View file

@ -730,12 +730,12 @@ ADD_DEFINITIONS(${LIBVR_DEFINITIONS})
IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(nel3d ${CMAKE_CURRENT_SOURCE_DIR}/std3d.h ${CMAKE_CURRENT_SOURCE_DIR}/std3d.cpp)
ENDIF(WITH_PCH)
ENDIF()
NL_GEN_PC(nel-3d.pc)
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS nel3d LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
ENDIF()
ADD_SUBDIRECTORY(driver)

View file

@ -1,13 +1,13 @@
IF(WITH_DRIVER_OPENGL)
ADD_SUBDIRECTORY(opengl)
ENDIF(WITH_DRIVER_OPENGL)
ENDIF()
IF(WITH_DRIVER_OPENGLES)
ADD_SUBDIRECTORY(opengles)
ENDIF(WITH_DRIVER_OPENGLES)
ENDIF()
IF(WIN32)
IF(WITH_DRIVER_DIRECT3D)
ADD_SUBDIRECTORY(direct3d)
ENDIF(WITH_DRIVER_DIRECT3D)
ENDIF(WIN32)
ENDIF()
ENDIF()

View file

@ -2267,7 +2267,10 @@ bool CDriverD3D::getCurrentScreenMode(GfxMode &gfxMode)
// ***************************************************************************
void CDriverD3D::setWindowTitle(const ucstring &title)
{
SetWindowTextW(_HWnd,(WCHAR*)title.c_str());
if (!SetWindowTextW(_HWnd, (WCHAR*)title.c_str()))
{
nlwarning("SetWindowText failed: %s", formatErrorMessage(getLastError()).c_str());
}
}
// ***************************************************************************

View file

@ -33,7 +33,7 @@ extern "C" {
** used to make the header, and the header can be found at
** http://www.opengl.org/registry/
**
** Khronos $Revision: 32957 $ on $Date: 2016-06-09 17:03:08 -0400 (Thu, 09 Jun 2016) $
** Khronos $Revision: 33061 $ on $Date: 2016-07-14 20:14:13 -0400 (Thu, 14 Jul 2016) $
*/
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
@ -53,7 +53,7 @@ extern "C" {
#define GLAPI extern
#endif
#define GL_GLEXT_VERSION 20160609
#define GL_GLEXT_VERSION 20160714
/* Generated C header for:
* API: gl
@ -4657,8 +4657,13 @@ GLAPI void APIENTRY glVertexBlendARB (GLint count);
#ifndef GL_ARB_vertex_buffer_object
#define GL_ARB_vertex_buffer_object 1
#if defined(__APPLE__)
typedef intptr_t GLsizeiptrARB;
typedef intptr_t GLintptrARB;
#else
typedef ptrdiff_t GLsizeiptrARB;
typedef ptrdiff_t GLintptrARB;
#endif
#define GL_BUFFER_SIZE_ARB 0x8764
#define GL_BUFFER_USAGE_ARB 0x8765
#define GL_ARRAY_BUFFER_ARB 0x8892
@ -8831,6 +8836,11 @@ GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum sfactorRGB, GLenum dfactorRG
#define GL_INTERLACE_READ_INGR 0x8568
#endif /* GL_INGR_interlace_read */
#ifndef GL_INTEL_conservative_rasterization
#define GL_INTEL_conservative_rasterization 1
#define GL_CONSERVATIVE_RASTERIZATION_INTEL 0x83FE
#endif /* GL_INTEL_conservative_rasterization */
#ifndef GL_INTEL_fragment_shader_ordering
#define GL_INTEL_fragment_shader_ordering 1
#endif /* GL_INTEL_fragment_shader_ordering */

View file

@ -196,18 +196,6 @@ CDriverGL::CDriverGL()
_backBufferHeight = 0;
_backBufferWidth = 0;
// autorelease pool for memory management
_autoreleasePool = [[NSAutoreleasePool alloc] init];
// init the application object
[NSApplication sharedApplication];
// create the menu in the top screen bar
setupApplicationMenu();
// finish the application launching
[NSApp finishLaunching];
#elif defined (NL_OS_UNIX)
_dpy = 0;
@ -373,10 +361,6 @@ CDriverGL::~CDriverGL()
{
H_AUTO_OGL(CDriverGL_CDriverGLDtor)
release();
#if defined(NL_OS_MAC)
[_autoreleasePool release];
#endif
}
// --------------------------------------------------
@ -942,13 +926,6 @@ bool CDriverGL::swapBuffers()
#elif defined(NL_OS_MAC)
// TODO: maybe do this somewhere else?
if(_DestroyWindow)
{
[_autoreleasePool release];
_autoreleasePool = [[NSAutoreleasePool alloc] init];
}
[_ctx flushBuffer];
#elif defined (NL_OS_UNIX)

View file

@ -1685,6 +1685,7 @@ void registerGlExtensions(CGlExtensions &ext)
{
ext.ARBFragmentProgram = false;
ext.NVFragmentProgram2 = false;
ext.ARBFragmentShader = false;
}
ext.OESDrawTexture = setupOESDrawTexture(glext);

View file

@ -343,9 +343,14 @@ bool CDriverGL::init (uintptr_t windowIcon, emptyProc exitFunc)
retrieveATIDriverVersion();
#elif defined(NL_OS_MAC)
// nothing to do
nlunreferenced(windowIcon);
// autorelease pool for memory management
_autoreleasePool = [[NSAutoreleasePool alloc] init];
// init the application object
[NSApplication sharedApplication];
#elif defined (NL_OS_UNIX)
nlunreferenced(windowIcon);
@ -485,7 +490,7 @@ bool CDriverGL::unInit()
#elif defined(NL_OS_MAC)
// nothing to do
[_autoreleasePool release];
#elif defined (NL_OS_UNIX)
@ -1466,6 +1471,12 @@ bool CDriverGL::createWindow(const GfxMode &mode)
#elif defined(NL_OS_MAC)
// create the menu in the top screen bar
setupApplicationMenu();
// finish the application launching
[NSApp finishLaunching];
// describe how the window should look like and behave
unsigned int styleMask = NSTitledWindowMask | NSClosableWindowMask |
NSMiniaturizableWindowMask | NSResizableWindowMask;
@ -1642,6 +1653,7 @@ bool CDriverGL::destroyWindow()
}
#elif defined(NL_OS_MAC)
#elif defined(NL_OS_UNIX)
if (_DestroyWindow && _ctx) // FIXME: _DestroyWindow may need to be removed here as well
@ -2299,7 +2311,10 @@ void CDriverGL::setWindowTitle(const ucstring &title)
#ifdef NL_OS_WINDOWS
SetWindowTextW(_win, (WCHAR*)title.c_str());
if (!SetWindowTextW(_win, (WCHAR*)title.c_str()))
{
nlwarning("SetWindowText failed: %s", formatErrorMessage(getLastError()).c_str());
}
#elif defined(NL_OS_MAC)

View file

@ -442,9 +442,16 @@ void CCocoaEventEmitter::submitEvents(CEventServer& server, bool /* allWins */)
processMessage(event, &server);
}
@try
{
// forward the event to the cocoa application
[NSApp sendEvent:event];
}
@catch(NSException *e)
{
nlwarning("Exception when sending event: %s", [[e reason] UTF8String]);
}
}
_server = &server;
}

View file

@ -457,7 +457,7 @@ CFontGenerator::CFontGenerator (const std::string &fontFileName, const std::stri
nlerror ("FT_New_Face() failed with file '%s': %s", fontFileName.c_str(), getFT2Error(error));
}
if (fontExFileName != "")
if (!fontExFileName.empty())
{
error = FT_Attach_File (_Face, fontExFileName.c_str ());
if (error)

View file

@ -1831,9 +1831,9 @@ void CLandscape::loadTile(uint16 tileId)
if(tile)
textName= tile->getRelativeFileName(CTile::additive);
else
textName= "";
textName.clear();
// If no additive for this tile, rdrpass is NULL.
if(textName=="")
if(textName.empty())
tileInfo->AdditiveRdrPass= NULL;
else
{
@ -1844,7 +1844,7 @@ void CLandscape::loadTile(uint16 tileId)
// We may have an alpha part for additive.
textName= tile->getRelativeFileName (CTile::alpha);
if(textName!="")
if(!textName.empty())
// Must Use clamp for alpha (although NVidia drivers are buggy), because the texture doesn't tile at all
pass.TextureAlpha= findTileTexture(TileBank.getAbsPath()+textName, true);
@ -1866,7 +1866,7 @@ void CLandscape::loadTile(uint16 tileId)
if(tile)
{
textName= tile->getRelativeFileName(CTile::diffuse);
if(textName!="")
if(!textName.empty())
// Avoid using Clamp for diffuse, because of recent NVidia GL drivers Bugs in 77.72
pass.TextureDiffuse= findTileTexture(TileBank.getAbsPath()+textName, false);
else
@ -1880,7 +1880,7 @@ void CLandscape::loadTile(uint16 tileId)
if(tile)
{
textName= tile->getRelativeFileName (CTile::alpha);
if(textName!="")
if(!textName.empty())
// Must Use clamp for alpha (although NVidia drivers are buggy), because the texture doesn't tile at all
pass.TextureAlpha= findTileTexture(TileBank.getAbsPath()+textName, true);
}

View file

@ -213,9 +213,9 @@ void CLandscapeUser::refreshAllZonesAround(const CVector &pos, float radius, std
refreshZonesAround (pos, radius, za, zr);
// some zone added or removed??
if(za != "")
if(!za.empty())
zonesAdded.push_back(za);
if(zr != "")
if(!zr.empty())
zonesRemoved.push_back(zr);
_ZoneManager.checkZonesAround ((uint)pos.x, (uint)(-pos.y), (uint)radius);

View file

@ -174,7 +174,7 @@ UInstanceGroup *CLandscapeIGManager::loadZoneIG(const std::string &name)
{
NL3D_HAUTO_LAND_MNGR_LOAD_ZONEIG
if(name=="")
if(name.empty())
return NULL;
// try to find this InstanceGroup.
@ -232,7 +232,7 @@ void CLandscapeIGManager::unloadArrayZoneIG(const std::vector<std::string> &name
void CLandscapeIGManager::unloadZoneIG(const std::string &name)
{
NL3D_HAUTO_LAND_MNGR_UNLOAD_ZONEIG
if(name=="")
if(name.empty())
return;
// try to find this InstanceGroup.
@ -255,7 +255,7 @@ void CLandscapeIGManager::unloadZoneIG(const std::string &name)
// ***************************************************************************
bool CLandscapeIGManager::isIGAddedToScene(const std::string &name) const
{
if(name=="")
if(name.empty())
return false;
// try to find this InstanceGroup.
@ -272,7 +272,7 @@ bool CLandscapeIGManager::isIGAddedToScene(const std::string &name) const
// ***************************************************************************
UInstanceGroup *CLandscapeIGManager::getIG(const std::string &name) const
{
if(name=="")
if(name.empty())
return NULL;
// try to find this InstanceGroup.

View file

@ -451,7 +451,6 @@ void CInstanceGroup::serial (NLMISC::IStream& f)
_PointLightArray.clear();
}
if (version >= 2)
f.serial(_GlobalPos);
@ -574,7 +573,7 @@ bool CInstanceGroup::addToScene (CScene& scene, IDriver *driver, uint selectedTe
else
{
_Instances[i] = scene.createInstance (shapeName);
}
if (_Instances[i] == NULL)
{
nlwarning("Not found '%s' file", shapeName.c_str());
@ -582,6 +581,7 @@ bool CInstanceGroup::addToScene (CScene& scene, IDriver *driver, uint selectedTe
}
}
}
}
scene.setWaterCallback(oldCallback);
return addToSceneWhenAllShapesLoaded (scene, driver, selectedTexture);
}
@ -1121,7 +1121,7 @@ void CInstanceGroup::setClusterSystemForInstances(CInstanceGroup *pIG)
void CInstanceGroup::getDynamicPortals (std::vector<std::string> &names)
{
for (uint32 i = 0; i < _Portals.size(); ++i)
if (_Portals[i].getName() != "")
if (!_Portals[i].getName().empty())
names.push_back (_Portals[i].getName());
}

View file

@ -264,7 +264,7 @@ sint CTileBank::getNumBitmap (CTile::TBitmap bitmap) const
if (!_TileVector[i].isFree())
{
const std::string &str=_TileVector[i].getRelativeFileName (bitmap);
if (str!="")
if (!str.empty())
{
std::vector<char> vect (str.length()+1);
memcpy (&*vect.begin(), str.c_str(), str.length()+1);
@ -583,7 +583,7 @@ void CTileBank::removeDisplacementMap (uint mapId)
if (mapId==_DisplacementMap.size()-1)
{
// Resize the array ?
while ((mapId>0)&&(_DisplacementMap[mapId]._FileName==""))
while ((mapId>0)&&(_DisplacementMap[mapId]._FileName.empty()))
_DisplacementMap.resize (mapId--);
}
}
@ -608,7 +608,7 @@ uint CTileBank::getDisplacementMap (const string &fileName)
for (noiseTile=0; noiseTile<_DisplacementMap.size(); noiseTile++)
{
// Same name ?
if (_DisplacementMap[noiseTile]._FileName=="")
if (_DisplacementMap[noiseTile]._FileName.empty())
break;
}
if (noiseTile==_DisplacementMap.size())
@ -1433,7 +1433,7 @@ void CTileSet::deleteBordersIfLast (const CTileBank& bank, CTile::TBitmap type)
while (ite!=_Tile128.end())
{
// If the file name is valid
if (bank.getTile (*ite)->getRelativeFileName(type)!="")
if (!bank.getTile (*ite)->getRelativeFileName(type).empty())
{
// Don't delete,
bDelete=false;
@ -1450,7 +1450,7 @@ void CTileSet::deleteBordersIfLast (const CTileBank& bank, CTile::TBitmap type)
while (ite!=_Tile256.end())
{
// If the file name is valid
if (bank.getTile (*ite)->getRelativeFileName(type)!="")
if (!bank.getTile (*ite)->getRelativeFileName(type).empty())
{
// Don't delete,
bDelete=false;
@ -1474,7 +1474,7 @@ void CTileSet::deleteBordersIfLast (const CTileBank& bank, CTile::TBitmap type)
if (nTile!=-1)
{
// If the file name is valid
if (bank.getTile (nTile)->getRelativeFileName(type)!="")
if (!bank.getTile (nTile)->getRelativeFileName(type).empty())
{
// Don't delete,
bDelete=false;
@ -1564,7 +1564,7 @@ const CTileVegetableDesc &CTileSet::getTileVegetableDesc() const
// ***************************************************************************
void CTileSet::loadTileVegetableDesc()
{
if(_TileVegetableDescFileName!="")
if(!_TileVegetableDescFileName.empty())
{
try
{

View file

@ -2,40 +2,40 @@ ADD_SUBDIRECTORY(misc)
IF(WITH_3D)
ADD_SUBDIRECTORY(3d)
ENDIF(WITH_3D)
ENDIF()
IF(WITH_GUI)
ADD_SUBDIRECTORY(gui)
ENDIF(WITH_GUI)
ENDIF()
IF(WITH_GEORGES)
ADD_SUBDIRECTORY(georges)
ENDIF(WITH_GEORGES)
ENDIF()
IF(WITH_LIGO)
ADD_SUBDIRECTORY(ligo)
ENDIF(WITH_LIGO)
ENDIF()
IF(WITH_LOGIC)
ADD_SUBDIRECTORY(logic)
ENDIF(WITH_LOGIC)
ENDIF()
IF(WITH_NET)
ADD_SUBDIRECTORY(net)
ENDIF(WITH_NET)
ENDIF()
IF(WITH_SOUND)
ADD_SUBDIRECTORY(sound)
ENDIF(WITH_SOUND)
ENDIF()
IF(WITH_NEL_CEGUI)
ADD_SUBDIRECTORY(cegui)
ENDIF(WITH_NEL_CEGUI)
ENDIF()
IF(WITH_PACS)
ADD_SUBDIRECTORY(pacs)
ENDIF(WITH_PACS)
ENDIF()
IF(WITH_NEL_TOOLS)
ADD_SUBDIRECTORY(pipeline)
ENDIF(WITH_NEL_TOOLS)
ENDIF()

View file

@ -14,4 +14,4 @@ ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DNEL_CEGUIRENDERER_EXPORTS)
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS nelceguirenderer RUNTIME DESTINATION ${NL_BIN_PREFIX} LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
ENDIF()

View file

@ -17,10 +17,10 @@ ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(nelgeorges ${CMAKE_CURRENT_SOURCE_DIR}/stdgeorges.h ${CMAKE_CURRENT_SOURCE_DIR}/stdgeorges.cpp)
ENDIF(WITH_PCH)
ENDIF()
NL_GEN_PC(nel-georges.pc)
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS nelgeorges LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
ENDIF()

View file

@ -18,8 +18,8 @@ ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} ${CURL_DEFINITIONS} ${LUABIND_DEFINITIONS
IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(nelgui ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp)
ENDIF(WITH_PCH)
ENDIF()
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS nelgui LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
ENDIF()

View file

@ -572,7 +572,7 @@ namespace NLGUI
curl_easy_cleanup(it->curl);
string tmpfile = it->dest + ".tmp";
if(res != CURLE_OK || r < 200 || r >= 300 || ((it->md5sum != "") && (it->md5sum != getMD5(tmpfile).toString())))
if(res != CURLE_OK || r < 200 || r >= 300 || (!it->md5sum.empty() && (it->md5sum != getMD5(tmpfile).toString())))
{
NLMISC::CFile::deleteFile(tmpfile.c_str());
}
@ -5500,6 +5500,19 @@ namespace NLGUI
return 0;
}
// ***************************************************************************
int CGroupHTML::luaRenderHtml(CLuaState &ls)
{
const char *funcName = "renderHtml";
CLuaIHM::checkArgCount(ls, funcName, 1);
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING);
std::string html = ls.toString(1);
renderHtmlString(html);
return 0;
}
// ***************************************************************************
int CGroupHTML::luaInsertText(CLuaState &ls)
{

View file

@ -422,7 +422,7 @@ namespace NLGUI
{
nlassert(key);
nlassert(isValid());
if (!isTable()) throw ELuaNotATable(NLMISC::toString("Trying to set a value '%d" NL_I64 "' at key %s on object '%s' of type %s (not a table).", value, key, getId().c_str(), getTypename()));
if (!isTable()) throw ELuaNotATable(NLMISC::toString("Trying to set a value '%" NL_I64 "d' at key %s on object '%s' of type %s (not a table).", value, key, getId().c_str(), getTypename()));
CLuaStackChecker lsc(_LuaState);
push();
_LuaState->push(key);

View file

@ -1430,7 +1430,7 @@ namespace NLGUI
// Append to the last line
_Lines.back()->addWord(ucCurrentWord, 0, wordFormat, _FontWidth, *TextContext);
// reset the word
ucCurrentWord = ucstring("");
ucCurrentWord.clear();
}

View file

@ -442,7 +442,7 @@ namespace NLGUI
if (sZeStart[sZeStart.size()-1] == ':')
sZeStart = sZeStart.substr(0, sZeStart.size()-1);
while (sZeStart != "")
while (!sZeStart.empty())
{
if (sEltId[0] == ':')
sTmp = sZeStart + sEltId;

View file

@ -15,10 +15,10 @@ ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(nelligo ${CMAKE_CURRENT_SOURCE_DIR}/stdligo.h ${CMAKE_CURRENT_SOURCE_DIR}/stdligo.cpp)
ENDIF(WITH_PCH)
ENDIF()
NL_GEN_PC(nel-ligo.pc)
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS nelligo LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
ENDIF()

View file

@ -15,8 +15,8 @@ ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(nellogic ${CMAKE_CURRENT_SOURCE_DIR}/stdlogic.h ${CMAKE_CURRENT_SOURCE_DIR}/stdlogic.cpp)
ENDIF(WITH_PCH)
ENDIF()
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS nellogic LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
ENDIF()

View file

@ -179,34 +179,34 @@ IF(WITH_GTK)
INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS})
ADD_DEFINITIONS(-DNL_USE_GTK)
TARGET_LINK_LIBRARIES(nelmisc ${GTK2_LIBRARIES})
ENDIF(GTK2_FOUND)
ENDIF(WITH_GTK)
ENDIF()
ENDIF()
IF(JPEG_FOUND)
INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR})
ADD_DEFINITIONS(-DUSE_JPEG)
TARGET_LINK_LIBRARIES(nelmisc ${JPEG_LIBRARY})
ENDIF(JPEG_FOUND)
ENDIF()
IF(GIF_FOUND)
INCLUDE_DIRECTORIES(${GIF_INCLUDE_DIR})
ADD_DEFINITIONS(-DUSE_GIF)
TARGET_LINK_LIBRARIES(nelmisc ${GIF_LIBRARY})
ENDIF(GIF_FOUND)
ENDIF()
IF(WITH_STATIC OR WIN32)
TARGET_LINK_LIBRARIES(nelmisc ${PNG_LIBRARIES})
ELSE(WITH_STATIC OR WIN32)
ELSE()
# Link only with libpng shared library
TARGET_LINK_LIBRARIES(nelmisc ${PNG_LIBRARY})
ENDIF(WITH_STATIC OR WIN32)
ENDIF()
IF(UNIX)
TARGET_LINK_LIBRARIES(nelmisc -lc -ldl)
IF(NOT APPLE)
TARGET_LINK_LIBRARIES(nelmisc -lrt)
ENDIF(NOT APPLE)
ENDIF(UNIX)
ENDIF()
ENDIF()
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${PNG_INCLUDE_DIR} config_file)
@ -220,10 +220,10 @@ ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(nelmisc ${CMAKE_CURRENT_SOURCE_DIR}/stdmisc.h ${CMAKE_CURRENT_SOURCE_DIR}/stdmisc.cpp)
ENDIF(WITH_PCH)
ENDIF()
NL_GEN_PC(nel-misc.pc)
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS nelmisc LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
ENDIF()

View file

@ -18,7 +18,6 @@
#include "nel/misc/app_context.h"
#include "nel/misc/dynloadlib.h"
#include "nel/misc/command.h"
#include "nel/misc/system_utils.h"
#include <locale.h>
@ -72,9 +71,6 @@ INelContext::~INelContext()
CInstanceCounterLocalManager::releaseInstance();
// uninit some systems stuff
CSystemUtils::uninit();
_NelContext = NULL;
*(_getInstance()) = NULL;
}
@ -94,9 +90,6 @@ void INelContext::contextReady()
// set numeric locale to C to avoid the use of decimal separators different of a dot
char *locale = setlocale(LC_NUMERIC, "C");
// init some systems stuff
CSystemUtils::init();
// register any pending thinks
// register local instance counter in the global instance counter manager

View file

@ -369,6 +369,51 @@ void CBitmap::makeOpaque()
}
/*-------------------------------------------------------------------*\
makeTransparentPixelsBlack
\*-------------------------------------------------------------------*/
void CBitmap::makeTransparentPixelsBlack()
{
if (_Width*_Height == 0) return;
uint pixelSize;
switch (PixelFormat)
{
case RGBA: pixelSize = 4; break;
case AlphaLuminance: pixelSize = 2; break;
default: return;
}
uint colorsSize = pixelSize - 1;
for (uint8 m = 0; m < _MipMapCount; ++m)
{
// get a pointer on original data
uint8 *data = _Data[m].getPtr();
// end of data
uint8 *endData = data + _Data[m].size();
// first alpha
data += pixelSize - 1;
// replace all alpha values by 255
while (data < endData)
{
// fully transparent pixel
if (*data == 0)
{
// make colors black
memset(data - colorsSize, 0, colorsSize);
}
data += pixelSize;
}
}
}
/*-------------------------------------------------------------------*\
isAlphaUniform
\*-------------------------------------------------------------------*/
@ -1792,7 +1837,7 @@ void CBitmap::releaseMipMaps()
\*-------------------------------------------------------------------*/
void CBitmap::resample(sint32 nNewWidth, sint32 nNewHeight)
{
nlassert(PixelFormat == RGBA || PixelFormat == Luminance);
nlassert(PixelFormat == RGBA || PixelFormat == Luminance || PixelFormat == AlphaLuminance);
bool needRebuild = false;
// Deleting mipmaps
@ -1832,6 +1877,58 @@ void CBitmap::resample(sint32 nNewWidth, sint32 nNewHeight)
resamplePicture8 (&_Data[0][0], pDestGray, _Width, _Height, nNewWidth, nNewHeight);
//logResample("Resample: 60");
}
else if (PixelFormat == AlphaLuminance)
{
pDestui.resize(nNewWidth*nNewHeight*2);
uint16 *pSrc = (uint16*)&_Data[0][0];
uint16 *pDest = (uint16*)&pDestui[0];
size_t srcSize = _Width*_Width;
uint8 *pSrcGray = new uint8[srcSize];
uint8 *pSrcAlpha = new uint8[srcSize];
// set iterators
uint16 *i = (uint16*)pSrc;
uint16 *iEnd = (uint16*)i + srcSize;
uint8 *iGray = pSrcGray;
uint8 *iAlpha = pSrcAlpha;
// copy alpha and gray in distinct arrays
while (i < iEnd)
{
*(iGray++) = (*i) & 0xff;
*(iAlpha++) = ((*i) >> 8) & 0xff;
++i;
}
size_t destSize = nNewWidth*nNewHeight;
// resample gray values array
uint8 *pDestGray = new uint8[destSize];
resamplePicture8(pSrcGray, pDestGray, _Width, _Height, nNewWidth, nNewHeight);
delete[] pSrcGray;
// resample alpha values array
uint8 *pDestAlpha = new uint8[destSize];
resamplePicture8(pSrcAlpha, pDestAlpha, _Width, _Height, nNewWidth, nNewHeight);
delete[] pSrcAlpha;
// set iterators
i = (uint16*)pDest;
iEnd = (uint16*)i + destSize;
iGray = pDestGray;
iAlpha = pDestAlpha;
// merge alpha and gray in destination array
while (i < iEnd)
{
*(i++) = *(iGray++) | (*(iAlpha++) << 8);
}
delete[] pDestGray;
delete[] pDestAlpha;
}
NLMISC::contReset(_Data[0]); // free memory
//logResample("Resample: 70");
@ -2148,7 +2245,7 @@ void CBitmap::resamplePicture32Fast (const NLMISC::CRGBA *pSrc, NLMISC::CRGBA *p
/*-------------------------------------------------------------------*\
resamplePicture32
resamplePicture8
\*-------------------------------------------------------------------*/
void CBitmap::resamplePicture8 (const uint8 *pSrc, uint8 *pDest,
sint32 nSrcWidth, sint32 nSrcHeight,

View file

@ -141,7 +141,7 @@ bool CCmdArgs::needAdditionalArg() const
const TArg &arg = _Args[i];
// they don't have any short or long name, but need a name in help
if (arg.shortName.empty() && arg.longName.empty() && !arg.helpName.empty() && arg.required)
if (arg.shortName.empty() && arg.longName.empty() && !arg.helpName.empty() && arg.required && !arg.found)
return true;
}
@ -363,7 +363,7 @@ bool CCmdArgs::parse(const std::vector<std::string> &argv)
}
// process help if requested or if required arguments are missing
if (haveLongArg("help") || (needAdditionalArg() && !haveAdditionalArg()))
if (haveLongArg("help") || needAdditionalArg())
{
displayHelp();
return false;
@ -418,7 +418,7 @@ void CCmdArgs::displayHelp()
if (!_Description.empty())
{
printf("\n%s", _Description.c_str());
printf("\n%s\n", _Description.c_str());
}
printf("\nWhere options are:\n");
@ -443,7 +443,6 @@ void CCmdArgs::displayHelp()
if (!arg.helpName.empty())
{
syntaxes.push_back(toString("-%s <%s>", arg.shortName.c_str(), arg.helpName.c_str()));
syntaxes.push_back(toString("-%s<%s>", arg.shortName.c_str(), arg.helpName.c_str()));
}
else
{
@ -459,12 +458,6 @@ void CCmdArgs::displayHelp()
// display first syntax for long argument, --arg <value>
syntaxes.push_back(toString("--%s <%s>", arg.longName.c_str(), arg.helpName.c_str()));
}
if (!arg.helpName.empty())
{
// display second syntax for long argument, --arg=<value>
syntaxes.push_back(toString("--%s=<%s>", arg.longName.c_str(), arg.helpName.c_str()));
}
else
{
syntaxes.push_back(toString("--%s", arg.longName.c_str()));

View file

@ -412,7 +412,7 @@ void CConfigFile::reparse (bool lookupPaths)
if (!CPath::lookup(fn, false).empty())
{
ucstring content;
CI18N::readTextFile(fn, content, true, true, true);
CI18N::readTextFile(fn, content, true, true);
string utf8 = content.toUtf8();
CMemStream stream;

View file

@ -1429,20 +1429,25 @@ int getLastError()
std::string formatErrorMessage(int errorCode)
{
#ifdef NL_OS_WINDOWS
LPVOID lpMsgBuf;
FormatMessage(
LPVOID lpMsgBuf = NULL;
DWORD len = FormatMessageW(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
errorCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
(LPWSTR) &lpMsgBuf,
0,
NULL
);
string ret = (char*)lpMsgBuf;
// empty buffer, an error occured
if (len == 0) return toString("FormatMessage returned error %d", getLastError());
// convert wchar_t* to std::string
string ret = wideToUtf8(lpMsgBuf);
// Free the buffer.
LocalFree(lpMsgBuf);

View file

@ -117,7 +117,7 @@ bool loadStringFile(const std::string filename, vector<TStringInfo> &stringInfos
*/
ucstring text;
CI18N::readTextFile(filename, text, false, false, true, CI18N::LINE_FMT_CRLF);
CI18N::readTextFile(filename, text, false, true, CI18N::LINE_FMT_LF);
// CI18N::readTextBuffer(buffer, size, text);
// delete [] buffer;
@ -154,7 +154,7 @@ bool loadStringFile(const std::string filename, vector<TStringInfo> &stringInfos
if (!CI18N::parseLabel(first, last, si.Identifier))
{
uint32 line = countLine(text, first);
nlwarning("DT: Fatal : In '%s', line %u: Invalid label after '%s'\n",
nlwarning("DT: Fatal : In '%s', line %u: Invalid label after '%s'",
filename.c_str(),
line,
lastLabel.c_str());
@ -167,7 +167,7 @@ bool loadStringFile(const std::string filename, vector<TStringInfo> &stringInfos
if (!CI18N::parseMarkedString(openMark, closeMark, first, last, si.Text))
{
uint32 line = countLine(text, first);
nlwarning("DT: Fatal : In '%s', line %u: Invalid text value for label %s\n",
nlwarning("DT: Fatal : In '%s', line %u: Invalid text value for label %s",
filename.c_str(),
line,
lastLabel.c_str());
@ -181,7 +181,7 @@ bool loadStringFile(const std::string filename, vector<TStringInfo> &stringInfos
if (!CI18N::parseMarkedString(openMark, closeMark, first, last, si.Text2))
{
uint32 line = countLine(text, first);
nlwarning("DT: Fatal: In '%s' line %u: Invalid text2 value label %s\n",
nlwarning("DT: Fatal: In '%s' line %u: Invalid text2 value label %s",
filename.c_str(),
line,
lastLabel.c_str());
@ -313,7 +313,7 @@ bool readPhraseFile(const std::string &filename, vector<TPhrase> &phrases, bool
{
ucstring doc;
CI18N::readTextFile(filename, doc, false, false, true, CI18N::LINE_FMT_CRLF);
CI18N::readTextFile(filename, doc, false, true, CI18N::LINE_FMT_LF);
return readPhraseFileFromString(doc, filename, phrases, forceRehash);
}
@ -416,9 +416,14 @@ bool readPhraseFileFromString(ucstring const& doc, const std::string &filename,
phrase.Clauses.size()+1);
return false;
}
// only prepend a space if required
if (!clause.Conditions.empty()) clause.Conditions += " ";
clause.Conditions += "(" + cond + ")";
CI18N::skipWhiteSpace(first, last, &clause.Comments);
}
if (first == last)
{
nlwarning("DT: in '%s': Found end of file in non closed block for phrase %s\n",
@ -577,7 +582,7 @@ ucstring preparePhraseFile(const vector<TPhrase> &phrases, bool removeDiffCommen
if (!c.Comments.empty())
{
ucstring comment = tabLines(1, c.Comments);
ret += comment; // + '\r'+'\n';
ret += comment; // + '\n';
}
if (!c.Conditions.empty())
{
@ -626,7 +631,7 @@ bool loadExcelSheet(const string filename, TWorksheet &worksheet, bool checkUniq
fp.close();
ucstring str;
CI18N::readTextFile(filename, str, false, false, false, CI18N::LINE_FMT_CRLF);
CI18N::readTextFile(filename, str, false, false, CI18N::LINE_FMT_LF);
if (!readExcelSheet(str, worksheet, checkUnique))
return false;
@ -646,6 +651,8 @@ bool readExcelSheet(const ucstring &str, TWorksheet &worksheet, bool checkUnique
strArray[strArray.size()-1]= 0;
memcpy(&strArray[0], &str[0], str.size()*sizeof(ucchar));
// size of new line characters
size_t sizeOfNl = nl.length();
// **** Build array of lines. just point to strArray, and fill 0 where appropriated
vector<ucchar*> lines;
@ -660,10 +667,10 @@ bool readExcelSheet(const ucstring &str, TWorksheet &worksheet, bool checkUnique
// nldebug("Found line : [%s]", ucstring(&strArray[lastPos]).toString().c_str());
lines.push_back(&strArray[lastPos]);
}
lastPos = pos + 2;
lastPos = pos + sizeOfNl;
}
// Must add last line if no \r\n ending
// Must add last line if no \n ending
if (lastPos < str.size())
{
pos= str.size();

View file

@ -1082,7 +1082,7 @@ NLMISC_CATEGORISED_COMMAND(nel,displayMeasures, "display hierarchical timer", "[
}
sint depth = 0;
bool hasDepth = (sscanf(args[0].c_str(), "%d", &depth) == 1 || (args.size() > 1 && sscanf(args[1].c_str(), "%d", &depth) == 1));
bool hasDepth = (fromString(args[0], depth) || (args.size() > 1 && fromString(args[1], depth)));
CASE_DISPLAYMEASURES(NoSort, -3)
CASE_DISPLAYMEASURES(TotalTime, -2)

View file

@ -502,25 +502,39 @@ void CI18N::skipWhiteSpace(ucstring::const_iterator &it, ucstring::const_iterato
if (storeComments && *it == '/' && it+1 != last && *(it+1) == '/')
{
// found a one line C comment. Store it until end of line.
while (it != last && *it != '\n')
while (it != last && (*it != '\n' && *it != '\r'))
storeComments->push_back(*it++);
// store the final '\n'
if (it != last)
storeComments->push_back(*it++);
storeComments->push_back('\n');
}
else if (storeComments && *it == '/' && it+1 != last && *(it+1) == '*')
{
// found a multi line C++ comment. store until we found the closing '*/'
while (it != last && !(*it == '*' && it + 1 != last && *(it + 1) == '/'))
{
// don't put \r
if (*it == '\r')
{
// skip it
++it;
}
else
{
storeComments->push_back(*it++);
}
}
// store the final '*'
if (it != last)
storeComments->push_back(*it++);
// store the final '/'
if (it != last)
storeComments->push_back(*it++);
// and a new line.
storeComments->push_back('\r');
storeComments->push_back('\n');
}
else
@ -656,7 +670,6 @@ bool CI18N::parseMarkedString(ucchar openMark, ucchar closeMark, ucstring::const
void CI18N::readTextFile(const string &filename,
ucstring &result,
bool forceUtf8,
bool fileLookup,
bool preprocess,
TLineFormat lineFmt,
@ -666,7 +679,7 @@ void CI18N::readTextFile(const string &filename,
TReadContext readContext;
// call the inner function
_readTextFile(filename, result, forceUtf8, fileLookup, preprocess, lineFmt, warnIfIncludesNotFound, readContext);
_readTextFile(filename, result, fileLookup, preprocess, lineFmt, warnIfIncludesNotFound, readContext);
if (!readContext.IfStack.empty())
{
@ -709,7 +722,6 @@ void CI18N::skipLine(ucstring::const_iterator &it, ucstring::const_iterator end,
void CI18N::_readTextFile(const string &filename,
ucstring &result,
bool forceUtf8,
bool fileLookup,
bool preprocess,
TLineFormat lineFmt,
@ -743,7 +755,7 @@ void CI18N::_readTextFile(const string &filename,
// Transform the string in ucstring according to format header
if (!text.empty())
readTextBuffer((uint8*)&text[0], (uint)text.size(), result, forceUtf8);
readTextBuffer((uint8*)&text[0], (uint)text.size(), result);
if (preprocess)
{
@ -819,7 +831,7 @@ void CI18N::_readTextFile(const string &filename,
subFilename.c_str());
ucstring inserted;
_readTextFile(subFilename, inserted, forceUtf8, fileLookup, preprocess, lineFmt, warnIfIncludesNotFound, readContext);
_readTextFile(subFilename, inserted, fileLookup, preprocess, lineFmt, warnIfIncludesNotFound, readContext);
final += inserted;
}
}
@ -873,7 +885,7 @@ void CI18N::_readTextFile(const string &filename,
subFilename.c_str());
ucstring inserted;
_readTextFile(subFilename, inserted, forceUtf8, fileLookup, preprocess, lineFmt, warnIfIncludesNotFound, readContext);
_readTextFile(subFilename, inserted, fileLookup, preprocess, lineFmt, warnIfIncludesNotFound, readContext);
final += inserted;
}
}
@ -1109,7 +1121,7 @@ void CI18N::_readTextFile(const string &filename,
temp.append(result.begin()+lastPos, result.end());
result.swap(temp);
temp = "";
temp.clear();
// second loop with the '\n'
pos = 0;
@ -1137,32 +1149,17 @@ void CI18N::_readTextFile(const string &filename,
}
}
void CI18N::readTextBuffer(uint8 *buffer, uint size, ucstring &result, bool forceUtf8)
void CI18N::readTextBuffer(uint8 *buffer, uint size, ucstring &result)
{
static uint8 utf16Header[] = { 0xffu, 0xfeu };
static uint8 utf16RevHeader[] = { 0xfeu, 0xffu };
static uint8 utf8Header[] = { 0xefu, 0xbbu, 0xbfu };
if (forceUtf8)
{
if (size>=3 &&
buffer[0]==utf8Header[0] &&
buffer[1]==utf8Header[1] &&
buffer[2]==utf8Header[2]
)
{
// remove utf8 header
buffer+= 3;
size-=3;
}
string text((char*)buffer, size);
result.fromUtf8(text);
}
else if (size>=3 &&
buffer[0]==utf8Header[0] &&
buffer[1]==utf8Header[1] &&
buffer[2]==utf8Header[2]
)
{
// remove utf8 header
buffer+= 3;
@ -1211,10 +1208,9 @@ void CI18N::readTextBuffer(uint8 *buffer, uint size, ucstring &result, bool forc
}
else
{
// hum.. ascii read ?
// so, just do a direct conversion
// all text files without BOM are now parsed as UTF-8 by default
string text((char*)buffer, size);
result = text;
result.fromUtf8(text);
}
}

View file

@ -2148,7 +2148,7 @@ bool CFile::setFileModificationDate(const std::string &filename, uint32 modTime)
FILETIME accessFileTime;
FILETIME modFileTime;
// read the current the files times
// read the current file time
if (GetFileTime(h, &creationFileTime, &accessFileTime, &modFileTime) == 0)
{
nlwarning("Can't set modification date on file '%s' : %s", fn.c_str(), formatErrorMessage(getLastError()).c_str());

View file

@ -76,12 +76,21 @@ namespace NLMISC {
nlWindow CSystemUtils::s_window = EmptyWindow;
#ifdef NL_OS_WINDOWS
static bool s_mustUninit = false;
#endif
bool CSystemUtils::init()
{
#ifdef NL_OS_WINDOWS
// initialize COM
if (!s_mustUninit)
{
HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
if (FAILED(hr)) return false;
s_mustUninit = true;
}
#endif
return true;
@ -91,7 +100,12 @@ bool CSystemUtils::uninit()
{
#ifdef NL_OS_WINDOWS
// uninitialize COM
if (s_mustUninit)
{
CoUninitialize();
s_mustUninit = false;
}
#endif
return true;

View file

@ -40,7 +40,10 @@ void CWin32Util::localizeWindow(HWND wnd)
std::string winText = wideToUtf8(str);
if (CI18N::hasTranslation(winText))
{
SetWindowTextW(wnd, (const WCHAR *) CI18N::get(winText).c_str());
if (!SetWindowTextW(wnd, (const WCHAR *) CI18N::get(winText).c_str()))
{
nlwarning("SetWindowText failed: %s", formatErrorMessage(getLastError()).c_str());
}
}
}
HWND currSon = GetWindow(wnd, GW_CHILD);

View file

@ -217,8 +217,13 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
ucstring ucs;
// convert the text from UTF-8 to unicode
ucs.fromUtf8(cwd->_History[cwd->_PosInHistory]);
// set the text as unicode string
SetWindowTextW(cwd->_HInputEdit, (LPCWSTR)ucs.c_str());
if (!SetWindowTextW(cwd->_HInputEdit, (LPCWSTR)ucs.c_str()))
{
nlwarning("SetWindowText failed: %s", formatErrorMessage(getLastError()).c_str());
}
SendMessageA (cwd->_HInputEdit, EM_SETSEL, (WPARAM)ucs.size(), (LPARAM)ucs.size());
}
}
@ -234,8 +239,13 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
ucstring ucs;
// convert the text from UTF-8 to unicode
ucs.fromUtf8(cwd->_History[cwd->_PosInHistory]);
// set the text as unicode string
SetWindowTextW(cwd->_HInputEdit, (LPCWSTR)ucs.c_str());
if (!SetWindowTextW(cwd->_HInputEdit, (LPCWSTR)ucs.c_str()))
{
nlwarning("SetWindowText failed: %s", formatErrorMessage(getLastError()).c_str());
}
SendMessageA (cwd->_HInputEdit, EM_SETSEL, (WPARAM)ucs.size(), (LPARAM)ucs.size());
}
}
@ -352,7 +362,10 @@ void CWinDisplayer::setTitleBar (const string &titleBar)
nldebug("SERVICE: Set title bar to '%s'", wn.c_str());
SetWindowTextW (_HWnd, (LPWSTR)ucstring::makeFromUtf8(wn).c_str());
if (!SetWindowTextW(_HWnd, (LPWSTR)ucstring::makeFromUtf8(wn).c_str()))
{
nlwarning("SetWindowText failed: %s", formatErrorMessage(getLastError()).c_str());
}
}
void CWinDisplayer::open (string titleBar, bool iconified, sint x, sint y, sint w, sint h, sint hs, sint fs, const std::string &fn, bool ww, CLog *log)

View file

@ -9,8 +9,8 @@ IF(WITH_GTK)
IF(GTK2_FOUND)
INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS})
ADD_DEFINITIONS(-DNL_USE_GTK)
ENDIF(GTK2_FOUND)
ENDIF(WITH_GTK)
ENDIF()
ENDIF()
TARGET_LINK_LIBRARIES(nelnet nelmisc)
NL_DEFAULT_PROPS(nelnet "NeL, Library: NeL Net")
@ -20,10 +20,10 @@ NL_ADD_LIB_SUFFIX(nelnet)
IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(nelnet ${CMAKE_CURRENT_SOURCE_DIR}/stdnet.h ${CMAKE_CURRENT_SOURCE_DIR}/stdnet.cpp)
ENDIF(WITH_PCH)
ENDIF()
NL_GEN_PC(nel-net.pc)
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS nelnet LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
ENDIF()

View file

@ -15,10 +15,10 @@ ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(nelpacs ${CMAKE_CURRENT_SOURCE_DIR}/stdpacs.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpacs.cpp)
ENDIF(WITH_PCH)
ENDIF()
NL_GEN_PC(nel-pacs.pc)
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS nelpacs LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
ENDIF()

View file

@ -1221,7 +1221,7 @@ void NLPACS::CGlobalRetriever::findCollisionChains(CCollisionSurfaceTemp &cst, c
if (!localRetriever.isLoaded())
{
nlwarning("local retriever %d in %s not loaded, findCollisionChains in this retriever aborted", localRetrieverId, _RetrieverBank->getNamePrefix().c_str());
nldebug("local retriever %d in %s not loaded, findCollisionChains in this retriever aborted", localRetrieverId, _RetrieverBank->getNamePrefix().c_str());
continue;
}

View file

@ -15,4 +15,4 @@ NL_ADD_LIB_SUFFIX(nelpipeline)
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS nelpipeline LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
ENDIF()

View file

@ -93,7 +93,7 @@ TARGET_LINK_LIBRARIES(nelsound ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY})
IF(WITH_STATIC)
# Add libogg dependency only if target is static because to libvorbisfile
TARGET_LINK_LIBRARIES(nelsound ${OGG_LIBRARY})
ENDIF(WITH_STATIC)
ENDIF()
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
@ -108,12 +108,12 @@ ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(nelsound ${CMAKE_CURRENT_SOURCE_DIR}/stdsound.h ${CMAKE_CURRENT_SOURCE_DIR}/stdsound.cpp)
ENDIF(WITH_PCH)
ENDIF()
NL_GEN_PC(nel-sound.pc)
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS nelsound LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
ENDIF()
ADD_SUBDIRECTORY(driver)

View file

@ -94,7 +94,7 @@ IAudioDecoder *IAudioDecoder::createAudioDecoder(const std::string &type, NLMISC
}
}
bool IAudioDecoder::getInfo(const std::string &filepath, std::string &artist, std::string &title)
bool IAudioDecoder::getInfo(const std::string &filepath, std::string &artist, std::string &title, float &length)
{
std::string lookup = CPath::lookup(filepath, false);
if (lookup.empty())
@ -111,7 +111,7 @@ bool IAudioDecoder::getInfo(const std::string &filepath, std::string &artist, st
ifile.setCacheFileOnOpen(false);
ifile.allowBNPCacheFileOnOpen(false);
if (ifile.open(lookup))
return CAudioDecoderVorbis::getInfo(&ifile, artist, title);
return CAudioDecoderVorbis::getInfo(&ifile, artist, title, length);
nlwarning("Unable to open: '%s'", filepath.c_str());
}

View file

@ -117,7 +117,7 @@ CAudioDecoderVorbis::~CAudioDecoderVorbis()
}
/// Get information on a music file (only artist and title at the moment).
bool CAudioDecoderVorbis::getInfo(NLMISC::IStream *stream, std::string &artist, std::string &title)
bool CAudioDecoderVorbis::getInfo(NLMISC::IStream *stream, std::string &artist, std::string &title, float &length)
{
CAudioDecoderVorbis mbv(stream, false); // just opens and closes the oggvorbisfile thing :)
vorbis_comment *vc = ov_comment(&mbv._OggVorbisFile, -1);
@ -125,6 +125,7 @@ bool CAudioDecoderVorbis::getInfo(NLMISC::IStream *stream, std::string &artist,
if (title_c) title = title_c; else title.clear();
char *artist_c = vorbis_comment_query(vc, "artist", 0);
if (artist_c) artist = artist_c; else artist.clear();
length = (float)ov_time_total(&mbv._OggVorbisFile, -1);
return true;
}

View file

@ -1797,7 +1797,7 @@ void CAudioMixerUser::addSource( CSourceCommon *source )
_Sources.insert( source );
// _profile(( "AM: ADDSOURCE, SOUND: %d, TRACK: %p, NAME=%s", source->getSound(), source->getTrack(),
// source->getSound() && (source->getSound()->getName()!="") ? source->getSound()->getName().c_str() : "" ));
// source->getSound() && (!source->getSound()->getName().empty()) ? source->getSound()->getName().c_str() : "" ));
}
@ -2684,17 +2684,17 @@ float CAudioMixerUser::getMusicLength()
}
// ***************************************************************************
bool CAudioMixerUser::getSongTitle(const std::string &filename, std::string &result)
bool CAudioMixerUser::getSongTitle(const std::string &filename, std::string &result, float &length)
{
if (_SoundDriver)
{
std::string artist;
std::string title;
if (!_SoundDriver->getMusicInfo(filename, artist, title))
if (!_SoundDriver->getMusicInfo(filename, artist, title, length))
{
// use 3rd party libraries supported formats
IAudioDecoder::getInfo(filename, artist, title);
IAudioDecoder::getInfo(filename, artist, title, length);
}
if (!title.empty())
@ -2715,6 +2715,7 @@ bool CAudioMixerUser::getSongTitle(const std::string &filename, std::string &res
}
result = "???";
length = 0;
return false;
}

View file

@ -12,24 +12,24 @@ NL_ADD_LIB_SUFFIX(nelsnd_lowlevel)
IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(nelsnd_lowlevel ${CMAKE_CURRENT_SOURCE_DIR}/stdsound_lowlevel.h ${CMAKE_CURRENT_SOURCE_DIR}/stdsound_lowlevel.cpp)
ENDIF(WITH_PCH)
ENDIF()
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS nelsnd_lowlevel LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
ENDIF()
IF(WITH_DRIVER_OPENAL)
ADD_SUBDIRECTORY(openal)
ENDIF(WITH_DRIVER_OPENAL)
ENDIF()
IF(WITH_DRIVER_FMOD)
ADD_SUBDIRECTORY(fmod)
ENDIF(WITH_DRIVER_FMOD)
ENDIF()
IF(WITH_DRIVER_DSOUND)
ADD_SUBDIRECTORY(dsound)
ENDIF(WITH_DRIVER_DSOUND)
ENDIF()
IF(WITH_DRIVER_XAUDIO2)
ADD_SUBDIRECTORY(xaudio2)
ENDIF(WITH_DRIVER_XAUDIO2)
ENDIF()

View file

@ -115,7 +115,7 @@ public:
* \param artist returns the song artist (empty if not available)
* \param title returns the title (empty if not available)
*/
virtual bool getMusicInfo(const std::string & /* filepath */, std::string &artist, std::string &title) { artist.clear(); title.clear(); return false; }
virtual bool getMusicInfo(const std::string & /* filepath */, std::string &artist, std::string &title, float &length) { artist.clear(); title.clear(); length = 0.f; return false; }
private:

View file

@ -496,7 +496,7 @@ bool getTag (std::string &result, const char *tag, FSOUND_STREAM *stream)
* \param artist returns the song artist (empty if not available)
* \param title returns the title (empty if not available)
*/
bool CSoundDriverFMod::getMusicInfo(const std::string &filepath, std::string &artist, std::string &title)
bool CSoundDriverFMod::getMusicInfo(const std::string &filepath, std::string &artist, std::string &title, float &length)
{
/* Open a stream, get the tag if it exists, close the stream */
string pathName = CPath::lookup(filepath, false);
@ -526,6 +526,8 @@ bool CSoundDriverFMod::getMusicInfo(const std::string &filepath, std::string &ar
{
getTag(artist, "ARTIST", stream);
getTag(title, "TITLE", stream);
// get length of the music in seconds
length = (float)FSOUND_Stream_GetLengthMs(stream) / 1000.f;
FSOUND_Stream_Close(stream);
return true;
}

View file

@ -116,7 +116,7 @@ public:
* \param artist returns the song artist (empty if not available)
* \param title returns the title (empty if not available)
*/
virtual bool getMusicInfo(const std::string &filepath, std::string &artist, std::string &title);
virtual bool getMusicInfo(const std::string &filepath, std::string &artist, std::string &title, float &length);
// also check that the channel still exist (avoid any free problem)
void markMusicChannelEnded(void *stream, CMusicChannelFMod *musicChannel);

View file

@ -48,9 +48,9 @@ IF(WIN32 AND WITH_3D)
IF(MAXSDK_FOUND)
ADD_SUBDIRECTORY(plugin_max)
ADD_SUBDIRECTORY(ligo)
ENDIF(MAXSDK_FOUND)
ENDIF(WITH_NEL_MAXPLUGIN)
ENDIF(MFC_FOUND)
ENDIF()
ENDIF()
ENDIF()
ENDIF()
IF(WITH_NEL_TOOLS AND WITH_3D)
@ -59,8 +59,8 @@ IF(WITH_NEL_TOOLS AND WITH_3D)
IF(MFC_FOUND)
ADD_SUBDIRECTORY(object_viewer_exe)
ADD_SUBDIRECTORY(tile_edit)
ENDIF(MFC_FOUND)
ENDIF(WIN32)
ENDIF()
ENDIF()
IF(WITH_QT OR WITH_QT5)
ADD_SUBDIRECTORY(tile_edit_qt)

View file

@ -24,8 +24,7 @@
#include "nel/misc/log.h"
#include "nel/misc/path.h"
#include "nel/misc/uv.h"
//#include "windows.h"
#include "nel/misc/cmd_args.h"
#include <vector>
#include <string>
@ -36,21 +35,9 @@ using namespace std;
using namespace NLMISC;
// ***************************************************************************
//char sExeDir[MAX_PATH];
std::string sExeDir;
NLMISC::CApplicationContext _ApplicationContext;
void outString(const string &sText)
{
std::string sCurDir = CPath::getCurrentPath();
CPath::setCurrentPath(sExeDir.c_str());
//char sCurDir[MAX_PATH];
//GetCurrentDirectory (MAX_PATH, sCurDir);
//SetCurrentDirectory (sExeDir);
NLMISC::createDebug ();
NLMISC::InfoLog->displayRaw(sText.c_str());
//SetCurrentDirectory (sCurDir);
CPath::setCurrentPath(sCurDir.c_str());
printf("%s\n", sText.c_str());
}
// ***************************************************************************
@ -160,11 +147,10 @@ bool putIn (NLMISC::CBitmap *pSrc, NLMISC::CBitmap *pDst, sint32 x, sint32 y, bo
// ***************************************************************************
string getBaseName(const string &fullname)
{
string sTmp2;
string basename;
string::size_type pos = fullname.rfind('_');
if (pos != string::npos)
sTmp2 = fullname.substr(0, pos+1);
return sTmp2;
if (pos != string::npos) basename = fullname.substr(0, pos+1);
return basename;
}
// ***************************************************************************
@ -188,65 +174,209 @@ void enlargeCanvas (NLMISC::CBitmap &b)
b = b2;
}
bool writeFileDependingOnFilename(const std::string &filename, CBitmap &bitmap)
{
NLMISC::COFile out;
if (out.open(filename))
{
if (toLower(filename).find(".png") != string::npos)
{
bitmap.writePNG(out, 32);
}
else
{
bitmap.writeTGA(out, 32);
}
out.close();
return true;
}
return false;
}
// ***************************************************************************
// main
// ***************************************************************************
int main(int nNbArg, char **ppArgs)
int main(int argc, char **argv)
{
//GetCurrentDirectory (MAX_PATH, sExeDir);
sExeDir = CPath::getCurrentPath();
CApplicationContext applicationContext;
if (nNbArg < 3)
{
outString ("ERROR : Wrong number of arguments\n");
outString ("USAGE : build_interface [-s<existing_uv_txt_name>] <out_tga_name> <path_maps1> [path_maps2] [path_maps3] ....\n");
outString (" -s : build a subset of an existing interface definition while preserving the existing texture ids,");
outString (" to support freeing up VRAM by switching to the subset without rebuilding the entire interface\n");
return -1;
}
// Parse Command Line.
NLMISC::CCmdArgs args;
args.setDescription("Build a huge interface texture from several small elements to optimize video memory usage.");
args.addArg("f", "format", "format", "Output format (png or tga)");
args.addArg("s", "subset", "existing_uv_txt_name", "Build a subset of an existing interface definition while preserving the existing texture ids, to support freeing up VRAM by switching to the subset without rebuilding the entire interface.");
args.addArg("x", "extract", "", "Extract all interface elements from <output_filename> to <input_path>.");
args.addAdditionalArg("output_filename", "PNG or TGA file to generate", true);
args.addAdditionalArg("input_path", "Path that containts interfaces elements", false);
if (!args.parse(argc, argv)) return 1;
// build as a subset of existing interface
bool buildSubset = false;
string existingUVfilename;
list<string> inputDirs;
for ( uint i=1; (sint)i<nNbArg; ++i )
if (args.haveArg("s"))
{
if ( ppArgs[i][0] == '-' )
{
switch ( ppArgs[i][1] )
{
case 'S':
case 's':
buildSubset = true;
existingUVfilename = string( ppArgs[i]+2 );
break;
default:
break;
existingUVfilename = args.getArg("s").front();
}
// extract all interface elements
bool extractElements = args.haveArg("x");
// output format
std::string outputFormat;
if (args.haveArg("f"))
{
outputFormat = args.getArg("f").front();
if (outputFormat != "png" && outputFormat != "tga")
{
outString(toString("ERROR: Format %s not supported, only png and tga formats are", outputFormat.c_str()));
return -1;
}
}
std::vector<std::string> inputDirs = args.getAdditionalArg("input_path");
string fmtName = args.getAdditionalArg("output_filename").front();
// append PNG extension if no one provided
if (fmtName.rfind('.') == string::npos) fmtName += "." + (outputFormat.empty() ? "png":outputFormat);
if (extractElements)
{
if (inputDirs.empty())
{
outString(toString("ERROR: No input directories specified"));
return -1;
}
// name of UV file
existingUVfilename = fmtName.substr(0, fmtName.rfind('.'));
existingUVfilename += ".txt";
// Load existing UV file
CIFile iFile;
string filename = CPath::lookup(existingUVfilename, false);
if (filename.empty() || !iFile.open(filename))
{
outString(toString("ERROR: Unable to open %s", existingUVfilename.c_str()));
return -1;
}
// Load existing bitmap file
CIFile bitmapFile;
if (!bitmapFile.open(fmtName))
{
outString(toString("ERROR: Unable to open %s", fmtName.c_str()));
return -1;
}
// load bitmap
CBitmap textureBitmap;
uint8 colors = textureBitmap.load(bitmapFile);
// file already loaded in memory, close it
bitmapFile.close();
if (colors != 32)
{
outString(toString("ERROR: %s is not a RGBA bitmap", existingUVfilename.c_str()));
return -1;
}
// make sure transparent pixels are black
textureBitmap.makeTransparentPixelsBlack();
float textureWidth = (float)textureBitmap.getWidth();
float textureHeight = (float)textureBitmap.getHeight();
char bufTmp[256], tgaName[256];
string sTGAname;
float uvMinU, uvMinV, uvMaxU, uvMaxV;
while (!iFile.eof())
{
iFile.getline(bufTmp, 256);
if (sscanf(bufTmp, "%s %f %f %f %f", tgaName, &uvMinU, &uvMinV, &uvMaxU, &uvMaxV) != 5)
{
nlwarning("Can't parse %s", bufTmp);
continue;
}
float xf = uvMinU * textureWidth;
float yf = uvMinV * textureHeight;
float widthf = (uvMaxU - uvMinU) * textureWidth;
float heightf = (uvMaxV - uvMinV) * textureHeight;
uint x = (uint)xf;
uint y = (uint)yf;
uint width = (uint)widthf;
uint height = (uint)heightf;
if ((float)x != xf || (float)y != yf || (float)width != widthf || (float)height != heightf)
{
nlwarning("Wrong round");
}
if (width && height)
{
// create bitmap
CBitmap bitmap;
bitmap.resize(width, height);
bitmap.blit(textureBitmap, x, y, width, height, 0, 0);
sTGAname = inputDirs.front() + "/" + tgaName;
// force specific format instead of using original one
if (!outputFormat.empty())
{
sTGAname = sTGAname.substr(0, sTGAname.rfind('.'));
sTGAname += "." + outputFormat;
}
// write the file
if (writeFileDependingOnFilename(sTGAname, bitmap))
{
outString(toString("Writing file %s", sTGAname.c_str()));
}
else
{
outString(toString("Unable to writing file %s", sTGAname.c_str()));
}
}
else
inputDirs.push_back(ppArgs[i]);
{
outString(toString("Bitmap with wrong size"));
}
}
string fmtName;
uint iNumDirs = (uint)inputDirs.size();
if( iNumDirs )
{
fmtName = inputDirs.front();
inputDirs.pop_front();
--iNumDirs;
return 0;
}
vector<string> AllMapNames;
list<string>::iterator it = inputDirs.begin();
list<string>::iterator itEnd = inputDirs.end();
vector<string>::iterator it = inputDirs.begin(), itEnd = inputDirs.end();
while( it != itEnd )
{
string sDir = *it++;
if( !CFile::isDirectory(sDir) )
{
outString (string("ERROR : directory ") + sDir + " does not exist\n");
outString(toString("ERROR: directory %s does not exist", sDir.c_str()));
return -1;
}
CPath::getPathContent(sDir, false, false, true, AllMapNames);
}
@ -264,13 +394,16 @@ int main(int nNbArg, char **ppArgs)
{
pBtmp = new NLMISC::CBitmap;
NLMISC::CIFile inFile;
if (!inFile.open( AllMapNames[i] )) throw NLMISC::Exception("Unable to open " + AllMapNames[i]);
if (!inFile.open(AllMapNames[i])) throw NLMISC::Exception(toString("Unable to open %s", AllMapNames[i].c_str()));
uint8 colors = pBtmp->load(inFile);
if (!colors) throw NLMISC::Exception(toString("%s is not a bitmap", AllMapNames[i].c_str()));
if (pBtmp->getPixelFormat() != CBitmap::RGBA)
{
nlwarning("Converting %s to RGBA (32 bits), originally using %u bits...", AllMapNames[i].c_str(), (uint)colors);
outString(toString("Converting %s to RGBA (32 bits), originally using %u bits...", AllMapNames[i].c_str(), (uint)colors));
pBtmp->convertToType(CBitmap::RGBA);
}
@ -280,7 +413,7 @@ int main(int nNbArg, char **ppArgs)
{
if (pBtmp) delete pBtmp;
outString (string("ERROR :") + e.what());
outString(toString("ERROR : %s", e.what()));
return -1;
}
}
@ -314,6 +447,7 @@ int main(int nNbArg, char **ppArgs)
vector<NLMISC::CUV> UVMin, UVMax;
UVMin.resize (mapSize, NLMISC::CUV(0.0f, 0.0f));
UVMax.resize (mapSize, NLMISC::CUV(0.0f, 0.0f));
for (sint i = 0; i < mapSize; ++i)
{
sint32 x, y;
@ -323,40 +457,20 @@ int main(int nNbArg, char **ppArgs)
enlargeCanvas (GlobalTexture);
enlargeCanvas (GlobalMask);
}
putIn (AllMaps[i], &GlobalTexture, x, y);
putIn (AllMaps[i], &GlobalMask, x, y, false);
UVMin[i].U = (float)x;
UVMin[i].V = (float)y;
UVMax[i].U = (float)x+AllMaps[i]->getWidth();
UVMax[i].V = (float)y+AllMaps[i]->getHeight();
/* // Do not remove this is useful for debugging
{
NLMISC::COFile outTga;
string fmtName = ppArgs[1];
if (fmtName.rfind('.') == string::npos)
fmtName += ".tga";
if (outTga.open(fmtName))
{
GlobalTexture.writeTGA (outTga, 32);
outTga.close();
}
}
{
NLMISC::COFile outTga;
string fmtName = ppArgs[1];
if (fmtName.rfind('.') == string::npos)
fmtName += "_msk.tga";
else
fmtName = fmtName.substr(0,fmtName.rfind('.')) + "_msk.tga";
if (outTga.open(fmtName))
{
GlobalMask.writeTGA (outTga, 32);
outTga.close();
}
}*/
#if 0
// Do not remove this is useful for debugging
writeFileDependingOnFilename(fmtName.substr(0, fmtName.rfind('.')) + "_txt.png", GlobalTexture);
writeFileDependingOnFilename(fmtName.substr(0, fmtName.rfind('.')) + "_msk.png", GlobalMask);
#endif
}
// Convert UV from pixel to ratio
@ -368,33 +482,17 @@ int main(int nNbArg, char **ppArgs)
UVMax[i].V = UVMax[i].V / (float)GlobalTexture.getHeight();
}
// make sure transparent pixels are black
GlobalTexture.makeTransparentPixelsBlack();
// Write global texture file
//SetCurrentDirectory (sExeDir);
CPath::setCurrentPath(sExeDir.c_str());
NLMISC::COFile outTga;
if (fmtName.rfind('.') == string::npos)
fmtName += ".tga";
if (outTga.open(fmtName))
if (writeFileDependingOnFilename(fmtName, GlobalTexture))
{
std::string ext;
if (toLower(fmtName).find(".png") != string::npos)
{
ext = "png";
GlobalTexture.writePNG (outTga, 32);
outString(toString("Writing %s", fmtName.c_str()));
}
else
{
ext = "tga";
GlobalTexture.writeTGA (outTga, 32);
}
outTga.close();
outString (toString("Writing %s file : %s\n", ext.c_str(), fmtName.c_str()));
}
else
{
outString (string("ERROR: Cannot write tga file : ") + fmtName + "\n");
outString(toString("ERROR: Unable to write %s", fmtName.c_str()));
}
// Write UV text file
@ -402,22 +500,23 @@ int main(int nNbArg, char **ppArgs)
{
fmtName = fmtName.substr(0, fmtName.rfind('.'));
fmtName += ".txt";
FILE *f = fopen (fmtName.c_str(), "wt");
FILE *f = nlfopen(fmtName, "wb");
if (f != NULL)
{
for (sint i = 0; i < mapSize; ++i)
{
// get the string whitout path
string fileName = CFile::getFilename(AllMapNames[i]);
fprintf (f, "%s %.12f %.12f %.12f %.12f\n", fileName.c_str(), UVMin[i].U, UVMin[i].V,
UVMax[i].U, UVMax[i].V);
fprintf (f, "%s %.12f %.12f %.12f %.12f\n", fileName.c_str(), UVMin[i].U, UVMin[i].V, UVMax[i].U, UVMax[i].V);
}
fclose (f);
outString (string("Writing UV file : ") + fmtName + "\n");
outString(toString("Writing UV file %s", fmtName.c_str()));
}
else
{
outString (string("ERROR: Cannot write UV file : ") + fmtName + "\n");
outString(toString("ERROR: Cannot write UV file %s", fmtName.c_str()));
}
}
else // build as a subset
@ -425,20 +524,21 @@ int main(int nNbArg, char **ppArgs)
// Load existing uv file
CIFile iFile;
string filename = CPath::lookup (existingUVfilename, false);
if( (filename == "") || (!iFile.open(filename)) )
if( filename.empty() || !iFile.open(filename) )
{
outString (string("ERROR : could not open file ") + existingUVfilename + "\n");
outString(toString("ERROR: Unable to open %s", existingUVfilename.c_str()));
return -1;
}
// Write subset UV text file
fmtName = fmtName.substr(0, fmtName.rfind('.'));
fmtName += ".txt";
FILE *f = fopen (fmtName.c_str(), "wt");
FILE *f = nlfopen(fmtName, "wb");
if (f == NULL)
{
outString (string("ERROR: Cannot write UV file : ") + fmtName + "\n");
// fclose (iFile);
outString(toString("ERROR: Unable to write UV file %s", fmtName.c_str()));
return -1;
}
@ -454,18 +554,28 @@ int main(int nNbArg, char **ppArgs)
continue;
}
sTGAname = toLower(string(tgaName));
// search position of extension
std::string tgaExt = CFile::getExtension(sTGAname);
// remove extension
sTGAname = CFile::getFilenameWithoutExtension(sTGAname);
sint i;
sTGAname = toLower(string(tgaName));
string findTGAName;
for (i = 0; i < mapSize; ++i)
{
// get the string whitout path
findTGAName = toLower(CFile::getFilename(AllMapNames[i]));
findTGAName = toLower(CFile::getFilenameWithoutExtension(AllMapNames[i]));
if( findTGAName == sTGAname )
break;
}
// append extension
sTGAname += "." + tgaExt;
if( i == mapSize )
{
// not present in subset: offset existing uv's to (0,0), preserving size
@ -474,13 +584,11 @@ int main(int nNbArg, char **ppArgs)
else
{
// present in subset: use new uv's
fprintf (f, "%s %.12f %.12f %.12f %.12f\n", sTGAname.c_str(), UVMin[i].U, UVMin[i].V,
UVMax[i].U, UVMax[i].V);
fprintf (f, "%s %.12f %.12f %.12f %.12f\n", sTGAname.c_str(), UVMin[i].U, UVMin[i].V, UVMax[i].U, UVMax[i].V);
}
}
// fclose (iFile);
fclose (f);
outString (string("Writing UV file : ") + fmtName + "\n");
outString(toString("Writing UV file: %s", fmtName.c_str()));
}
return 0;

View file

@ -13,4 +13,4 @@ NL_ADD_RUNTIME_FLAGS(mesh_utils)
IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
INSTALL(TARGETS mesh_utils LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT tools3d)
ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC)
ENDIF()

View file

@ -17,11 +17,11 @@ ADD_DEFINITIONS(${MFC_DEFINITIONS} -DOBJECT_VIEWER_LIB_EXPORTS)
IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(object_viewer_dll ${CMAKE_CURRENT_SOURCE_DIR}/std_afx.h ${CMAKE_CURRENT_SOURCE_DIR}/std_afx.cpp)
ENDIF(WITH_PCH)
ENDIF()
INSTALL(TARGETS object_viewer_dll LIBRARY DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT tools3d)
INSTALL(FILES object_viewer.cfg DESTINATION ${NL_ETC_PREFIX} COMPONENT tools3d)
IF(WITH_MAXPLUGIN)
INSTALL(TARGETS object_viewer_dll RUNTIME DESTINATION maxplugin COMPONENT tools3d)
INSTALL(FILES object_viewer.cfg DESTINATION maxplugin COMPONENT tools3d)
ENDIF(WITH_MAXPLUGIN)
ENDIF()

View file

@ -17,9 +17,9 @@ NL_ADD_RUNTIME_FLAGS(object_viewer)
IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(object_viewer ${CMAKE_CURRENT_SOURCE_DIR}/std_afx.h ${CMAKE_CURRENT_SOURCE_DIR}/std_afx.cpp)
ENDIF(WITH_PCH)
ENDIF()
INSTALL(TARGETS object_viewer RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)
IF(WITH_MAXPLUGIN)
INSTALL(TARGETS object_viewer RUNTIME DESTINATION maxplugin COMPONENT tools3d)
ENDIF(WITH_MAXPLUGIN)
ENDIF()

View file

@ -20,6 +20,6 @@ ADD_DEFINITIONS(-DNEL_3DSMAX_SHARED_EXPORTS)
IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(nel_3dsmax_shared ${CMAKE_CURRENT_SOURCE_DIR}/StdAfx.h ${CMAKE_CURRENT_SOURCE_DIR}/StdAfx.cpp)
ENDIF(WITH_PCH)
ENDIF()
INSTALL(TARGETS nel_3dsmax_shared RUNTIME DESTINATION maxplugin/plugins LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries)

View file

@ -27,6 +27,6 @@ SET_TARGET_PROPERTIES(nel_export PROPERTIES SUFFIX ".dlu")
IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(nel_export ${CMAKE_CURRENT_SOURCE_DIR}/std_afx.h ${CMAKE_CURRENT_SOURCE_DIR}/std_afx.cpp)
ENDIF(WITH_PCH)
ENDIF()
INSTALL(TARGETS nel_export RUNTIME DESTINATION maxplugin/plugins LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries)

View file

@ -10,6 +10,6 @@ NL_ADD_LIB_SUFFIX(nel_mesh_lib)
IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(nel_mesh_lib ${CMAKE_CURRENT_SOURCE_DIR}/StdAfx.h ${CMAKE_CURRENT_SOURCE_DIR}/StdAfx.cpp)
ENDIF(WITH_PCH)
ENDIF()
INSTALL(TARGETS nel_mesh_lib RUNTIME DESTINATION maxplugin/plugins LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries)

Some files were not shown because too many files have changed in this diff Show more