merging
This commit is contained in:
commit
de3371cae9
1807 changed files with 81453 additions and 2315 deletions
|
@ -60,7 +60,7 @@ IF(Mercurial_HG_EXECUTABLE)
|
|||
"\\1" Mercurial_VERSION_HG "${Mercurial_VERSION_HG}")
|
||||
|
||||
MACRO(Mercurial_WC_INFO dir prefix)
|
||||
EXECUTE_PROCESS(COMMAND ${Mercurial_HG_EXECUTABLE} tip
|
||||
EXECUTE_PROCESS(COMMAND ${Mercurial_HG_EXECUTABLE} tip --template "{rev};{node};{tags};{author}"
|
||||
WORKING_DIRECTORY ${dir}
|
||||
OUTPUT_VARIABLE ${prefix}_WC_INFO
|
||||
ERROR_VARIABLE Mercurial_hg_info_error
|
||||
|
@ -70,18 +70,18 @@ IF(Mercurial_HG_EXECUTABLE)
|
|||
IF(NOT ${Mercurial_hg_info_result} EQUAL 0)
|
||||
MESSAGE(SEND_ERROR "Command \"${Mercurial_HG_EXECUTABLE} tip\" failed with output:\n${Mercurial_hg_info_error}")
|
||||
ELSE(NOT ${Mercurial_hg_info_result} EQUAL 0)
|
||||
|
||||
STRING(REGEX REPLACE "^(.*\n)?Repository Root: ([^\n]+).*"
|
||||
"\\2" ${prefix}_WC_ROOT "${${prefix}_WC_INFO}")
|
||||
STRING(REGEX REPLACE "^(.*\n)?changeset: *([0-9]+).*"
|
||||
"\\2" ${prefix}_WC_REVISION "${${prefix}_WC_INFO}")
|
||||
STRING(REGEX REPLACE "^(.*\n)?Last Changed Author: ([^\n]+).*"
|
||||
"\\2" ${prefix}_WC_LAST_CHANGED_AUTHOR "${${prefix}_WC_INFO}")
|
||||
STRING(REGEX REPLACE "^(.*\n)?Last Changed Rev: ([^\n]+).*"
|
||||
"\\2" ${prefix}_WC_LAST_CHANGED_REV "${${prefix}_WC_INFO}")
|
||||
STRING(REGEX REPLACE "^(.*\n)?Last Changed Date: ([^\n]+).*"
|
||||
"\\2" ${prefix}_WC_LAST_CHANGED_DATE "${${prefix}_WC_INFO}")
|
||||
|
||||
LIST(LENGTH ${prefix}_WC_INFO _COUNT)
|
||||
IF(_COUNT EQUAL 4)
|
||||
LIST(GET ${prefix}_WC_INFO 0 ${prefix}_WC_REVISION)
|
||||
LIST(GET ${prefix}_WC_INFO 1 ${prefix}_WC_CHANGESET)
|
||||
LIST(GET ${prefix}_WC_INFO 2 ${prefix}_WC_BRANCH)
|
||||
LIST(GET ${prefix}_WC_INFO 3 ${prefix}_WC_LAST_CHANGED_AUTHOR)
|
||||
ELSE(_COUNT EQUAL 4)
|
||||
MESSAGE(STATUS "Bad output from HG")
|
||||
SET(${prefix}_WC_REVISION "unknown")
|
||||
SET(${prefix}_WC_CHANGESET "unknown")
|
||||
SET(${prefix}_WC_BRANCH "unknown")
|
||||
ENDIF(_COUNT EQUAL 4)
|
||||
ENDIF(NOT ${Mercurial_hg_info_result} EQUAL 0)
|
||||
|
||||
ENDMACRO(Mercurial_WC_INFO)
|
||||
|
|
|
@ -2,47 +2,86 @@
|
|||
# Find the Windows includes
|
||||
#
|
||||
# WINSDK_INCLUDE_DIR - where to find Windows.h
|
||||
# WINSDK_INCLUDE_DIRS - where to find all Windows headers
|
||||
# WINSDK_LIBRARY_DIR - where to find libraries
|
||||
# WINSDK_FOUND - True if Windows SDK found.
|
||||
|
||||
IF(WINSDK_INCLUDE_DIR)
|
||||
# Already in cache, be silent
|
||||
SET(WINSDK_FIND_QUIETLY TRUE)
|
||||
SET(WindowsSDK_FIND_QUIETLY TRUE)
|
||||
ENDIF(WINSDK_INCLUDE_DIR)
|
||||
|
||||
# TODO: add the possibility to use a specific Windows SDK
|
||||
|
||||
IF(MSVC11)
|
||||
GET_FILENAME_COMPONENT(WINSDK8_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]" ABSOLUTE CACHE)
|
||||
GET_FILENAME_COMPONENT(WINSDK8_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;ProductVersion]" NAME)
|
||||
|
||||
IF(WINSDK8_DIR)
|
||||
IF(NOT WindowsSDK_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found Windows SDK ${WINSDK8_VERSION} in ${WINSDK8_DIR}")
|
||||
ENDIF(NOT WindowsSDK_FIND_QUIETLY)
|
||||
IF(TARGET_ARM)
|
||||
SET(WINSDK8_SUFFIX "arm")
|
||||
ELSEIF(TARGET_X64)
|
||||
SET(WINSDK8_SUFFIX "x64")
|
||||
ELSEIF(TARGET_X86)
|
||||
SET(WINSDK8_SUFFIX "x86")
|
||||
ENDIF(TARGET_ARM)
|
||||
ENDIF(WINSDK8_DIR)
|
||||
ENDIF(MSVC11)
|
||||
|
||||
GET_FILENAME_COMPONENT(WINSDK71_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1;InstallationFolder]" ABSOLUTE CACHE)
|
||||
GET_FILENAME_COMPONENT(WINSDK71_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1;ProductVersion]" NAME)
|
||||
|
||||
IF(WINSDK71_DIR)
|
||||
IF(NOT WINSDK_FIND_QUIETLY)
|
||||
IF(NOT WindowsSDK_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found Windows SDK ${WINSDK71_VERSION} in ${WINSDK71_DIR}")
|
||||
ENDIF(NOT WINSDK_FIND_QUIETLY)
|
||||
ENDIF(NOT WindowsSDK_FIND_QUIETLY)
|
||||
ENDIF(WINSDK71_DIR)
|
||||
|
||||
GET_FILENAME_COMPONENT(WINSDKCURRENT_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" ABSOLUTE CACHE)
|
||||
GET_FILENAME_COMPONENT(WINSDKCURRENT_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentVersion]" NAME)
|
||||
|
||||
IF(WINSDKCURRENT_DIR)
|
||||
IF(NOT WINSDK_FIND_QUIETLY)
|
||||
IF(NOT WindowsSDK_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found Windows SDK ${WINSDKCURRENT_VERSION} in ${WINSDKCURRENT_DIR}")
|
||||
ENDIF(NOT WINSDK_FIND_QUIETLY)
|
||||
ENDIF(NOT WindowsSDK_FIND_QUIETLY)
|
||||
ENDIF(WINSDKCURRENT_DIR)
|
||||
|
||||
FIND_PATH(WINSDK_INCLUDE_DIR Windows.h
|
||||
PATHS
|
||||
HINTS
|
||||
${WINSDK8_DIR}/Include/um
|
||||
${WINSDK71_DIR}/Include
|
||||
${WINSDKCURRENT_DIR}/Include
|
||||
)
|
||||
|
||||
FIND_PATH(WINSDK_SHARED_INCLUDE_DIR d3d9.h
|
||||
HINTS
|
||||
${WINSDK8_DIR}/Include/shared
|
||||
${WINSDK71_DIR}/Include
|
||||
${WINSDKCURRENT_DIR}/Include
|
||||
)
|
||||
|
||||
FIND_PATH(WINSDK_LIBRARY_DIR ComCtl32.lib
|
||||
HINTS
|
||||
${WINSDK8_DIR}/Lib/win8/um/${WINSDK8_SUFFIX}
|
||||
${WINSDK71_DIR}/Lib
|
||||
${WINSDKCURRENT_DIR}/Lib
|
||||
)
|
||||
|
||||
FIND_PROGRAM(WINSDK_SIGNTOOL signtool
|
||||
PATHS
|
||||
HINTS
|
||||
${WINSDK8_DIR}/Bin/x86
|
||||
${WINSDK71_DIR}/Bin
|
||||
${WINSDKCURRENT_DIR}/Bin
|
||||
)
|
||||
|
||||
IF(WINSDK_INCLUDE_DIR)
|
||||
SET(WINSDK_FOUND TRUE)
|
||||
SET(WINSDK_INCLUDE_DIRS ${WINSDK_INCLUDE_DIR} ${WINSDK_SHARED_INCLUDE_DIR})
|
||||
ELSE(WINSDK_INCLUDE_DIR)
|
||||
IF(NOT WINSDK_FIND_QUIETLY)
|
||||
IF(NOT WindowsSDK_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Warning: Unable to find Windows SDK!")
|
||||
ENDIF(NOT WINSDK_FIND_QUIETLY)
|
||||
ENDIF(NOT WindowsSDK_FIND_QUIETLY)
|
||||
ENDIF(WINSDK_INCLUDE_DIR)
|
||||
|
|
|
@ -3,20 +3,24 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3)
|
|||
# ROOT_DIR should be set to root of the repository (where to find the .svn or .hg directory)
|
||||
# SOURCE_DIR should be set to root of your code (where to find CMakeLists.txt)
|
||||
|
||||
# Replace spaces by semi-columns
|
||||
IF(CMAKE_MODULE_PATH)
|
||||
STRING(REPLACE " " ";" CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
|
||||
ENDIF(CMAKE_MODULE_PATH)
|
||||
IF(SOURCE_DIR)
|
||||
# Replace spaces by semi-columns
|
||||
IF(CMAKE_MODULE_PATH)
|
||||
STRING(REPLACE " " ";" CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
|
||||
ENDIF(CMAKE_MODULE_PATH)
|
||||
|
||||
SET(CMAKE_MODULE_PATH ${SOURCE_DIR}/CMakeModules ${CMAKE_MODULE_PATH})
|
||||
SET(CMAKE_MODULE_PATH ${SOURCE_DIR}/CMakeModules ${CMAKE_MODULE_PATH})
|
||||
|
||||
IF(NOT ROOT_DIR AND SOURCE_DIR)
|
||||
SET(ROOT_DIR ${SOURCE_DIR})
|
||||
ENDIF(NOT ROOT_DIR AND SOURCE_DIR)
|
||||
IF(NOT ROOT_DIR AND SOURCE_DIR)
|
||||
SET(ROOT_DIR ${SOURCE_DIR})
|
||||
ENDIF(NOT ROOT_DIR AND SOURCE_DIR)
|
||||
|
||||
IF(NOT SOURCE_DIR AND ROOT_DIR)
|
||||
SET(SOURCE_DIR ${ROOT_DIR})
|
||||
ENDIF(NOT SOURCE_DIR AND ROOT_DIR)
|
||||
IF(NOT SOURCE_DIR AND ROOT_DIR)
|
||||
SET(SOURCE_DIR ${ROOT_DIR})
|
||||
ENDIF(NOT SOURCE_DIR AND ROOT_DIR)
|
||||
ELSE(SOURCE_DIR)
|
||||
SET(ROOT_DIR ${CMAKE_SOURCE_DIR})
|
||||
ENDIF(SOURCE_DIR)
|
||||
|
||||
MACRO(NOW RESULT)
|
||||
IF (WIN32)
|
||||
|
@ -53,10 +57,11 @@ IF(EXISTS "${ROOT_DIR}/.hg/")
|
|||
ENDIF(MERCURIAL_FOUND)
|
||||
ENDIF(EXISTS "${ROOT_DIR}/.hg/")
|
||||
|
||||
IF(DEFINED REVISION)
|
||||
IF(SOURCE_DIR AND DEFINED REVISION)
|
||||
IF(EXISTS ${SOURCE_DIR}/revision.h.in)
|
||||
MESSAGE(STATUS "Revision: ${REVISION}")
|
||||
NOW(BUILD_DATE)
|
||||
CONFIGURE_FILE(${SOURCE_DIR}/revision.h.in revision.h.txt)
|
||||
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy revision.h.txt revision.h) # copy_if_different
|
||||
ENDIF(EXISTS ${SOURCE_DIR}/revision.h.in)
|
||||
ENDIF(DEFINED REVISION)
|
||||
ENDIF(SOURCE_DIR AND DEFINED REVISION)
|
||||
|
|
|
@ -9,250 +9,384 @@
|
|||
# ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp
|
||||
|
||||
IF(MSVC)
|
||||
SET(PCHSupport_FOUND TRUE)
|
||||
SET(_PCH_include_prefix "/I")
|
||||
SET(PCHSupport_FOUND TRUE)
|
||||
SET(_PCH_include_prefix "/I")
|
||||
ELSE(MSVC)
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
|
||||
ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
|
||||
OUTPUT_VARIABLE gcc_compiler_version)
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
|
||||
ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
|
||||
OUTPUT_VARIABLE gcc_compiler_version)
|
||||
|
||||
IF(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]")
|
||||
SET(PCHSupport_FOUND TRUE)
|
||||
ELSE(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]")
|
||||
IF(gcc_compiler_version MATCHES "3\\.4\\.[0-9]")
|
||||
SET(PCHSupport_FOUND TRUE)
|
||||
ENDIF(gcc_compiler_version MATCHES "3\\.4\\.[0-9]")
|
||||
ENDIF(gcc_compiler_version MATCHES "4\\.[0-9]\\.[0-9]")
|
||||
ELSE(CMAKE_COMPILER_IS_GNUCXX)
|
||||
# TODO: make tests for other compilers than GCC
|
||||
SET(PCHSupport_FOUND TRUE)
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
IF(gcc_compiler_version MATCHES "^4\\.1(\\.[0-9]+)?")
|
||||
SET(PCHSupport_FOUND FALSE)
|
||||
ELSEIF(gcc_compiler_version MATCHES "^4\\.[0-9]+(\\.[0-9]+)?")
|
||||
SET(PCHSupport_FOUND TRUE)
|
||||
ENDIF(gcc_compiler_version MATCHES "^4\\.1(\\.[0-9]+)?")
|
||||
ELSE(CMAKE_COMPILER_IS_GNUCXX)
|
||||
# TODO: make tests for other compilers than GCC
|
||||
SET(PCHSupport_FOUND TRUE)
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
SET(_PCH_include_prefix "-I")
|
||||
SET(_PCH_include_prefix "-I")
|
||||
ENDIF(MSVC)
|
||||
|
||||
MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
|
||||
STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name)
|
||||
SET(_FLAGS ${${_flags_var_name}} )
|
||||
# Set PCH_FLAGS for common flags, PCH_ARCH_XXX_FLAGS for specific archs flags and PCH_ARCHS for archs
|
||||
MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||
SET(PCH_FLAGS)
|
||||
SET(PCH_ARCHS)
|
||||
|
||||
IF(NOT MSVC)
|
||||
GET_TARGET_PROPERTY(_targetType ${_PCH_current_target} TYPE)
|
||||
IF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
|
||||
LIST(APPEND _FLAGS "-fPIC")
|
||||
ENDIF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
|
||||
ENDIF(NOT MSVC)
|
||||
SET(FLAGS)
|
||||
LIST(APPEND _FLAGS ${CMAKE_CXX_FLAGS})
|
||||
|
||||
GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES )
|
||||
FOREACH(item ${DIRINC})
|
||||
LIST(APPEND _FLAGS " ${_PCH_include_prefix}\"${item}\"")
|
||||
ENDFOREACH(item)
|
||||
STRING(TOUPPER "${CMAKE_BUILD_TYPE}" _UPPER_BUILD)
|
||||
LIST(APPEND _FLAGS " ${CMAKE_CXX_FLAGS_${_UPPER_BUILD}}")
|
||||
|
||||
# Required for CMake 2.6
|
||||
SET(GLOBAL_DEFINITIONS "")
|
||||
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS)
|
||||
FOREACH(item ${DEFINITIONS})
|
||||
LIST(APPEND GLOBAL_DEFINITIONS -D${item})
|
||||
ENDFOREACH(item)
|
||||
IF(NOT MSVC)
|
||||
GET_TARGET_PROPERTY(_targetType ${_target} TYPE)
|
||||
IF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
|
||||
LIST(APPEND _FLAGS " -fPIC")
|
||||
ENDIF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
|
||||
ENDIF(NOT MSVC)
|
||||
|
||||
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
|
||||
GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS)
|
||||
LIST(APPEND _FLAGS ${GLOBAL_DEFINITIONS})
|
||||
LIST(APPEND _FLAGS ${_directory_flags})
|
||||
LIST(APPEND _FLAGS ${_directory_definitions})
|
||||
LIST(APPEND _FLAGS ${CMAKE_CXX_FLAGS})
|
||||
GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES)
|
||||
FOREACH(item ${DIRINC})
|
||||
LIST(APPEND _FLAGS " ${_PCH_include_prefix}\"${item}\"")
|
||||
ENDFOREACH(item)
|
||||
|
||||
# Format definitions
|
||||
SEPARATE_ARGUMENTS(_FLAGS)
|
||||
# Required for CMake 2.6
|
||||
SET(GLOBAL_DEFINITIONS)
|
||||
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS)
|
||||
FOREACH(item ${DEFINITIONS})
|
||||
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
||||
ENDFOREACH(item)
|
||||
|
||||
IF(CLANG)
|
||||
SET(_IGNORE_NEXT OFF)
|
||||
FOREACH(item ${_FLAGS})
|
||||
IF(_IGNORE_NEXT)
|
||||
SET(_IGNORE_NEXT OFF)
|
||||
ELSE(_IGNORE_NEXT)
|
||||
IF(item MATCHES "^-Xarch")
|
||||
SET(_IGNORE_NEXT ON)
|
||||
ELSEIF(item MATCHES "^-arch")
|
||||
SET(_IGNORE_NEXT ON)
|
||||
ELSE(item MATCHES "^-Xarch")
|
||||
LIST(APPEND ${_out_compile_flags} ${item})
|
||||
ENDIF(item MATCHES "^-Xarch")
|
||||
ENDIF(_IGNORE_NEXT)
|
||||
ENDFOREACH(item)
|
||||
ELSE(CLANG)
|
||||
SET(${_out_compile_flags} ${_FLAGS})
|
||||
ENDIF(CLANG)
|
||||
ENDMACRO(_PCH_GET_COMPILE_FLAGS)
|
||||
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS_${_UPPER_BUILD})
|
||||
FOREACH(item ${DEFINITIONS})
|
||||
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
||||
ENDFOREACH(item)
|
||||
|
||||
MACRO(_PCH_GET_PDB_FILENAME out_filename _target)
|
||||
# determine output directory based on target type
|
||||
GET_TARGET_PROPERTY(_targetType ${_target} TYPE)
|
||||
IF(${_targetType} STREQUAL EXECUTABLE)
|
||||
SET(_targetOutput ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||
ELSEIF(${_targetType} STREQUAL STATIC_LIBRARY)
|
||||
SET(_targetOutput ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
|
||||
ELSE(${_targetType} STREQUAL EXECUTABLE)
|
||||
SET(_targetOutput ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
|
||||
ENDIF(${_targetType} STREQUAL EXECUTABLE)
|
||||
GET_TARGET_PROPERTY(oldProps ${_target} COMPILE_FLAGS)
|
||||
IF(oldProps)
|
||||
LIST(APPEND _FLAGS " ${oldProps}")
|
||||
ENDIF(oldProps)
|
||||
|
||||
# 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)
|
||||
GET_TARGET_PROPERTY(oldPropsBuild ${_target} COMPILE_FLAGS_${_UPPER_BUILD})
|
||||
IF(oldPropsBuild)
|
||||
LIST(APPEND _FLAGS " ${oldPropsBuild}")
|
||||
ENDIF(oldPropsBuild)
|
||||
|
||||
SET(${out_filename} "${_targetOutput}/${_target}${_targetPostfix}.pdb")
|
||||
ENDMACRO(_PCH_GET_PDB_FILENAME)
|
||||
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
|
||||
GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS)
|
||||
LIST(APPEND _FLAGS " ${GLOBAL_DEFINITIONS}")
|
||||
LIST(APPEND _FLAGS " ${_directory_flags}")
|
||||
LIST(APPEND _FLAGS " ${_directory_definitions}")
|
||||
|
||||
MACRO(_PCH_GET_COMPILE_COMMAND out_command _input _inputcpp _output)
|
||||
IF(CMAKE_CXX_COMPILER_ARG1)
|
||||
# remove leading space in compiler argument
|
||||
STRING(REGEX REPLACE "^ +" "" pchsupport_compiler_cxx_arg1 ${CMAKE_CXX_COMPILER_ARG1})
|
||||
ELSE(CMAKE_CXX_COMPILER_ARG1)
|
||||
SET(pchsupport_compiler_cxx_arg1 "")
|
||||
ENDIF(CMAKE_CXX_COMPILER_ARG1)
|
||||
STRING(REGEX REPLACE " +" " " _FLAGS ${_FLAGS})
|
||||
|
||||
IF(MSVC)
|
||||
_PCH_GET_PDB_FILENAME(PDB_FILE ${_PCH_current_target})
|
||||
SET(${out_command} ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} /Yc /Fp\"${_output}\" ${_inputcpp} /c /Fd\"${PDB_FILE}\")
|
||||
ELSE(MSVC)
|
||||
SET(HEADER_FORMAT "c++-header")
|
||||
IF(APPLE)
|
||||
SET(HEADER_FORMAT "objective-${HEADER_FORMAT}")
|
||||
ENDIF(APPLE)
|
||||
SET(${out_command} ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} -x ${HEADER_FORMAT} -o ${_output} -c ${_input})
|
||||
ENDIF(MSVC)
|
||||
ENDMACRO(_PCH_GET_COMPILE_COMMAND)
|
||||
# Format definitions
|
||||
SEPARATE_ARGUMENTS(_FLAGS)
|
||||
|
||||
MACRO(GET_PRECOMPILED_HEADER_OUTPUT _targetName _input _output)
|
||||
IF(MSVC)
|
||||
GET_FILENAME_COMPONENT(_name ${_input} NAME_WE)
|
||||
SET(_output "${CMAKE_CURRENT_BINARY_DIR}/${_name}.pch")
|
||||
ELSE(MSVC)
|
||||
GET_FILENAME_COMPONENT(_name ${_input} NAME)
|
||||
SET(_output "${CMAKE_CURRENT_BINARY_DIR}/${_name}.gch")
|
||||
ENDIF(MSVC)
|
||||
ENDMACRO(GET_PRECOMPILED_HEADER_OUTPUT _targetName _input)
|
||||
IF(CLANG)
|
||||
# Determining all architectures and get common flags
|
||||
SET(_ARCH_NEXT)
|
||||
SET(_XARCH_NEXT)
|
||||
FOREACH(item ${_FLAGS})
|
||||
IF(_ARCH_NEXT)
|
||||
LIST(FIND PCH_ARCHS ${item} ITEM_FOUND)
|
||||
IF(ITEM_FOUND EQUAL -1)
|
||||
LIST(APPEND PCH_ARCHS ${item})
|
||||
STRING(TOUPPER "${item}" _UPPER_ARCH)
|
||||
SET(PCH_ARCH_${_UPPER_ARCH}_FLAGS "-arch" ${item})
|
||||
ENDIF(ITEM_FOUND EQUAL -1)
|
||||
SET(_ARCH_NEXT OFF)
|
||||
ELSEIF(_XARCH_NEXT)
|
||||
SET(_XARCH_NEXT OFF)
|
||||
ELSE(_ARCH_NEXT)
|
||||
IF(item MATCHES "^-arch")
|
||||
SET(_ARCH_NEXT ON)
|
||||
ELSEIF(item MATCHES "^-Xarch_")
|
||||
STRING(REGEX REPLACE "-Xarch_([a-z0-9_]+)" "\\1" item ${item})
|
||||
LIST(FIND PCH_ARCHS ${item} ITEM_FOUND)
|
||||
IF(ITEM_FOUND EQUAL -1)
|
||||
LIST(APPEND PCH_ARCHS ${item})
|
||||
STRING(TOUPPER "${item}" _UPPER_ARCH)
|
||||
SET(PCH_ARCH_${_UPPER_ARCH}_FLAGS "-arch" ${item})
|
||||
ENDIF(ITEM_FOUND EQUAL -1)
|
||||
SET(_XARCH_NEXT ON)
|
||||
ELSE(item MATCHES "^-arch")
|
||||
LIST(APPEND PCH_FLAGS ${item})
|
||||
ENDIF(item MATCHES "^-arch")
|
||||
ENDIF(_ARCH_NEXT)
|
||||
ENDFOREACH(item)
|
||||
|
||||
MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName _input _pch_output_to_use )
|
||||
GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
|
||||
IF(${oldProps} MATCHES NOTFOUND)
|
||||
SET(oldProps "")
|
||||
ENDIF(${oldProps} MATCHES NOTFOUND)
|
||||
# Get architcture specific flags
|
||||
SET(_XARCH_NEXT)
|
||||
FOREACH(item ${_FLAGS})
|
||||
IF(_XARCH_NEXT)
|
||||
STRING(TOUPPER "${_XARCH_NEXT}" _UPPER_XARCH)
|
||||
LIST(APPEND PCH_ARCH_${_UPPER_XARCH}_FLAGS ${item})
|
||||
SET(_XARCH_NEXT OFF)
|
||||
ELSE(_XARCH_NEXT)
|
||||
IF(item MATCHES "^-Xarch_")
|
||||
STRING(SUBSTRING "${item}" 7 -1 _XARCH_NEXT)
|
||||
ENDIF(item MATCHES "^-Xarch_")
|
||||
ENDIF(_XARCH_NEXT)
|
||||
ENDFOREACH(item)
|
||||
|
||||
IF(MSVC)
|
||||
SET(_target_cflags "${oldProps} /Yu\"${_input}\" /FI\"${_input}\" /Fp\"${_pch_output_to_use}\"")
|
||||
ELSE(MSVC)
|
||||
# to do: test whether compiler flags match between target _targetName
|
||||
# and _pch_output_to_use
|
||||
FILE(TO_NATIVE_PATH ${_pch_output_to_use} _native_pch_path)
|
||||
# Remove duplicated architectures
|
||||
IF(_ARCHS AND PCH_ARCHS)
|
||||
LIST(REMOVE_DUPLICATES PCH_ARCHS)
|
||||
ENDIF(_ARCHS AND PCH_ARCHS)
|
||||
ELSE(CLANG)
|
||||
SET(PCH_FLAGS ${_FLAGS})
|
||||
ENDIF(CLANG)
|
||||
|
||||
# for use with distcc and gcc >4.0.1 if preprocessed files are accessible
|
||||
# on all remote machines set
|
||||
# PCH_ADDITIONAL_COMPILER_FLAGS to -fpch-preprocess
|
||||
SET(_target_cflags "${oldProps} ${PCH_ADDITIONAL_COMPILER_FLAGS}-include ${_input} -Winvalid-pch")
|
||||
ENDIF(MSVC)
|
||||
IF(PCH_FLAGS)
|
||||
LIST(REMOVE_DUPLICATES PCH_FLAGS)
|
||||
ENDIF(PCH_FLAGS)
|
||||
ENDMACRO(PCH_SET_COMPILE_FLAGS)
|
||||
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_target_cflags})
|
||||
IF(oldProps)
|
||||
SET_TARGET_PROPERTIES(${_targetName}_pch_dephelp PROPERTIES COMPILE_FLAGS ${oldProps})
|
||||
ENDIF(oldProps)
|
||||
ADD_CUSTOM_TARGET(pch_Generate_${_targetName} DEPENDS ${_pch_output_to_use})
|
||||
ADD_DEPENDENCIES(${_targetName} pch_Generate_${_targetName})
|
||||
MACRO(GET_PDB_FILENAME _out_filename _target)
|
||||
# determine output directory based on target type
|
||||
GET_TARGET_PROPERTY(_targetType ${_target} TYPE)
|
||||
IF(${_targetType} STREQUAL EXECUTABLE)
|
||||
SET(_targetOutput ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||
ELSEIF(${_targetType} STREQUAL STATIC_LIBRARY)
|
||||
SET(_targetOutput ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
|
||||
ELSE(${_targetType} STREQUAL EXECUTABLE)
|
||||
SET(_targetOutput ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
|
||||
ENDIF(${_targetType} STREQUAL EXECUTABLE)
|
||||
|
||||
# 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)
|
||||
|
||||
SET(${_out_filename} "${_targetOutput}/${_target}${_targetPostfix}.pdb")
|
||||
ENDMACRO(GET_PDB_FILENAME)
|
||||
|
||||
MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS)
|
||||
IF(CMAKE_CXX_COMPILER_ARG1)
|
||||
# remove leading space in compiler argument
|
||||
STRING(REGEX REPLACE "^ +" "" pchsupport_compiler_cxx_arg1 ${CMAKE_CXX_COMPILER_ARG1})
|
||||
ELSE(CMAKE_CXX_COMPILER_ARG1)
|
||||
SET(pchsupport_compiler_cxx_arg1 "")
|
||||
ENDIF(CMAKE_CXX_COMPILER_ARG1)
|
||||
|
||||
IF(MSVC)
|
||||
GET_PDB_FILENAME(PDB_FILE ${_PCH_current_target})
|
||||
SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} /Yc /Fp"${PCH_OUTPUT}" ${_inputcpp} /Fd"${PDB_FILE}" /c /Fo"${PCH_OUTPUT}.obj")
|
||||
ELSE(MSVC)
|
||||
SET(HEADER_FORMAT "c++-header")
|
||||
SET(_FLAGS "")
|
||||
IF(APPLE)
|
||||
SET(HEADER_FORMAT "objective-${HEADER_FORMAT}")
|
||||
SET(_FLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch)
|
||||
ENDIF(APPLE)
|
||||
SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} ${_FLAGS} -x ${HEADER_FORMAT} -o ${PCH_OUTPUT} -c ${PCH_INPUT})
|
||||
ENDIF(MSVC)
|
||||
ENDMACRO(PCH_SET_COMPILE_COMMAND)
|
||||
|
||||
MACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT _targetName _input _arch _language)
|
||||
SET(_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${_targetName}_pch")
|
||||
|
||||
IF(MSVC)
|
||||
FILE(MAKE_DIRECTORY ${_OUTPUT_DIR})
|
||||
GET_FILENAME_COMPONENT(_name ${_input} NAME_WE)
|
||||
SET(PCH_INPUT ${_input})
|
||||
SET(PCH_OUTPUT "${_OUTPUT_DIR}/${_name}.pch")
|
||||
ELSE(MSVC)
|
||||
IF(NOT "${_arch}" STREQUAL "")
|
||||
SET(_OUTPUT_DIR "${_OUTPUT_DIR}_${_arch}")
|
||||
ENDIF(NOT "${_arch}" STREQUAL "")
|
||||
|
||||
IF(NOT "${_language}" STREQUAL "")
|
||||
SET(_OUTPUT_DIR "${_OUTPUT_DIR}_${_language}")
|
||||
ENDIF(NOT "${_language}" STREQUAL "")
|
||||
|
||||
GET_FILENAME_COMPONENT(_name ${_input} NAME)
|
||||
|
||||
# Copy .h to output dir
|
||||
SET(PCH_INPUT "${_OUTPUT_DIR}/${_name}")
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${PCH_INPUT}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_input} ${PCH_INPUT}
|
||||
DEPENDS ${_input}
|
||||
COMMENT "[${_targetName}] Update precompiled header - done"
|
||||
)
|
||||
|
||||
IF(CLANG)
|
||||
SET(PCH_EXT "pth")
|
||||
ELSE(CLANG)
|
||||
SET(PCH_EXT "gch")
|
||||
ENDIF(CLANG)
|
||||
|
||||
# For GCC and Clang, PCH needs to be in the same directory as .h
|
||||
SET(PCH_OUTPUT "${_OUTPUT_DIR}/${_name}.${PCH_EXT}")
|
||||
ENDIF(MSVC)
|
||||
ENDMACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT)
|
||||
|
||||
# Add common flags
|
||||
MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName)
|
||||
GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
|
||||
|
||||
IF(${oldProps} MATCHES NOTFOUND)
|
||||
SET(oldProps "")
|
||||
ENDIF(${oldProps} MATCHES NOTFOUND)
|
||||
|
||||
IF(MSVC)
|
||||
SET(_target_cflags "${oldProps} /Yu\"${PCH_INPUT}\" /FI\"${PCH_INPUT}\" /Fp\"${PCH_OUTPUT}\"")
|
||||
ELSE(MSVC)
|
||||
# for use with distcc and gcc >4.0.1 if preprocessed files are accessible
|
||||
# on all remote machines set
|
||||
# PCH_ADDITIONAL_COMPILER_FLAGS to -fpch-preprocess
|
||||
SET(PCH_ADDITIONAL_COMPILER_FLAGS)
|
||||
LIST(LENGTH PCH_ARCHS PCH_ARCHS_COUNT)
|
||||
|
||||
# If no arch is specified, create common flags
|
||||
IF(PCH_ARCHS_COUNT LESS 2)
|
||||
SET(PCH_ADDITIONAL_COMPILER_FLAGS "-include ${PCH_INPUT} ${PCH_ADDITIONAL_COMPILER_FLAGS}")
|
||||
ENDIF(PCH_ARCHS_COUNT LESS 2)
|
||||
|
||||
IF(APPLE)
|
||||
SET(PCH_ADDITIONAL_COMPILER_FLAGS "-fobjc-abi-version=2 -fobjc-legacy-dispatch -x objective-c++ ${PCH_ADDITIONAL_COMPILER_FLAGS}")
|
||||
ENDIF(APPLE)
|
||||
|
||||
IF(WITH_PCH_DEBUG)
|
||||
SET(PCH_ADDITIONAL_COMPILER_FLAGS "-H ${PCH_ADDITIONAL_COMPILER_FLAGS}")
|
||||
ENDIF(WITH_PCH_DEBUG)
|
||||
|
||||
SET(_target_cflags "${oldProps} ${PCH_ADDITIONAL_COMPILER_FLAGS} -Winvalid-pch")
|
||||
ENDIF(MSVC)
|
||||
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_target_cflags})
|
||||
ENDMACRO(ADD_PRECOMPILED_HEADER_TO_TARGET)
|
||||
|
||||
# Add specific flags for an arch
|
||||
MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH _targetName _arch)
|
||||
LIST(LENGTH PCH_ARCHS PCH_ARCHS_COUNT)
|
||||
|
||||
IF(PCH_ARCHS_COUNT GREATER 1)
|
||||
GET_TARGET_PROPERTY(_FLAGS ${_targetName} COMPILE_FLAGS)
|
||||
|
||||
IF(${_FLAGS} MATCHES NOTFOUND)
|
||||
SET(_FLAGS "")
|
||||
ENDIF(${_FLAGS} MATCHES NOTFOUND)
|
||||
|
||||
SET(_FLAGS "${_FLAGS} -Xarch_${_arch} -include${PCH_INPUT}")
|
||||
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_FLAGS})
|
||||
ENDIF(PCH_ARCHS_COUNT GREATER 1)
|
||||
ENDMACRO(ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH)
|
||||
|
||||
MACRO(PCH_CREATE_TARGET _targetName _targetNamePCH)
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${PCH_OUTPUT} COMMAND ${PCH_COMMAND} COMMENT "Generating ${_targetNamePCH}" DEPENDS ${PCH_INPUT})
|
||||
ADD_CUSTOM_TARGET(${_targetNamePCH} DEPENDS ${PCH_INPUT} ${PCH_OUTPUT})
|
||||
ADD_DEPENDENCIES(${_targetName} ${_targetNamePCH})
|
||||
ENDMACRO(PCH_CREATE_TARGET _targetName _inputh _inputcpp)
|
||||
|
||||
MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
|
||||
SET(_PCH_current_target ${_targetName})
|
||||
|
||||
SET(_PCH_current_target ${_targetName})
|
||||
IF(NOT CMAKE_BUILD_TYPE)
|
||||
MESSAGE(FATAL_ERROR
|
||||
"This is the ADD_PRECOMPILED_HEADER macro. "
|
||||
"You must set CMAKE_BUILD_TYPE!"
|
||||
)
|
||||
ENDIF(NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
IF(NOT CMAKE_BUILD_TYPE)
|
||||
MESSAGE(FATAL_ERROR
|
||||
"This is the ADD_PRECOMPILED_HEADER macro. "
|
||||
"You must set CMAKE_BUILD_TYPE!"
|
||||
)
|
||||
ENDIF(NOT CMAKE_BUILD_TYPE)
|
||||
PCH_SET_COMPILE_FLAGS(${_targetName})
|
||||
|
||||
GET_PRECOMPILED_HEADER_OUTPUT( ${_targetName} ${_inputh} _output)
|
||||
IF(PCH_ARCHS)
|
||||
SET(PCH_OUTPUTS)
|
||||
FOREACH(_ARCH ${PCH_ARCHS})
|
||||
STRING(TOUPPER "${_ARCH}" _UPPER_ARCH)
|
||||
|
||||
GET_TARGET_PROPERTY(_targetType ${_PCH_current_target} TYPE)
|
||||
PCH_SET_PRECOMPILED_HEADER_OUTPUT(${_targetName} ${_inputh} ${_ARCH} "")
|
||||
LIST(APPEND PCH_OUTPUTS ${PCH_OUTPUT})
|
||||
|
||||
# always build static library because it doesn't need linking
|
||||
ADD_LIBRARY(${_targetName}_pch_dephelp STATIC ${_inputcpp})
|
||||
PCH_SET_COMPILE_COMMAND(${_inputcpp} "${PCH_ARCH_${_UPPER_ARCH}_FLAGS};${PCH_FLAGS}")
|
||||
PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch_${_ARCH})
|
||||
|
||||
_PCH_GET_COMPILE_FLAGS(_compile_FLAGS)
|
||||
ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH(${_targetName} ${_ARCH})
|
||||
ENDFOREACH(_ARCH)
|
||||
ELSE(PCH_ARCHS)
|
||||
PCH_SET_PRECOMPILED_HEADER_OUTPUT(${_targetName} ${_inputh} "" "")
|
||||
LIST(APPEND PCH_OUTPUTS ${PCH_OUTPUT})
|
||||
|
||||
SET_SOURCE_FILES_PROPERTIES(${_inputh} PROPERTIES GENERATED 1)
|
||||
PCH_SET_COMPILE_COMMAND(${_inputcpp} "${PCH_FLAGS}")
|
||||
PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch)
|
||||
ENDIF(PCH_ARCHS)
|
||||
|
||||
_PCH_GET_COMPILE_COMMAND(_command ${_inputh} ${_inputcpp} ${_output})
|
||||
ADD_PRECOMPILED_HEADER_TO_TARGET(${_targetName})
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${_output}
|
||||
COMMAND ${_command}
|
||||
DEPENDS ${_inputh} ${_targetName}_pch_dephelp
|
||||
)
|
||||
|
||||
ADD_PRECOMPILED_HEADER_TO_TARGET(${_targetName} ${_inputh} ${_output})
|
||||
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PCH_OUTPUTS}")
|
||||
ENDMACRO(ADD_PRECOMPILED_HEADER)
|
||||
|
||||
# Macro to move PCH creation file to the front of files list
|
||||
# or remove .cpp from library/executable to avoid warning
|
||||
MACRO(FIX_PRECOMPILED_HEADER _files _pch)
|
||||
# Remove .cpp creating PCH from the list
|
||||
LIST(REMOVE_ITEM ${_files} ${_pch})
|
||||
# Prepend .cpp creating PCH to the list
|
||||
LIST(INSERT ${_files} 0 ${_pch})
|
||||
# Remove .cpp creating PCH from the list
|
||||
LIST(REMOVE_ITEM ${_files} ${_pch})
|
||||
IF(MSVC)
|
||||
# Prepend .cpp creating PCH to the list
|
||||
LIST(INSERT ${_files} 0 ${_pch})
|
||||
ENDIF(MSVC)
|
||||
ENDMACRO(FIX_PRECOMPILED_HEADER)
|
||||
|
||||
MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
|
||||
SET(PCH_METHOD 0)
|
||||
IF(NOT PCHSupport_FOUND)
|
||||
MESSAGE(STATUS "PCH disabled because compiler doesn't support them")
|
||||
RETURN()
|
||||
ENDIF(NOT PCHSupport_FOUND)
|
||||
|
||||
# 0 => creating a new target for PCH, works for all makefiles
|
||||
# 1 => setting PCH for VC++ project, works for VC++ projects
|
||||
# 2 => setting PCH for XCode project, works for XCode projects
|
||||
IF(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
SET(PCH_METHOD 1)
|
||||
ELSEIF(CMAKE_GENERATOR MATCHES "NMake Makefiles" AND MFC_FOUND AND CMAKE_MFC_FLAG)
|
||||
# To fix a bug with MFC
|
||||
# Don't forget to use FIX_PRECOMPILED_HEADER before creating the target
|
||||
# SET(PCH_METHOD 1)
|
||||
ELSEIF(CMAKE_GENERATOR MATCHES "Xcode")
|
||||
SET(PCH_METHOD 2)
|
||||
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
# 0 => creating a new target for PCH, works for all makefiles
|
||||
# 1 => setting PCH for VC++ project, works for VC++ projects
|
||||
# 2 => setting PCH for XCode project, works for XCode projects
|
||||
IF(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
SET(PCH_METHOD 1)
|
||||
ELSEIF(CMAKE_GENERATOR MATCHES "NMake Makefiles" AND MFC_FOUND AND CMAKE_MFC_FLAG)
|
||||
# To fix a bug with MFC
|
||||
# Don't forget to use FIX_PRECOMPILED_HEADER before creating the target
|
||||
# SET(PCH_METHOD 1)
|
||||
ELSEIF(CMAKE_GENERATOR MATCHES "Xcode")
|
||||
SET(PCH_METHOD 2)
|
||||
ELSE(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
SET(PCH_METHOD 0)
|
||||
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
|
||||
IF(PCH_METHOD EQUAL 1)
|
||||
# Auto include the precompile (useful for moc processing, since the use of
|
||||
# precompiled is specified at the target level
|
||||
# and I don't want to specifiy /F- for each moc/res/ui generated files (using Qt)
|
||||
IF(PCH_METHOD EQUAL 1)
|
||||
# Auto include the precompile (useful for moc processing, since the use of
|
||||
# precompiled is specified at the target level
|
||||
# and I don't want to specifiy /F- for each moc/res/ui generated files (using Qt)
|
||||
|
||||
GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
|
||||
IF(${oldProps} MATCHES NOTFOUND)
|
||||
SET(oldProps "")
|
||||
ENDIF(${oldProps} MATCHES NOTFOUND)
|
||||
GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
|
||||
IF(${oldProps} MATCHES NOTFOUND)
|
||||
SET(oldProps "")
|
||||
ENDIF(${oldProps} MATCHES NOTFOUND)
|
||||
|
||||
SET(newProperties "${oldProps} /Yu\"${_inputh}\" /FI\"${_inputh}\"")
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "${newProperties}")
|
||||
SET(newProperties "${oldProps} /Yu\"${_inputh}\" /FI\"${_inputh}\"")
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "${newProperties}")
|
||||
|
||||
#also inlude ${oldProps} to have the same compile options
|
||||
SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES COMPILE_FLAGS "${oldProps} /Yc\"${_inputh}\"")
|
||||
ELSEIF(PCH_METHOD EQUAL 2)
|
||||
# For Xcode, cmake needs my patch to process
|
||||
# GCC_PREFIX_HEADER and GCC_PRECOMPILE_PREFIX_HEADER as target properties
|
||||
#also inlude ${oldProps} to have the same compile options
|
||||
SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES COMPILE_FLAGS "${oldProps} /Yc\"${_inputh}\"")
|
||||
ELSEIF(PCH_METHOD EQUAL 2)
|
||||
# For Xcode, cmake needs my patch to process
|
||||
# GCC_PREFIX_HEADER and GCC_PRECOMPILE_PREFIX_HEADER as target properties
|
||||
|
||||
GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
|
||||
IF(${oldProps} MATCHES NOTFOUND)
|
||||
SET(oldProps "")
|
||||
ENDIF(${oldProps} MATCHES NOTFOUND)
|
||||
# When buiding out of the tree, precompiled may not be located
|
||||
# Use full path instead.
|
||||
GET_FILENAME_COMPONENT(fullPath ${_inputh} ABSOLUTE)
|
||||
|
||||
# When buiding out of the tree, precompiled may not be located
|
||||
# Use full path instead.
|
||||
GET_FILENAME_COMPONENT(fullPath ${_inputh} ABSOLUTE)
|
||||
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${fullPath}")
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES")
|
||||
ELSE(PCH_METHOD EQUAL 1)
|
||||
#Fallback to the "old" precompiled suppport
|
||||
ADD_PRECOMPILED_HEADER(${_targetName} ${_inputh} ${_inputcpp})
|
||||
ENDIF(PCH_METHOD EQUAL 1)
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${fullPath}")
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES")
|
||||
ELSE(PCH_METHOD EQUAL 1)
|
||||
#Fallback to the "old" precompiled suppport
|
||||
ADD_PRECOMPILED_HEADER(${_targetName} ${_inputh} ${_inputcpp})
|
||||
ENDIF(PCH_METHOD EQUAL 1)
|
||||
|
||||
IF(TARGET ${_targetName}_static)
|
||||
ADD_NATIVE_PRECOMPILED_HEADER(${_targetName}_static ${_inputh} ${_inputcpp})
|
||||
ENDIF(TARGET ${_targetName}_static)
|
||||
ENDMACRO(ADD_NATIVE_PRECOMPILED_HEADER)
|
||||
|
|
|
@ -22,32 +22,52 @@ ENDMACRO(NL_GEN_PC)
|
|||
###
|
||||
MACRO(NL_GEN_REVISION_H)
|
||||
IF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h.in)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
|
||||
ADD_DEFINITIONS(-DHAVE_REVISION_H)
|
||||
SET(HAVE_REVISION_H ON)
|
||||
SET(TOOL_FOUND OFF)
|
||||
|
||||
IF(EXISTS "${CMAKE_SOURCE_DIR}/../.svn/")
|
||||
FIND_PACKAGE(Subversion)
|
||||
|
||||
IF(SUBVERSION_FOUND)
|
||||
SET(TOOL_FOUND ON)
|
||||
ENDIF(SUBVERSION_FOUND)
|
||||
ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/../.svn/")
|
||||
|
||||
IF(EXISTS "${CMAKE_SOURCE_DIR}/../.hg/")
|
||||
FIND_PACKAGE(Mercurial)
|
||||
|
||||
IF(MERCURIAL_FOUND)
|
||||
SET(TOOL_FOUND ON)
|
||||
ENDIF(MERCURIAL_FOUND)
|
||||
ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/../.hg/")
|
||||
|
||||
# if already generated
|
||||
IF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h)
|
||||
# copy it
|
||||
MESSAGE(STATUS "Copying provided revision.h...")
|
||||
FILE(COPY ${CMAKE_SOURCE_DIR}/revision.h DESTINATION ${CMAKE_BINARY_DIR})
|
||||
ELSE(EXISTS ${CMAKE_SOURCE_DIR}/revision.h)
|
||||
SET(HAVE_REVISION_H ON)
|
||||
ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h)
|
||||
|
||||
IF(TOOL_FOUND)
|
||||
# a custom target that is always built
|
||||
ADD_CUSTOM_TARGET(revision ALL
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/revision.h)
|
||||
|
||||
# creates revision.h using cmake script
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_BINARY_DIR}/revision.h
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DSOURCE_DIR=${CMAKE_SOURCE_DIR}
|
||||
-DROOT_DIR=${CMAKE_SOURCE_DIR}/..
|
||||
-DCMAKE_MODULE_PATH=${CMAKE_SOURCE_DIR}/CMakeModules
|
||||
-P ${CMAKE_SOURCE_DIR}/CMakeModules/GetRevision.cmake)
|
||||
|
||||
# revision.h is a generated file
|
||||
SET_SOURCE_FILES_PROPERTIES(${CMAKE_BINARY_DIR}/revision.h
|
||||
PROPERTIES GENERATED TRUE
|
||||
HEADER_FILE_ONLY TRUE)
|
||||
ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h)
|
||||
SET(HAVE_REVISION_H ON)
|
||||
ENDIF(TOOL_FOUND)
|
||||
|
||||
IF(HAVE_REVISION_H)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
|
||||
ADD_DEFINITIONS(-DHAVE_REVISION_H)
|
||||
ENDIF(HAVE_REVISION_H)
|
||||
ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/revision.h.in)
|
||||
ENDMACRO(NL_GEN_REVISION_H)
|
||||
|
||||
|
@ -79,6 +99,11 @@ ENDMACRO(NL_TARGET_DRIVER)
|
|||
# Argument:
|
||||
###
|
||||
MACRO(NL_DEFAULT_PROPS name label)
|
||||
IF(HAVE_REVISION_H)
|
||||
# explicitly say that the target depends on revision.h
|
||||
ADD_DEPENDENCIES(${name} revision)
|
||||
ENDIF(HAVE_REVISION_H)
|
||||
|
||||
# Note: This is just a workaround for a CMake bug generating VS10 files with a colon in the project name.
|
||||
# CMake Bug ID: http://www.cmake.org/Bug/view.php?id=11819
|
||||
STRING(REGEX REPLACE "\\:" " -" proj_label ${label})
|
||||
|
@ -386,7 +411,7 @@ MACRO(NL_SETUP_BUILD)
|
|||
ENDIF(CMAKE_GENERATOR MATCHES "Xcode")
|
||||
|
||||
# If target and host CPU are the same
|
||||
IF("${HOST_CPU}" STREQUAL "${TARGET_CPU}")
|
||||
IF("${HOST_CPU}" STREQUAL "${TARGET_CPU}" AND NOT CMAKE_CROSSCOMPILING)
|
||||
# x86-compatible CPU
|
||||
IF(HOST_CPU MATCHES "x86")
|
||||
IF(NOT CMAKE_SIZEOF_VOID_P)
|
||||
|
@ -407,9 +432,9 @@ MACRO(NL_SETUP_BUILD)
|
|||
MESSAGE(STATUS "Unknown architecture: ${HOST_CPU}")
|
||||
ENDIF(HOST_CPU MATCHES "x86")
|
||||
# TODO: add checks for PPC
|
||||
ELSE("${HOST_CPU}" STREQUAL "${TARGET_CPU}")
|
||||
ELSE("${HOST_CPU}" STREQUAL "${TARGET_CPU}" AND NOT CMAKE_CROSSCOMPILING)
|
||||
MESSAGE(STATUS "Compiling on ${HOST_CPU} for ${TARGET_CPU}")
|
||||
ENDIF("${HOST_CPU}" STREQUAL "${TARGET_CPU}")
|
||||
ENDIF("${HOST_CPU}" STREQUAL "${TARGET_CPU}" AND NOT CMAKE_CROSSCOMPILING)
|
||||
|
||||
# Use values from environment variables
|
||||
SET(PLATFORM_CFLAGS "$ENV{CFLAGS} $ENV{CPPFLAGS} ${PLATFORM_CFLAGS}")
|
||||
|
@ -430,6 +455,7 @@ MACRO(NL_SETUP_BUILD)
|
|||
IF(NOT CMAKE_OSX_ARCHITECTURES)
|
||||
IF(TARGET_CPU STREQUAL "x86_64")
|
||||
SET(TARGET_X64 1)
|
||||
SET(TARGET_X86 1)
|
||||
ELSEIF(TARGET_CPU STREQUAL "x86")
|
||||
SET(TARGET_X86 1)
|
||||
ELSEIF(TARGET_CPU STREQUAL "armv7s")
|
||||
|
@ -446,7 +472,37 @@ MACRO(NL_SETUP_BUILD)
|
|||
SET(TARGET_ARMV5 1)
|
||||
ELSEIF(TARGET_CPU STREQUAL "arm")
|
||||
SET(TARGET_ARM 1)
|
||||
ELSEIF(TARGET_CPU STREQUAL "mips")
|
||||
SET(TARGET_MIPS 1)
|
||||
ENDIF(TARGET_CPU STREQUAL "x86_64")
|
||||
|
||||
IF(TARGET_ARM)
|
||||
IF(TARGET_ARMV7S)
|
||||
ADD_PLATFORM_FLAGS("-DHAVE_ARMV7S")
|
||||
ENDIF(TARGET_ARMV7S)
|
||||
|
||||
IF(TARGET_ARMV7)
|
||||
ADD_PLATFORM_FLAGS("-DHAVE_ARMV7")
|
||||
ENDIF(TARGET_ARMV7)
|
||||
|
||||
IF(TARGET_ARMV6)
|
||||
ADD_PLATFORM_FLAGS("-HAVE_ARMV6")
|
||||
ENDIF(TARGET_ARMV6)
|
||||
|
||||
ADD_PLATFORM_FLAGS("-DHAVE_ARM")
|
||||
ENDIF(TARGET_ARM)
|
||||
|
||||
IF(TARGET_X86)
|
||||
ADD_PLATFORM_FLAGS("-DHAVE_X86")
|
||||
ENDIF(TARGET_X86)
|
||||
|
||||
IF(TARGET_X64)
|
||||
ADD_PLATFORM_FLAGS("-DHAVE_X64 -DHAVE_X86_64")
|
||||
ENDIF(TARGET_X64)
|
||||
|
||||
IF(TARGET_MIPS)
|
||||
ADD_PLATFORM_FLAGS("-DHAVE_MIPS")
|
||||
ENDIF(TARGET_MIPS)
|
||||
ENDIF(NOT CMAKE_OSX_ARCHITECTURES)
|
||||
|
||||
# Fix library paths suffixes for Debian MultiArch
|
||||
|
@ -454,10 +510,9 @@ MACRO(NL_SETUP_BUILD)
|
|||
SET(CMAKE_LIBRARY_PATH /lib/${LIBRARY_ARCHITECTURE} /usr/lib/${LIBRARY_ARCHITECTURE} ${CMAKE_LIBRARY_PATH})
|
||||
IF(TARGET_X64)
|
||||
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib64 /usr/lib64)
|
||||
ENDIF(TARGET_X64)
|
||||
IF(TARGET_X86)
|
||||
ELSEIF(TARGET_X86)
|
||||
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /lib32 /usr/lib32)
|
||||
ENDIF(TARGET_X86)
|
||||
ENDIF(TARGET_X64)
|
||||
ENDIF(LIBRARY_ARCHITECTURE)
|
||||
|
||||
IF(APPLE AND NOT IOS)
|
||||
|
@ -465,32 +520,22 @@ MACRO(NL_SETUP_BUILD)
|
|||
SET(CMAKE_LIBRARY_PATH /opt/local/lib ${CMAKE_LIBRARY_PATH})
|
||||
ENDIF(APPLE AND NOT IOS)
|
||||
|
||||
IF(TARGET_ARM)
|
||||
IF(TARGET_ARMV7)
|
||||
ADD_PLATFORM_FLAGS("-DHAVE_ARMV7")
|
||||
ENDIF(TARGET_ARMV7)
|
||||
|
||||
IF(TARGET_ARMV6)
|
||||
ADD_PLATFORM_FLAGS("-HAVE_ARMV6")
|
||||
ENDIF(TARGET_ARMV6)
|
||||
|
||||
ADD_PLATFORM_FLAGS("-DHAVE_ARM")
|
||||
ENDIF(TARGET_ARM)
|
||||
|
||||
IF(TARGET_X86)
|
||||
ADD_PLATFORM_FLAGS("-DHAVE_X86")
|
||||
ENDIF(TARGET_X86)
|
||||
|
||||
IF(TARGET_X64)
|
||||
ADD_PLATFORM_FLAGS("-DHAVE_X64 -DHAVE_X86_64")
|
||||
ENDIF(TARGET_X64)
|
||||
|
||||
IF(WITH_LOGGING)
|
||||
ADD_PLATFORM_FLAGS("-DENABLE_LOGS")
|
||||
ENDIF(WITH_LOGGING)
|
||||
|
||||
IF(MSVC)
|
||||
IF(MSVC10)
|
||||
IF(MSVC_VERSION EQUAL "1700" AND NOT MSVC11)
|
||||
SET(MSVC11 ON)
|
||||
ENDIF(MSVC_VERSION EQUAL "1700" AND NOT MSVC11)
|
||||
|
||||
IF(MSVC11)
|
||||
ADD_PLATFORM_FLAGS("/Gy- /MP")
|
||||
# /Ox is working with VC++ 2010, but custom optimizations don't exist
|
||||
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
|
||||
# without inlining it's unusable, use custom optimizations again
|
||||
SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}")
|
||||
ELSEIF(MSVC10)
|
||||
ADD_PLATFORM_FLAGS("/Gy- /MP")
|
||||
# /Ox is working with VC++ 2010, but custom optimizations don't exist
|
||||
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
|
||||
|
@ -508,9 +553,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(MSVC10)
|
||||
ELSE(MSVC11)
|
||||
MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}")
|
||||
ENDIF(MSVC10)
|
||||
ENDIF(MSVC11)
|
||||
|
||||
ADD_PLATFORM_FLAGS("/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /Zm1000 /wd4250")
|
||||
|
||||
|
@ -553,13 +598,10 @@ MACRO(NL_SETUP_BUILD)
|
|||
ENDIF(CLANG)
|
||||
ENDIF(WIN32)
|
||||
|
||||
IF(TARGET_ARM)
|
||||
ADD_PLATFORM_FLAGS("-mthumb")
|
||||
ENDIF(TARGET_ARM)
|
||||
|
||||
IF(APPLE)
|
||||
IF(IOS)
|
||||
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.7" CACHE PATH "" FORCE)
|
||||
# Disable CMAKE_OSX_DEPLOYMENT_TARGET for iOS
|
||||
SET(CMAKE_OSX_DEPLOYMENT_TARGET "" CACHE PATH "" FORCE)
|
||||
ELSE(IOS)
|
||||
IF(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
|
||||
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.6" CACHE PATH "" FORCE)
|
||||
|
@ -585,6 +627,11 @@ MACRO(NL_SETUP_BUILD)
|
|||
SET(_ARCHS "${_ARCHS} x86_64")
|
||||
SET(TARGET_X64 1)
|
||||
MATH(EXPR TARGETS_COUNT "${TARGETS_COUNT}+1")
|
||||
ELSEIF(_ARCH STREQUAL "armv7s")
|
||||
SET(_ARCHS "${_ARCHS} armv7s")
|
||||
SET(TARGET_ARMV7S 1)
|
||||
SET(TARGET_ARM 1)
|
||||
MATH(EXPR TARGETS_COUNT "${TARGETS_COUNT}+1")
|
||||
ELSEIF(_ARCH STREQUAL "armv7")
|
||||
SET(_ARCHS "${_ARCHS} armv7")
|
||||
SET(TARGET_ARMV7 1)
|
||||
|
@ -595,16 +642,51 @@ MACRO(NL_SETUP_BUILD)
|
|||
SET(TARGET_ARMV6 1)
|
||||
SET(TARGET_ARM 1)
|
||||
MATH(EXPR TARGETS_COUNT "${TARGETS_COUNT}+1")
|
||||
ELSEIF(_ARCH STREQUAL "mips")
|
||||
SET(_ARCHS "${_ARCHS} mips")
|
||||
SET(TARGET_MIPS 1)
|
||||
MATH(EXPR TARGETS_COUNT "${TARGETS_COUNT}+1")
|
||||
ELSE(_ARCH STREQUAL "i386")
|
||||
SET(_ARCHS "${_ARCHS} unknwon(${_ARCH})")
|
||||
ENDIF(_ARCH STREQUAL "i386")
|
||||
ENDFOREACH(_ARCH)
|
||||
MESSAGE(STATUS "Compiling under Mac OS X for ${TARGETS_COUNT} architectures: ${_ARCHS}")
|
||||
ELSE(CMAKE_OSX_ARCHITECTURES)
|
||||
SET(TARGETS_COUNT 1)
|
||||
SET(TARGETS_COUNT 0)
|
||||
ENDIF(CMAKE_OSX_ARCHITECTURES)
|
||||
|
||||
IF(TARGETS_COUNT EQUAL 1)
|
||||
IF(TARGET_ARM)
|
||||
IF(TARGET_ARMV7S)
|
||||
ADD_PLATFORM_FLAGS("-arch armv7s -DHAVE_ARMV7S")
|
||||
ENDIF(TARGET_ARMV7S)
|
||||
|
||||
IF(TARGET_ARMV7)
|
||||
ADD_PLATFORM_FLAGS("-arch armv7 -DHAVE_ARMV7")
|
||||
ENDIF(TARGET_ARMV7)
|
||||
|
||||
IF(TARGET_ARMV6)
|
||||
ADD_PLATFORM_FLAGS("-arch armv6 -DHAVE_ARMV6")
|
||||
ENDIF(TARGET_ARMV6)
|
||||
|
||||
IF(TARGET_ARMV5)
|
||||
ADD_PLATFORM_FLAGS("-arch armv5 -DHAVE_ARMV5")
|
||||
ENDIF(TARGET_ARMV5)
|
||||
|
||||
ADD_PLATFORM_FLAGS("-mthumb -DHAVE_ARM")
|
||||
ENDIF(TARGET_ARM)
|
||||
|
||||
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)
|
||||
|
||||
IF(TARGET_MIPS)
|
||||
ADD_PLATFORM_FLAGS("-arch mips -DHAVE_MIPS")
|
||||
ENDIF(TARGET_MIPS)
|
||||
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")
|
||||
|
@ -621,15 +703,19 @@ MACRO(NL_SETUP_BUILD)
|
|||
IF(TARGET_ARMV5)
|
||||
ADD_PLATFORM_FLAGS("-arch armv5")
|
||||
ENDIF(TARGET_ARMV5)
|
||||
ENDIF(TARGET_ARM)
|
||||
|
||||
IF(TARGET_X86)
|
||||
ADD_PLATFORM_FLAGS("-arch i386")
|
||||
ENDIF(TARGET_X86)
|
||||
ADD_PLATFORM_FLAGS("-mthumb")
|
||||
ENDIF(TARGET_ARM)
|
||||
|
||||
IF(TARGET_X64)
|
||||
ADD_PLATFORM_FLAGS("-arch x86_64")
|
||||
ELSEIF(TARGET_X86)
|
||||
ADD_PLATFORM_FLAGS("-arch i386")
|
||||
ENDIF(TARGET_X64)
|
||||
|
||||
IF(TARGET_MIPS)
|
||||
ADD_PLATFORM_FLAGS("-arch mips")
|
||||
ENDIF(TARGET_MIPS)
|
||||
ELSE(TARGETS_COUNT EQUAL 1)
|
||||
IF(TARGET_ARMV6)
|
||||
ADD_PLATFORM_FLAGS("-Xarch_armv6 -mthumb -Xarch_armv6 -DHAVE_ARM -Xarch_armv6 -DHAVE_ARMV6")
|
||||
|
@ -640,15 +726,21 @@ MACRO(NL_SETUP_BUILD)
|
|||
ENDIF(TARGET_ARMV7)
|
||||
|
||||
IF(TARGET_X86)
|
||||
ADD_PLATFORM_FLAGS("-arch i386 -Xarch_i386 -DHAVE_X86")
|
||||
ADD_PLATFORM_FLAGS("-Xarch_i386 -DHAVE_X86")
|
||||
ENDIF(TARGET_X86)
|
||||
|
||||
IF(TARGET_X64)
|
||||
ADD_PLATFORM_FLAGS("-arch x86_64 -Xarch_x86_64 -DHAVE_X64 -Xarch_x86_64 -DHAVE_X86_64")
|
||||
ADD_PLATFORM_FLAGS("-Xarch_x86_64 -DHAVE_X64 -Xarch_x86_64 -DHAVE_X86_64")
|
||||
ENDIF(TARGET_X64)
|
||||
|
||||
IF(TARGET_MIPS)
|
||||
ADD_PLATFORM_FLAGS("-Xarch_mips -DHAVE_MIPS")
|
||||
ENDIF(TARGET_MIPS)
|
||||
ENDIF(TARGETS_COUNT EQUAL 1)
|
||||
|
||||
IF(IOS)
|
||||
SET(CMAKE_OSX_SYSROOT "" CACHE PATH "" FORCE)
|
||||
|
||||
IF(IOS_VERSION)
|
||||
PARSE_VERSION_STRING(${IOS_VERSION} IOS_VERSION_MAJOR IOS_VERSION_MINOR IOS_VERSION_PATCH)
|
||||
CONVERT_VERSION_NUMBER(${IOS_VERSION_MAJOR} ${IOS_VERSION_MINOR} ${IOS_VERSION_PATCH} IOS_VERSION_NUMBER)
|
||||
|
@ -657,20 +749,44 @@ MACRO(NL_SETUP_BUILD)
|
|||
ENDIF(IOS_VERSION)
|
||||
|
||||
IF(CMAKE_IOS_SYSROOT)
|
||||
ADD_PLATFORM_FLAGS("-isysroot${CMAKE_IOS_SYSROOT}")
|
||||
ADD_PLATFORM_FLAGS("-miphoneos-version-min=${IOS_VERSION}")
|
||||
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-iphoneos_version_min,${IOS_VERSION}")
|
||||
IF(TARGET_ARMV7S)
|
||||
IF(TARGETS_COUNT GREATER 1)
|
||||
SET(XARCH "-Xarch_armv7s ")
|
||||
ENDIF(TARGETS_COUNT GREATER 1)
|
||||
|
||||
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)
|
||||
|
||||
IF(TARGET_ARMV7)
|
||||
IF(TARGETS_COUNT GREATER 1)
|
||||
SET(XARCH "-Xarch_armv7 ")
|
||||
ENDIF(TARGETS_COUNT GREATER 1)
|
||||
|
||||
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)
|
||||
|
||||
IF(TARGET_ARMV6)
|
||||
IF(TARGETS_COUNT GREATER 1)
|
||||
SET(XARCH "-Xarch_armv6 ")
|
||||
ENDIF(TARGETS_COUNT GREATER 1)
|
||||
|
||||
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)
|
||||
|
||||
IF(CMAKE_IOS_SIMULATOR_SYSROOT AND TARGET_X86)
|
||||
IF(TARGETS_COUNT EQUAL 1)
|
||||
ADD_PLATFORM_FLAGS("-arch i386")
|
||||
ELSE(TARGETS_COUNT EQUAL 1)
|
||||
IF(TARGETS_COUNT GREATER 1)
|
||||
SET(XARCH "-Xarch_i386 ")
|
||||
ENDIF(TARGETS_COUNT EQUAL 1)
|
||||
ENDIF(TARGETS_COUNT GREATER 1)
|
||||
|
||||
# Always force -mmacosx-version-min to override environement variable
|
||||
ADD_PLATFORM_FLAGS("${XARCH}-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||||
ADD_PLATFORM_FLAGS("${XARCH}-isysroot${CMAKE_IOS_SIMULATOR_SYSROOT}")
|
||||
ADD_PLATFORM_FLAGS("${XARCH}-mios-simulator-version-min=${IOS_VERSION}")
|
||||
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${XARCH}-Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||||
ENDIF(CMAKE_IOS_SIMULATOR_SYSROOT AND TARGET_X86)
|
||||
ELSE(IOS)
|
||||
|
@ -722,6 +838,46 @@ MACRO(NL_SETUP_BUILD)
|
|||
ENDIF(CLANG)
|
||||
ENDIF(WITH_WARNINGS)
|
||||
|
||||
IF(ANDROID)
|
||||
ADD_PLATFORM_FLAGS("--sysroot=${PLATFORM_ROOT}")
|
||||
ADD_PLATFORM_FLAGS("-ffunction-sections -funwind-tables")
|
||||
ADD_PLATFORM_FLAGS("-DANDROID")
|
||||
ADD_PLATFORM_FLAGS("-Wa,--noexecstack")
|
||||
|
||||
IF(TARGET_ARM)
|
||||
ADD_PLATFORM_FLAGS("-fpic -fstack-protector")
|
||||
ADD_PLATFORM_FLAGS("-D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__")
|
||||
|
||||
IF(TARGET_ARMV7)
|
||||
ADD_PLATFORM_FLAGS("-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16")
|
||||
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)
|
||||
|
||||
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)
|
||||
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)
|
||||
ELSEIF(TARGET_X86)
|
||||
# Optimizations for Intel Atom
|
||||
ADD_PLATFORM_FLAGS("-march=i686 -mtune=atom -mstackrealign -msse3 -mfpmath=sse -m32 -flto -ffast-math -funroll-loops")
|
||||
ADD_PLATFORM_FLAGS("-fstack-protector -funswitch-loops -finline-limit=300")
|
||||
SET(RELEASE_CFLAGS "${RELEASE_CFLAGS} -fstrict-aliasing")
|
||||
SET(DEBUG_CFLAGS "${DEBUG_CFLAGS} -fno-strict-aliasing")
|
||||
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)
|
||||
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)
|
||||
|
||||
IF(APPLE)
|
||||
ADD_PLATFORM_FLAGS("-gdwarf-2")
|
||||
ENDIF(APPLE)
|
||||
|
@ -775,7 +931,7 @@ ENDMACRO(NL_SETUP_BUILD_FLAGS)
|
|||
MACRO(NL_MAKE_ABSOLUTE_PREFIX NAME_RELATIVE NAME_ABSOLUTE)
|
||||
IF(IS_ABSOLUTE "${${NAME_RELATIVE}}")
|
||||
SET(${NAME_ABSOLUTE} ${${NAME_RELATIVE}})
|
||||
ELSE(IS_ABSOLUTE "${${{NAME_RELATIVE}}")
|
||||
ELSE(IS_ABSOLUTE "${${NAME_RELATIVE}}")
|
||||
IF(WIN32)
|
||||
SET(${NAME_ABSOLUTE} ${${NAME_RELATIVE}})
|
||||
ELSE(WIN32)
|
||||
|
@ -922,11 +1078,41 @@ MACRO(SETUP_EXTERNAL)
|
|||
IF(WIN32)
|
||||
FIND_PACKAGE(External REQUIRED)
|
||||
|
||||
IF(MSVC10)
|
||||
IF(NOT MSVC10_REDIST_DIR)
|
||||
IF(NOT VC_DIR)
|
||||
SET(VC_DIR $ENV{VC_DIR})
|
||||
ENDIF(NOT VC_DIR)
|
||||
|
||||
IF(MSVC11)
|
||||
IF(NOT MSVC_REDIST_DIR)
|
||||
# If you have VC++ 2012 Express, put x64/Microsoft.VC110.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
||||
SET(MSVC_REDIST_DIR "${EXTERNAL_PATH}/redist")
|
||||
ENDIF(NOT MSVC_REDIST_DIR)
|
||||
|
||||
IF(NOT VC_DIR)
|
||||
IF(NOT VC_ROOT_DIR)
|
||||
GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\11.0_Config;InstallDir]" ABSOLUTE)
|
||||
# VC_ROOT_DIR is set to "registry" when a key is not found
|
||||
IF(VC_ROOT_DIR MATCHES "registry")
|
||||
GET_FILENAME_COMPONENT(VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\WDExpress\\11.0_Config\\Setup\\VC;InstallDir]" ABSOLUTE)
|
||||
IF(VC_ROOT_DIR MATCHES "registry")
|
||||
SET(VS110COMNTOOLS $ENV{VS110COMNTOOLS})
|
||||
IF(VS110COMNTOOLS)
|
||||
FILE(TO_CMAKE_PATH ${VS110COMNTOOLS} VC_ROOT_DIR)
|
||||
ENDIF(VS110COMNTOOLS)
|
||||
IF(NOT VC_ROOT_DIR)
|
||||
MESSAGE(FATAL_ERROR "Unable to find VC++ 2012 directory!")
|
||||
ENDIF(NOT VC_ROOT_DIR)
|
||||
ENDIF(VC_ROOT_DIR MATCHES "registry")
|
||||
ENDIF(VC_ROOT_DIR MATCHES "registry")
|
||||
ENDIF(NOT VC_ROOT_DIR)
|
||||
# convert IDE fullpath to VC++ path
|
||||
STRING(REGEX REPLACE "Common7/.*" "VC" VC_DIR ${VC_ROOT_DIR})
|
||||
ENDIF(NOT VC_DIR)
|
||||
ELSEIF(MSVC10)
|
||||
IF(NOT MSVC_REDIST_DIR)
|
||||
# If you have VC++ 2010 Express, put x64/Microsoft.VC100.CRT/*.dll in ${EXTERNAL_PATH}/redist
|
||||
SET(MSVC10_REDIST_DIR "${EXTERNAL_PATH}/redist")
|
||||
ENDIF(NOT MSVC10_REDIST_DIR)
|
||||
SET(MSVC_REDIST_DIR "${EXTERNAL_PATH}/redist")
|
||||
ENDIF(NOT MSVC_REDIST_DIR)
|
||||
|
||||
IF(NOT VC_DIR)
|
||||
IF(NOT VC_ROOT_DIR)
|
||||
|
@ -948,7 +1134,7 @@ MACRO(SETUP_EXTERNAL)
|
|||
# convert IDE fullpath to VC++ path
|
||||
STRING(REGEX REPLACE "Common7/.*" "VC" VC_DIR ${VC_ROOT_DIR})
|
||||
ENDIF(NOT VC_DIR)
|
||||
ELSE(MSVC10)
|
||||
ELSE(MSVC11)
|
||||
IF(NOT VC_DIR)
|
||||
IF(${CMAKE_MAKE_PROGRAM} MATCHES "Common7")
|
||||
# convert IDE fullpath to VC++ path
|
||||
|
@ -958,7 +1144,7 @@ MACRO(SETUP_EXTERNAL)
|
|||
STRING(REGEX REPLACE "VC/bin/.+" "VC" VC_DIR ${CMAKE_CXX_COMPILER})
|
||||
ENDIF(${CMAKE_MAKE_PROGRAM} MATCHES "Common7")
|
||||
ENDIF(NOT VC_DIR)
|
||||
ENDIF(MSVC10)
|
||||
ENDIF(MSVC11)
|
||||
ELSE(WIN32)
|
||||
IF(APPLE)
|
||||
IF(WITH_STATIC_EXTERNAL)
|
||||
|
@ -983,7 +1169,7 @@ MACRO(SETUP_EXTERNAL)
|
|||
|
||||
FIND_PACKAGE(WindowsSDK REQUIRED)
|
||||
# use VC++ and Windows SDK include paths
|
||||
INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR} ${WINSDK_INCLUDE_DIR})
|
||||
INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR} ${WINSDK_INCLUDE_DIRS})
|
||||
ENDIF(MSVC)
|
||||
ENDIF(WITH_STLPORT)
|
||||
ENDMACRO(SETUP_EXTERNAL)
|
||||
|
|
|
@ -71,7 +71,7 @@ public:
|
|||
// For clipTrav. cleared at beginning of CClipTrav::traverse
|
||||
void clearVisibleList();
|
||||
|
||||
// For ClipTrav only. NB: list is cleared at begining of traverse(). NB: only CTransform are supported
|
||||
// For ClipTrav only. NB: list is cleared at begininng of traverse(). NB: only CTransform are supported
|
||||
void addVisibleModel(CTransform *model)
|
||||
{
|
||||
_VisibleList[_CurrentNumVisibleModels]= model;
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
class CCamera : public CTransform
|
||||
{
|
||||
public:
|
||||
/// Call at the begining of the program, to register the model
|
||||
/// Call at the beginning of the program, to register the model
|
||||
static void registerBasic();
|
||||
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ public:
|
|||
|
||||
/// \name Visible List mgt. Those visible models are updated each traverse().
|
||||
//@{
|
||||
// NB: list is cleared at begining of traverse().
|
||||
// NB: list is cleared at beginning of traverse().
|
||||
void addVisibleModel(CTransform *model)
|
||||
{
|
||||
model->_IndexInVisibleList= _CurrentNumVisibleModels;
|
||||
|
|
|
@ -293,6 +293,11 @@ public:
|
|||
*/
|
||||
virtual void forceDXTCCompression(bool dxtcComp)=0;
|
||||
|
||||
/** if different from 0, enable anisotropic filter on textures. -1 enables max value.
|
||||
* Default is 0.
|
||||
*/
|
||||
virtual void setAnisotropicFilter(sint filter)=0;
|
||||
|
||||
/** if !=1, force mostly all the textures (but TextureFonts lightmaps, interfaces etc..)
|
||||
* to be divided by Divisor (2, 4, 8...)
|
||||
* Default is 1.
|
||||
|
|
|
@ -471,6 +471,7 @@ public:
|
|||
virtual void delete3dMouseListener (U3dMouseListener *listener);
|
||||
virtual TPolygonMode getPolygonMode ();
|
||||
virtual void forceDXTCCompression(bool dxtcComp);
|
||||
virtual void setAnisotropicFilter(sint filter);
|
||||
virtual void forceTextureResize(uint divisor);
|
||||
virtual void forceNativeFragmentPrograms(bool nativeOnly);
|
||||
virtual bool setMonitorColorProperties (const CMonitorColorProperties &properties);
|
||||
|
|
|
@ -81,14 +81,14 @@ class IDriver;
|
|||
class CLandscapeGlobals
|
||||
{
|
||||
public:
|
||||
// LANDSCAPE RENDERING CONTEXT. Landscape must setup it at the begining at refine()/render().
|
||||
// LANDSCAPE RENDERING CONTEXT. Landscape must setup it at the beginning at refine()/render().
|
||||
// The current date of LandScape for refine only.
|
||||
static sint CurrentDate;
|
||||
// The current date of LandScape for render only.
|
||||
static sint CurrentRenderDate;
|
||||
// The center view for refinement.
|
||||
static CVector RefineCenter;
|
||||
// What is the treshold for tessellation.
|
||||
// What is the threshold for tessellation.
|
||||
static float RefineThreshold;
|
||||
// Guess.
|
||||
static float OORefineThreshold;
|
||||
|
@ -143,7 +143,7 @@ public:
|
|||
static CLandscapeVBAllocator *CurrentTileVBAllocator;
|
||||
|
||||
|
||||
// PATCH GLOBAL INTERFACE. patch must setup them at the begining at refine()/render().
|
||||
// PATCH GLOBAL INTERFACE. patch must setup them at the beginning at refine()/render().
|
||||
// NO!!! REMIND: can't have any patch global, since a propagated split()/updateErrorMetric()
|
||||
// can arise. must use Patch pointer.
|
||||
|
||||
|
@ -158,7 +158,7 @@ public:
|
|||
|
||||
|
||||
// ***************************************************************************
|
||||
// Out of CLandscapeGlobals, because myabe used in __asm{}
|
||||
// Out of CLandscapeGlobals, because maybe used in __asm{}
|
||||
extern uint NL3D_LandscapeGlobals_PassNTri;
|
||||
extern void *NL3D_LandscapeGlobals_PassTriCurPtr;
|
||||
extern CIndexBuffer::TFormat NL3D_LandscapeGlobals_PassTriFormat;
|
||||
|
|
|
@ -42,7 +42,7 @@ const NLMISC::CClassId LandscapeModelId=NLMISC::CClassId(0x5a573b55, 0x6b395829
|
|||
class CLandscapeModel : public CTransform
|
||||
{
|
||||
public:
|
||||
/// Call at the begining of the program, to register the model
|
||||
/// Call at the beginning of the program, to register the model
|
||||
static void registerBasic();
|
||||
|
||||
public:
|
||||
|
|
|
@ -165,7 +165,7 @@ public:
|
|||
// For clipTrav. cleared at beginning of CClipTrav::traverse
|
||||
void clearVisibleList();
|
||||
|
||||
// For ClipTrav only. NB: list is cleared at begining of traverse().
|
||||
// For ClipTrav only. NB: list is cleared at beginning of traverse().
|
||||
void addVisibleModel(CTransform *model)
|
||||
{
|
||||
_VisibleList[_CurrentNumVisibleModels]= model;
|
||||
|
|
|
@ -53,7 +53,7 @@ const NLMISC::CClassId MeshBaseInstanceId=NLMISC::CClassId(0xef44331, 0x739f6bc
|
|||
class CMeshBaseInstance : public CTransformShape
|
||||
{
|
||||
public:
|
||||
/// Call at the begining of the program, to register the model
|
||||
/// Call at the beginning of the program, to register the model
|
||||
static void registerBasic();
|
||||
|
||||
public:
|
||||
|
|
|
@ -49,7 +49,7 @@ const NLMISC::CClassId MeshInstanceId=NLMISC::CClassId(0x6bfe0a34, 0x23b26dc9);
|
|||
class CMeshInstance : public CMeshBaseInstance
|
||||
{
|
||||
public:
|
||||
/// Call at the begining of the program, to register the model
|
||||
/// Call at the beginning of the program, to register the model
|
||||
static void registerBasic();
|
||||
|
||||
public:
|
||||
|
|
|
@ -49,7 +49,7 @@ const NLMISC::CClassId MeshMRMInstanceId=NLMISC::CClassId(0xec608f3, 0x1111c33)
|
|||
class CMeshMRMInstance : public CMeshBaseInstance
|
||||
{
|
||||
public:
|
||||
/// Call at the begining of the program, to register the model
|
||||
/// Call at the beginning of the program, to register the model
|
||||
static void registerBasic();
|
||||
|
||||
protected:
|
||||
|
|
|
@ -49,7 +49,7 @@ const NLMISC::CClassId MeshMRMSkinnedInstanceId=NLMISC::CClassId(0x6cfd2619, 0x
|
|||
class CMeshMRMSkinnedInstance : public CMeshBaseInstance
|
||||
{
|
||||
public:
|
||||
/// Call at the begining of the program, to register the model
|
||||
/// Call at the beginning of the program, to register the model
|
||||
static void registerBasic();
|
||||
|
||||
protected:
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
Lod0Blend = 0x1,
|
||||
};
|
||||
|
||||
/// Call at the begining of the program, to register the model
|
||||
/// Call at the beginning of the program, to register the model
|
||||
static void registerBasic();
|
||||
|
||||
/// Last Matrix date for Lods
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace NL3D {
|
|||
|
||||
|
||||
/**
|
||||
* This vertex program is used to perform perpixel lighting with meshs. Its ouputs are :
|
||||
* This vertex program is used to perform perpixel lighting with meshs. Its outputs are :
|
||||
*
|
||||
* Coord Tex 0 : duplicate the tex Coord 0 set from the v.b.
|
||||
* Coord Tex 1 : The light vector in tangent space.
|
||||
|
|
|
@ -808,7 +808,7 @@ private:
|
|||
CTessFarVertex BaseFarVertices[4];
|
||||
|
||||
|
||||
// Local info for CTessFace tiles. CPatch must setup them at the begining at refine()/render().
|
||||
// Local info for CTessFace tiles. CPatch must setup them at the beginning at refine()/render().
|
||||
// For Far Texture coordinates.
|
||||
float Far0UScale, Far0VScale, Far0UBias, Far0VBias;
|
||||
float Far1UScale, Far1VScale, Far1UBias, Far1VBias;
|
||||
|
|
|
@ -55,7 +55,7 @@ const NLMISC::CClassId PointLightModelId=NLMISC::CClassId(0x7e842eba, 0x140b6c6
|
|||
class CPointLightModel : public CTransform
|
||||
{
|
||||
public:
|
||||
/// Call at the begining of the program, to register the model
|
||||
/// Call at the beginning of the program, to register the model
|
||||
static void registerBasic();
|
||||
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace NL3D {
|
|||
/*
|
||||
* In this file, we define several template that helps to create attributes maker such as gradient (of float, int, vector etc)
|
||||
* attributes maker are used in the particle system to generate values, such as size, color etc. see ps_attrib_maker.h
|
||||
* for more informations
|
||||
* for more information
|
||||
*/
|
||||
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ const NLMISC::CClassId QuadGridClipManagerId=NLMISC::CClassId(0x1ffb079a, 0x6c5
|
|||
class CQuadGridClipManager : public CTransform
|
||||
{
|
||||
public:
|
||||
/// Call at the begining of the program, to register the model
|
||||
/// Call at the beginning of the program, to register the model
|
||||
static void registerBasic();
|
||||
|
||||
public:
|
||||
|
|
|
@ -227,7 +227,7 @@ public:
|
|||
enum {MaxVPLight= 4};
|
||||
|
||||
/** reset the lighting setup in the driver (all lights are disabled).
|
||||
* called at begining of traverse(). Must be called by any model (before and after rendering)
|
||||
* called at beginning of traverse(). Must be called by any model (before and after rendering)
|
||||
* that wish to use CDriver::setLight() instead of the standard behavior with changeLightSetup()
|
||||
*/
|
||||
void resetLightSetup();
|
||||
|
|
|
@ -39,7 +39,7 @@ const NLMISC::CClassId RootModelId=NLMISC::CClassId(0x25f0505d, 0x75c69f9);
|
|||
class CRootModel : public CTransform
|
||||
{
|
||||
public:
|
||||
/// Call at the begining of the program, to register the model
|
||||
/// Call at the beginning of the program, to register the model
|
||||
static void registerBasic();
|
||||
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
CSegRemanence(CSegRemanence &other);
|
||||
CSegRemanence &operator = (CSegRemanence &other);
|
||||
//@}
|
||||
/// Call at the begining of the program, to register the model
|
||||
/// Call at the beginning of the program, to register the model
|
||||
static void registerBasic();
|
||||
/// to instanciate that model from a scene
|
||||
static CTransform *creator() { return new CSegRemanence; }
|
||||
|
|
|
@ -79,7 +79,7 @@ public:
|
|||
/// max number of bones supported in skeleton
|
||||
enum { MaxNumBones = 256 };
|
||||
|
||||
/// Call at the begining of the program, to register the model
|
||||
/// Call at the beginning of the program, to register the model
|
||||
static void registerBasic();
|
||||
|
||||
public:
|
||||
|
|
|
@ -90,7 +90,7 @@ const NLMISC::CClassId TransformId=NLMISC::CClassId(0x174750cb, 0xf952024);
|
|||
class CTransform : public ITransformable
|
||||
{
|
||||
public:
|
||||
/// Call at the begining of the program, to register the model
|
||||
/// Call at the beginning of the program, to register the model
|
||||
static void registerBasic();
|
||||
|
||||
/// get the scene which has created us
|
||||
|
@ -113,7 +113,7 @@ public:
|
|||
/**
|
||||
* Extra init for a model. this method is called by the framework at the very end of CScene::createModel()
|
||||
* Warning! if the model is a CTransformShape, then when initModel() is called, Shape and other related member/setup
|
||||
* of IShape::createInstance() are not yet done (because createModel() is called at the begining in createInstance()).
|
||||
* of IShape::createInstance() are not yet done (because createModel() is called at the beginning in createInstance()).
|
||||
*
|
||||
* Because initModel() is called at the very end, deriver could implement anything like creating other models,
|
||||
* but not deleting this model...
|
||||
|
|
|
@ -55,7 +55,7 @@ const NLMISC::CClassId TransformShapeId=NLMISC::CClassId(0x1e6115e6, 0x63502517
|
|||
class CTransformShape : public CTransform
|
||||
{
|
||||
public:
|
||||
/// Call at the begining of the program, to register the model
|
||||
/// Call at the beginning of the program, to register the model
|
||||
static void registerBasic();
|
||||
|
||||
public:
|
||||
|
|
|
@ -660,6 +660,11 @@ public:
|
|||
*/
|
||||
virtual void forceDXTCCompression(bool dxtcComp)=0;
|
||||
|
||||
/** if different from 0, enable anisotropic filter on textures. -1 enables max value.
|
||||
* Default is 0.
|
||||
*/
|
||||
virtual void setAnisotropicFilter(sint filter)=0;
|
||||
|
||||
/** if !=1, force mostly all the textures (but TextureFonts lightmaps, interfaces etc..)
|
||||
* to be divided by Divisor (2, 4, 8...)
|
||||
* Default is 1.
|
||||
|
|
|
@ -48,7 +48,7 @@ const NLMISC::CClassId VegetableBlendLayerModelId=NLMISC::CClassId(0x77375163,
|
|||
class CVegetableBlendLayerModel : public CTransform
|
||||
{
|
||||
public:
|
||||
/// Call at the begining of the program, to register the model
|
||||
/// Call at the beginning of the program, to register the model
|
||||
static void registerBasic();
|
||||
|
||||
public:
|
||||
|
|
|
@ -188,7 +188,7 @@ public:
|
|||
* \warning: Only syntax is checked. It doesn't check that a register has been initialised before use.
|
||||
* \param src The input text of a vertex program, in OpenGL format.
|
||||
* \param result The result program.
|
||||
* \param errorOuput If parsing failed, contains the reason
|
||||
* \param errorOutput If parsing failed, contains the reason
|
||||
* \result true if the parsing succeeded
|
||||
*/
|
||||
bool parse(const char *src, TProgram &result, std::string &errorOutput);
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
|
||||
#include "nel/misc/types_nl.h"
|
||||
|
||||
// Include from libxml2
|
||||
#include <libxml/parser.h>
|
||||
|
||||
namespace NLGEORGES
|
||||
{
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "types_nl.h"
|
||||
#include "tds.h"
|
||||
#include "singleton.h"
|
||||
|
||||
|
||||
namespace NLMISC {
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#ifndef NL_CONTIGUOUS_BLOCK_ALLOCATOR_H
|
||||
#define NL_CONTIGUOUS_BLOCK_ALLOCATOR_H
|
||||
|
||||
#include "types_nl.h"
|
||||
|
||||
namespace NLMISC
|
||||
{
|
||||
|
|
|
@ -17,14 +17,14 @@
|
|||
#ifndef NL_DEBUG_H
|
||||
#define NL_DEBUG_H
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include "common.h"
|
||||
#include "log.h"
|
||||
#include "mutex.h"
|
||||
#include "mem_displayer.h"
|
||||
#include "displayer.h"
|
||||
#include "app_context.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <set>
|
||||
|
||||
namespace NLMISC
|
||||
|
@ -169,7 +169,7 @@ void setCrashAlreadyReported(bool state);
|
|||
*\endcode
|
||||
*/
|
||||
#ifdef NL_NO_DEBUG
|
||||
# if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10)
|
||||
# if defined(NL_COMP_VC) && NL_COMP_VC_VERSION >= 71
|
||||
# define nldebug __noop
|
||||
# else
|
||||
# define nldebug 0&&
|
||||
|
@ -184,7 +184,7 @@ void setCrashAlreadyReported(bool state);
|
|||
* Same as nldebug but it will be display in debug and in release mode.
|
||||
*/
|
||||
#ifdef NL_NO_DEBUG
|
||||
# if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10)
|
||||
# if defined(NL_COMP_VC) && NL_COMP_VC_VERSION >= 71
|
||||
# define nlinfo __noop
|
||||
# else
|
||||
# define nlinfo 0&&
|
||||
|
@ -212,7 +212,7 @@ void setCrashAlreadyReported(bool state);
|
|||
*/
|
||||
|
||||
#ifdef NL_NO_DEBUG
|
||||
# if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10)
|
||||
# if defined(NL_COMP_VC) && NL_COMP_VC_VERSION >= 71
|
||||
# define nlwarning __noop
|
||||
# else
|
||||
# define nlwarning 0&&
|
||||
|
@ -478,7 +478,7 @@ do { \
|
|||
|
||||
#endif // NL_NO_DEBUG
|
||||
|
||||
#define nlunreferenced(identifier) (identifier)
|
||||
#define nlunreferenced(identifier) (void)identifier
|
||||
|
||||
#define nlstop \
|
||||
do { \
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#ifndef NL_FILE_H
|
||||
#define NL_FILE_H
|
||||
|
||||
#include "types_nl.h"
|
||||
#include "stream.h"
|
||||
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#ifndef NL_FIXED_SIZE_ALLOCATOR_H
|
||||
#define NL_FIXED_SIZE_ALLOCATOR_H
|
||||
|
||||
#include "types_nl.h"
|
||||
|
||||
namespace NLMISC
|
||||
{
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#ifndef _GRID_TRAVERSAL_H
|
||||
#define _GRID_TRAVERSAL_H
|
||||
|
||||
#include "types_nl.h"
|
||||
|
||||
namespace NLMISC
|
||||
{
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "types_nl.h"
|
||||
#include "game_device.h"
|
||||
|
||||
#include "common.h"
|
||||
|
||||
namespace NLMISC
|
||||
{
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#ifndef RY_INTER_WINDOW_MSG_QUEUE_H
|
||||
#define RY_INTER_WINDOW_MSG_QUEUE_H
|
||||
|
||||
#include "types_nl.h"
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
|
||||
|
|
|
@ -586,7 +586,7 @@ extern uint32 NbMutexes;
|
|||
|
||||
|
||||
/**
|
||||
* This class ensure that the Value is accessed by only one thread. First you have to create a CSynchronized class with you type.
|
||||
* This class ensure that the Value is accessed by only one thread. First you have to create a CSynchronized class with your type.
|
||||
* Then, if a thread want to modify or do anything on it, you create a CAccessor in a \b sub \b scope. You can modify the value
|
||||
* of the CUnfairSynchronized using the value() function \b until the end of the scope. So you have to put the smaller scope as you can.
|
||||
*
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#ifndef NL_OBJECT_ARENA_ALLOCATOR_H
|
||||
#define NL_OBJECT_ARENA_ALLOCATOR_H
|
||||
|
||||
#include "types_nl.h"
|
||||
#include "singleton.h"
|
||||
|
||||
namespace NLMISC
|
||||
|
|
|
@ -17,9 +17,10 @@
|
|||
#ifndef NL_P_THREAD_H
|
||||
#define NL_P_THREAD_H
|
||||
|
||||
#include "types_nl.h"
|
||||
|
||||
#ifdef NL_OS_UNIX
|
||||
|
||||
#include "types_nl.h"
|
||||
#include "thread.h"
|
||||
#include <pthread.h>
|
||||
|
||||
|
|
|
@ -19,14 +19,13 @@
|
|||
|
||||
#include "types_nl.h"
|
||||
#include "time_nl.h"
|
||||
#include "common.h"
|
||||
#include "string_mapper.h"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "common.h"
|
||||
#include "string_mapper.h"
|
||||
|
||||
namespace NLMISC {
|
||||
|
||||
/// Exception throw when a find is not found in a lookup() call
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "matrix.h"
|
||||
#include "stream.h"
|
||||
#include "vector_2f.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#define NL_POOL_MEMORY_H
|
||||
|
||||
#include "types_nl.h"
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "types_nl.h"
|
||||
#include "vector.h"
|
||||
#include "stream.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace NLMISC
|
||||
|
@ -232,8 +233,8 @@ inline bool CQuatT<T>::equal(const CQuatT<T>& a, float epsilon) const
|
|||
template <class T>
|
||||
inline CQuatT<T> CQuatT<T>::operator*(const CQuatT<T>& o) const
|
||||
{
|
||||
// wres= ww´ - v·v´
|
||||
// vres= wv´ + w´v + v^v´ ]
|
||||
// wres= ww' - v.v'
|
||||
// vres= wv' + w'v + v^v' ]
|
||||
return CQuatT<T>(
|
||||
(w*o.x) +(x*o.w) + (y*o.z)-(z*o.y),
|
||||
(w*o.y) +(y*o.w) + (z*o.x)-(x*o.z),
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
#ifndef NL_RESOURCE_PTR_INLINE_H
|
||||
#define NL_RESOURCE_PTR_INLINE_H
|
||||
|
||||
#include "types_nl.h"
|
||||
|
||||
namespace NLMISC
|
||||
{
|
||||
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
#ifndef NL_RGBA_H
|
||||
#define NL_RGBA_H
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "types_nl.h"
|
||||
#include "common.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
namespace NLMISC
|
||||
{
|
||||
|
|
|
@ -17,11 +17,12 @@
|
|||
#ifndef NL_SHA1_H
|
||||
#define NL_SHA1_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "types_nl.h"
|
||||
#include "common.h"
|
||||
#include "stream.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
struct CHashKey
|
||||
{
|
||||
CHashKey () { HashKeyString.resize(20); }
|
||||
|
|
|
@ -352,7 +352,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
#if defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10)
|
||||
#if defined(NL_COMP_VC) && NL_COMP_VC_VERSION >= 80
|
||||
|
||||
// This operator only purpose is to compare with NULL value
|
||||
template <class T>
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
#ifndef NL_SMARTPTR_INLINE_H
|
||||
#define NL_SMARTPTR_INLINE_H
|
||||
|
||||
#include "types_nl.h"
|
||||
|
||||
namespace NLMISC
|
||||
{
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace NLMISC {
|
|||
* will assert when allocations will occur).
|
||||
*
|
||||
* To construct a container which use this allocator, do like this:
|
||||
* list<uint, CSTLBlockAllocator<uint>> myList( ptrOnBlockMemory );
|
||||
* list<uint, CSTLBlockAllocator<uint> > myList( ptrOnBlockMemory );
|
||||
*
|
||||
* But see CSTLBlockList for easier list instanciation, because using it, you'll do like this:
|
||||
* CSTLBlockList<uint> myList(ptrOnBlockMemory);
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "types_nl.h"
|
||||
#include "stl_block_allocator.h"
|
||||
|
||||
#include <list>
|
||||
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "types_nl.h"
|
||||
#include "time_nl.h"
|
||||
|
||||
#include <deque>
|
||||
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "ucstring.h"
|
||||
#include "class_registry.h"
|
||||
#include "common.h"
|
||||
|
||||
#include <utility>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
|
|
@ -17,10 +17,11 @@
|
|||
#ifndef NL_STREAM_INLINE_H
|
||||
#define NL_STREAM_INLINE_H
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include "types_nl.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
|
||||
namespace NLMISC
|
||||
{
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "types_nl.h"
|
||||
#include "common.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace NLMISC
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#define NL_STRING_ID_ARRAY_H
|
||||
|
||||
#include "types_nl.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <string>
|
||||
|
@ -25,8 +26,6 @@
|
|||
#include <set>
|
||||
#include <algorithm>
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
namespace NLMISC {
|
||||
|
||||
|
|
|
@ -18,13 +18,12 @@
|
|||
#define STRING_MAPPER_H
|
||||
|
||||
#include "types_nl.h"
|
||||
#include "stream.h"
|
||||
#include "mutex.h"
|
||||
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
#include "stream.h"
|
||||
#include "mutex.h"
|
||||
|
||||
namespace NLMISC
|
||||
{
|
||||
|
||||
|
|
|
@ -48,32 +48,44 @@
|
|||
# define NL_OS_WINDOWS
|
||||
# define NL_LITTLE_ENDIAN
|
||||
# define NL_CPU_INTEL
|
||||
# ifndef _WIN32_WINNT
|
||||
# ifndef _WIN32_WINNT
|
||||
# define _WIN32_WINNT 0x0500 // Minimal OS = Windows 2000 (NeL is not supported on Windows 95/98)
|
||||
# endif
|
||||
# if _MSC_VER >= 1600
|
||||
# define NL_COMP_VC10
|
||||
# elif _MSC_VER >= 1500
|
||||
# define NL_COMP_VC9
|
||||
# elif _MSC_VER >= 1400
|
||||
# define NL_COMP_VC8
|
||||
# undef nl_time
|
||||
# define nl_time _time32 // use the old 32 bit time function
|
||||
# undef nl_mktime
|
||||
# define nl_mktime _mktime32 // use the old 32 bit time function
|
||||
# undef nl_gmtime
|
||||
# define nl_gmtime _gmtime32 // use the old 32 bit time function
|
||||
# undef nl_localtime
|
||||
# define nl_localtime _localtime32 // use the old 32 bit time function
|
||||
# undef nl_difftime
|
||||
# define nl_difftime _difftime32 // use the old 32 bit time function
|
||||
# elif _MSC_VER >= 1310
|
||||
# define NL_COMP_VC71
|
||||
# elif _MSC_VER >= 1300
|
||||
# define NL_COMP_VC7
|
||||
# elif _MSC_VER >= 1200
|
||||
# define NL_COMP_VC6
|
||||
# define NL_COMP_NEED_PARAM_ON_METHOD
|
||||
# endif
|
||||
# ifdef _MSC_VER
|
||||
# define NL_COMP_VC
|
||||
# if _MSC_VER >= 1700
|
||||
# define NL_COMP_VC11
|
||||
# define NL_COMP_VC_VERSION 110
|
||||
# elif _MSC_VER >= 1600
|
||||
# define NL_COMP_VC10
|
||||
# define NL_COMP_VC_VERSION 100
|
||||
# elif _MSC_VER >= 1500
|
||||
# define NL_COMP_VC9
|
||||
# define NL_COMP_VC_VERSION 90
|
||||
# elif _MSC_VER >= 1400
|
||||
# define NL_COMP_VC8
|
||||
# define NL_COMP_VC_VERSION 80
|
||||
# undef nl_time
|
||||
# define nl_time _time32 // use the old 32 bit time function
|
||||
# undef nl_mktime
|
||||
# define nl_mktime _mktime32 // use the old 32 bit time function
|
||||
# undef nl_gmtime
|
||||
# define nl_gmtime _gmtime32 // use the old 32 bit time function
|
||||
# undef nl_localtime
|
||||
# define nl_localtime _localtime32 // use the old 32 bit time function
|
||||
# undef nl_difftime
|
||||
# define nl_difftime _difftime32 // use the old 32 bit time function
|
||||
# elif _MSC_VER >= 1310
|
||||
# define NL_COMP_VC71
|
||||
# define NL_COMP_VC_VERSION 71
|
||||
# elif _MSC_VER >= 1300
|
||||
# define NL_COMP_VC7
|
||||
# define NL_COMP_VC_VERSION 70
|
||||
# elif _MSC_VER >= 1200
|
||||
# define NL_COMP_VC6
|
||||
# define NL_COMP_VC_VERSION 60
|
||||
# define NL_COMP_NEED_PARAM_ON_METHOD
|
||||
# endif
|
||||
# endif
|
||||
# if defined(_HAS_TR1) && (_HAS_TR1 + 0) // VC9 TR1 feature pack or later
|
||||
# define NL_ISO_STDTR1_AVAILABLE
|
||||
|
@ -320,7 +332,7 @@ typedef unsigned int uint; // at least 32bits (depend of processor)
|
|||
# define CHashMap std::tr1::unordered_map
|
||||
# define CHashSet std::tr1::unordered_set
|
||||
# define CHashMultiMap std::tr1::unordered_multimap
|
||||
#elif defined(NL_COMP_VC7) || defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9) // VC7 through 9
|
||||
#elif defined(NL_COMP_VC) && (NL_COMP_VC_VERSION >= 70 && NL_COMP_VC_VERSION <= 90) // VC7 through 9
|
||||
# include <hash_map>
|
||||
# include <hash_set>
|
||||
# define CHashMap stdext::hash_map
|
||||
|
@ -366,7 +378,7 @@ typedef uint16 ucchar;
|
|||
|
||||
// To define a 64bits constant; ie: UINT64_CONSTANT(0x123456781234)
|
||||
#ifdef NL_OS_WINDOWS
|
||||
# if defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10)
|
||||
# if defined(NL_COMP_VC) && (NL_COMP_VC_VERSION >= 80)
|
||||
# define INT64_CONSTANT(c) (c##LL)
|
||||
# define SINT64_CONSTANT(c) (c##LL)
|
||||
# define UINT64_CONSTANT(c) (c##LL)
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#ifndef NL_WIN32_UTIL_H
|
||||
#define NL_WIN32_UTIL_H
|
||||
|
||||
#include "types_nl.h"
|
||||
|
||||
#ifdef NL_OS_WINDOWS
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace NLMISC
|
|||
* return true and advance the it iterator if match is found.
|
||||
*/
|
||||
bool matchString(std::string::iterator &it, std::string::iterator end, const char *text);
|
||||
/// Advance up to the begining of the next line, incrementing the in/out param lineCount
|
||||
/// Advance up to the beginning of the next line, incrementing the in/out param lineCount
|
||||
void skipLine(std::string::iterator &it, std::string::iterator end, uint32 &lineCount);
|
||||
///@}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# nel-config
|
||||
#
|
||||
# Script printing NeL's install library/include paths and some other
|
||||
# informations like NeL's version
|
||||
# information like NeL's version
|
||||
#
|
||||
|
||||
prefix=@prefix@
|
||||
|
|
|
@ -12,7 +12,7 @@ This sample show:
|
|||
- Managing several dynamic world image
|
||||
- Moving PACS primitives
|
||||
- Managing collisions
|
||||
- Get triggered informations by collisions (flashes)
|
||||
- Get triggered information by collisions (flashes)
|
||||
|
||||
----------------
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace NL3D
|
|||
{
|
||||
|
||||
// ***************************************************************************
|
||||
const uint32 IDriver::InterfaceVersion = 0x6a; // added cursors methods
|
||||
const uint32 IDriver::InterfaceVersion = 0x6b; // added anisotropic filter
|
||||
|
||||
// ***************************************************************************
|
||||
IDriver::IDriver() : _SyncTexDrvInfos( "IDriver::_SyncTexDrvInfos" )
|
||||
|
|
|
@ -292,6 +292,11 @@ CDriverD3D::CDriverD3D()
|
|||
_CurrIndexBufferFormat = CIndexBuffer::IndicesUnknownFormat;
|
||||
_IsGeforce = false;
|
||||
_NonPowerOfTwoTexturesSupported = false;
|
||||
_MaxAnisotropy = 0;
|
||||
_AnisotropicMinSupported = false;
|
||||
_AnisotropicMagSupported = false;
|
||||
_AnisotropicMinCubeSupported = false;
|
||||
_AnisotropicMagCubeSupported = false;
|
||||
|
||||
_FrustumLeft= -1.f;
|
||||
_FrustumRight= 1.f;
|
||||
|
@ -1493,6 +1498,11 @@ bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool r
|
|||
_MaxVertexIndex = caps.MaxVertexIndex;
|
||||
_IsGeforce = !(caps.DevCaps & D3DDEVCAPS_NPATCHES) && (caps.PixelShaderVersion >= D3DPS_VERSION(2, 0) || caps.PixelShaderVersion < D3DPS_VERSION(1, 4));
|
||||
_NonPowerOfTwoTexturesSupported = !(caps.TextureCaps & D3DPTEXTURECAPS_POW2) || (caps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL);
|
||||
_MaxAnisotropy = caps.MaxAnisotropy;
|
||||
_AnisotropicMinSupported = (caps.TextureFilterCaps & D3DPTFILTERCAPS_MINFANISOTROPIC) != 0;
|
||||
_AnisotropicMagSupported = (caps.TextureFilterCaps & D3DPTFILTERCAPS_MAGFANISOTROPIC) != 0;
|
||||
_AnisotropicMinCubeSupported = (caps.CubeTextureFilterCaps & D3DPTFILTERCAPS_MINFANISOTROPIC) != 0;
|
||||
_AnisotropicMagCubeSupported = (caps.CubeTextureFilterCaps & D3DPTFILTERCAPS_MAGFANISOTROPIC) != 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1506,6 +1516,11 @@ bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool r
|
|||
_MaxVertexIndex = 0xffff;
|
||||
_IsGeforce = false;
|
||||
_NonPowerOfTwoTexturesSupported = false;
|
||||
_MaxAnisotropy = 0;
|
||||
_AnisotropicMinSupported = false;
|
||||
_AnisotropicMagSupported = false;
|
||||
_AnisotropicMinCubeSupported = false;
|
||||
_AnisotropicMagCubeSupported = false;
|
||||
}
|
||||
// If 16 bits vertices only, build a vb for quads rendering
|
||||
if (_MaxVertexIndex <= 0xffff)
|
||||
|
@ -1607,6 +1622,7 @@ bool CDriverD3D::setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool r
|
|||
|
||||
// Init some variables
|
||||
_ForceDXTCCompression = false;
|
||||
_AnisotropicFilter = 0;
|
||||
_ForceTextureResizePower = 0;
|
||||
_FogEnabled = false;
|
||||
|
||||
|
@ -2049,6 +2065,25 @@ void CDriverD3D::forceDXTCCompression(bool dxtcComp)
|
|||
|
||||
// ***************************************************************************
|
||||
|
||||
void CDriverD3D::setAnisotropicFilter(sint filter)
|
||||
{
|
||||
H_AUTO_D3D(CDriverD3D_setAnisotropicFilter);
|
||||
|
||||
// anisotropic filter not supported
|
||||
if (_MaxAnisotropy < 2) return;
|
||||
|
||||
if (filter < 0 || filter > _MaxAnisotropy)
|
||||
{
|
||||
_AnisotropicFilter = _MaxAnisotropy;
|
||||
}
|
||||
else
|
||||
{
|
||||
_AnisotropicFilter = filter;
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
void CDriverD3D::forceTextureResize(uint divisor)
|
||||
{
|
||||
H_AUTO_D3D(CDriverD3D_forceTextureResize);
|
||||
|
|
|
@ -640,7 +640,7 @@ public:
|
|||
void *lock (uint size, uint stride, uint &offset);
|
||||
void unlock ();
|
||||
|
||||
// Runtime reset (called at the begining of the frame rendering), blocking lock here.
|
||||
// Runtime reset (called at the beginning of the frame rendering), blocking lock here.
|
||||
void reset ();
|
||||
};
|
||||
|
||||
|
@ -670,7 +670,7 @@ public:
|
|||
void *lock (uint size, uint &offset);
|
||||
void unlock ();
|
||||
|
||||
// Runtime reset (called at the begining of the frame rendering), blocking lock here.
|
||||
// Runtime reset (called at the beginning of the frame rendering), blocking lock here.
|
||||
void reset ();
|
||||
};
|
||||
|
||||
|
@ -777,6 +777,7 @@ public:
|
|||
virtual void disableHardwareVertexArrayAGP();
|
||||
virtual void disableHardwareTextureShader();
|
||||
virtual void forceDXTCCompression(bool dxtcComp);
|
||||
virtual void setAnisotropicFilter(sint filter);
|
||||
virtual void forceTextureResize(uint divisor);
|
||||
virtual void forceNativeFragmentPrograms(bool /* nativeOnly */) {} // ignored
|
||||
|
||||
|
@ -1521,6 +1522,7 @@ public:
|
|||
setSamplerState (stage, D3DSAMP_MAGFILTER, d3dtext->MagFilter);
|
||||
setSamplerState (stage, D3DSAMP_MINFILTER, d3dtext->MinFilter);
|
||||
setSamplerState (stage, D3DSAMP_MIPFILTER, d3dtext->MipFilter);
|
||||
setSamplerState (stage, D3DSAMP_MAXANISOTROPY, _AnisotropicFilter);
|
||||
|
||||
// Profile, log the use of this texture
|
||||
if (_SumTextureMemoryUsed)
|
||||
|
@ -2205,6 +2207,11 @@ private:
|
|||
bool _CubbedMipMapSupported;
|
||||
bool _IsGeforce;
|
||||
bool _NonPowerOfTwoTexturesSupported;
|
||||
uint _MaxAnisotropy;
|
||||
bool _AnisotropicMinSupported;
|
||||
bool _AnisotropicMagSupported;
|
||||
bool _AnisotropicMinCubeSupported;
|
||||
bool _AnisotropicMagCubeSupported;
|
||||
uint _NbNeLTextureStages; // Number of texture stage for NeL (max IDRV_MAT_MAXTEXTURES)
|
||||
uint _MaxVerticesByVertexBufferHard;
|
||||
uint _MaxLight;
|
||||
|
@ -2411,6 +2418,7 @@ private:
|
|||
bool _MustRestoreLight;
|
||||
D3DXMATRIX _D3DMatrixIdentity;
|
||||
DWORD _FogColor;
|
||||
uint _AnisotropicFilter;
|
||||
|
||||
// stencil buffer
|
||||
bool _CurStencilTest;
|
||||
|
|
|
@ -355,8 +355,8 @@ bool CDriverD3D::activeShader(CShader *shd)
|
|||
|
||||
// Assemble the shader
|
||||
LPD3DXBUFFER pErrorMsgs;
|
||||
if (D3DXCreateEffect(_DeviceInterface, shd->getText(), (UINT)strlen(shd->getText())+1, NULL, NULL, 0, NULL, &(shaderInfo->Effect), &pErrorMsgs)
|
||||
== D3D_OK)
|
||||
HRESULT hr = D3DXCreateEffect(_DeviceInterface, shd->getText(), (UINT)strlen(shd->getText())+1, NULL, NULL, 0, NULL, &(shaderInfo->Effect), &pErrorMsgs);
|
||||
if (hr == D3D_OK)
|
||||
{
|
||||
// Get the texture handle
|
||||
uint i;
|
||||
|
@ -374,7 +374,7 @@ bool CDriverD3D::activeShader(CShader *shd)
|
|||
}
|
||||
else
|
||||
{
|
||||
nlwarning ("Can't create shader '%s':", shd->getName());
|
||||
nlwarning ("Can't create shader '%s' (0x%x):", shd->getName(), hr);
|
||||
if (pErrorMsgs)
|
||||
nlwarning ((const char*)pErrorMsgs->GetBufferPointer());
|
||||
shd->_ShaderChanged = false;
|
||||
|
|
|
@ -454,6 +454,7 @@ bool CDriverD3D::generateD3DTexture (ITexture& tex, bool textureDegradation, D3D
|
|||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
// textures with mipmaps doesn't support not power of two sizes
|
||||
// only DXTC formats are beginning with a 'D'
|
||||
if (supportNonPowerOfTwoTextures() && (!isPowerOf2(width) || !isPowerOf2(height)) && levels == 1)
|
||||
|
@ -464,6 +465,7 @@ bool CDriverD3D::generateD3DTexture (ITexture& tex, bool textureDegradation, D3D
|
|||
_DeviceInterface->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
|
||||
_DeviceInterface->SetSamplerState(0, D3DSAMP_ADDRESSW, D3DTADDRESS_CLAMP);
|
||||
}
|
||||
*/
|
||||
|
||||
HRESULT hr = _DeviceInterface->CreateTexture (width, height, levels, renderTarget?D3DUSAGE_RENDERTARGET:0, destFormat, renderTarget?D3DPOOL_DEFAULT:D3DPOOL_MANAGED, &(d3dtext->Texture2d), NULL);
|
||||
|
||||
|
@ -506,6 +508,19 @@ inline void CDriverD3D::setupTextureWrapMode(ITexture& tex)
|
|||
d3dtext->MagFilter = RemapMagTextureFilterTypeNeL2D3D[tex.getMagFilter()];
|
||||
d3dtext->MinFilter = RemapMinTextureFilterTypeNeL2D3D[tex.getMinFilter()];
|
||||
d3dtext->MipFilter = RemapMipTextureFilterTypeNeL2D3D[tex.getMinFilter()];
|
||||
|
||||
// only enable for min filter, because it's never supported for mag filter
|
||||
if (_AnisotropicFilter > 1 && tex.getMinFilter() > ITexture::NearestMipMapLinear)
|
||||
{
|
||||
if (tex.isTextureCube())
|
||||
{
|
||||
if (_AnisotropicMinCubeSupported) d3dtext->MinFilter = D3DTEXF_ANISOTROPIC;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_AnisotropicMinSupported) d3dtext->MinFilter = D3DTEXF_ANISOTROPIC;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ ENDIF(WIN32)
|
|||
|
||||
NL_TARGET_DRIVER(${NLDRV_OGL_LIB} ${SRC})
|
||||
|
||||
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
|
||||
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} nel3d nelmisc ${OPENGL_gl_LIBRARY})
|
||||
NL_DEFAULT_PROPS(${NLDRV_OGL_LIB} "NeL, Driver, Video: OpenGL")
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue