@ -13,11 +13,7 @@ ENDIF(NOT CMAKE_BUILD_TYPE)
MACRO ( NL_GEN_PC name )
IF ( NOT WIN32 AND WITH_INSTALL_LIBRARIES )
CONFIGURE_FILE ( ${ name } .in "${CMAKE_CURRENT_BINARY_DIR}/${name}" )
IF ( CMAKE_LIBRARY_ARCHITECTURE )
INSTALL ( FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}" DESTINATION lib/ ${ CMAKE_LIBRARY_ARCHITECTURE } /pkgconfig )
ELSE ( CMAKE_LIBRARY_ARCHITECTURE )
INSTALL ( FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}" DESTINATION lib/pkgconfig )
ENDIF ( CMAKE_LIBRARY_ARCHITECTURE )
INSTALL ( FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}" DESTINATION ${ NL_LIB_PREFIX } /pkgconfig )
ENDIF ( NOT WIN32 AND WITH_INSTALL_LIBRARIES )
ENDMACRO ( NL_GEN_PC )
@ -250,16 +246,7 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS)
# # #
# O p t i o n a l s u p p o r t
# # #
# C h e c k i f C M a k e i s l a u n c h e d f r o m a D e b i a n p a c k a g i n g s c r i p t
SET ( DEB_HOST_GNU_CPU $ENV{ DEB_HOST_GNU_CPU } )
# D o n ' t s t r i p i f g e n e r a t i n g a . d e b
IF ( DEB_HOST_GNU_CPU )
OPTION ( WITH_SYMBOLS "Keep debug symbols in binaries" ON )
ELSE ( DEB_HOST_GNU_CPU )
OPTION ( WITH_SYMBOLS "Keep debug symbols in binaries" OFF )
ENDIF ( DEB_HOST_GNU_CPU )
OPTION ( WITH_SYMBOLS "Keep debug symbols in binaries" OFF )
IF ( WIN32 )
OPTION ( WITH_STLPORT "With STLport support." ON )
@ -340,6 +327,11 @@ MACRO(NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS)
OPTION ( WITH_SNOWBALLS_SERVER "Build Snowballs Services" ON )
ENDMACRO ( NL_SETUP_SNOWBALLS_DEFAULT_OPTIONS )
MACRO ( ADD_PLATFORM_FLAGS _FLAGS )
SET ( PLATFORM_CFLAGS "${PLATFORM_CFLAGS} ${_FLAGS}" )
SET ( PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} ${_FLAGS}" )
ENDMACRO ( ADD_PLATFORM_FLAGS )
MACRO ( NL_SETUP_BUILD )
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -372,9 +364,6 @@ MACRO(NL_SETUP_BUILD)
ENDIF ( HOST_CPU MATCHES "amd64" )
# D e t e r m i n e t a r g e t C P U
IF ( NOT TARGET_CPU )
SET ( TARGET_CPU $ENV{ DEB_HOST_GNU_CPU } )
ENDIF ( NOT TARGET_CPU )
# I f n o t s p e c i f i e d , u s e t h e s a m e C P U a s h o s t
IF ( NOT TARGET_CPU )
@ -387,9 +376,6 @@ MACRO(NL_SETUP_BUILD)
SET ( TARGET_CPU "x86" )
ENDIF ( TARGET_CPU MATCHES "amd64" )
# D E B _ H O S T _ A R C H _ E N D I A N i s ' l i t t l e ' o r ' b i g '
# D E B _ H O S T _ A R C H _ B I T S i s ' 3 2 ' o r ' 6 4 '
IF ( ${ CMAKE_CXX_COMPILER_ID } MATCHES "Clang" )
SET ( CLANG ON )
MESSAGE ( STATUS "Using Clang compiler" )
@ -427,79 +413,120 @@ MACRO(NL_SETUP_BUILD)
ENDIF ( "${HOST_CPU}" STREQUAL "${TARGET_CPU}" )
# U s e v a l u e s f r o m e n v i r o n m e n t v a r i a b l e s
SET ( PLATFORM_CFLAGS "$ENV{CFLAGS} ${PLATFORM_CFLAGS}" )
SET ( PLATFORM_CFLAGS "$ENV{CFLAGS} $ENV{CPPFLAGS} ${PLATFORM_CFLAGS}" )
SET ( PLATFORM_CXXFLAGS "$ENV{CXXFLAGS} $ENV{CPPFLAGS} ${PLATFORM_CXXFLAGS}" )
SET ( PLATFORM_LINKFLAGS "$ENV{LDFLAGS} ${PLATFORM_LINKFLAGS}" )
# R e m o v e - g a n d - O f l a g b e c a u s e w e a r e m a n a g i n g t h e m o u r s e l f
STRING ( REPLACE "-g" "" PLATFORM_CFLAGS ${ PLATFORM_CFLAGS } )
STRING ( REPLACE "-g" "" PLATFORM_CXXFLAGS ${ PLATFORM_CXXFLAGS } )
STRING ( REGEX REPLACE "-O[0-9s]" "" PLATFORM_CFLAGS ${ PLATFORM_CFLAGS } )
STRING ( REGEX REPLACE "-O[0-9s]" "" PLATFORM_CXXFLAGS ${ PLATFORM_CXXFLAGS } )
# S t r i p s p a c e s
STRING ( STRIP ${ PLATFORM_CFLAGS } PLATFORM_CFLAGS )
STRING ( STRIP ${ PLATFORM_CXXFLAGS } PLATFORM_CXXFLAGS )
STRING ( STRIP ${ PLATFORM_LINKFLAGS } PLATFORM_LINKFLAGS )
IF ( TARGET_CPU STREQUAL "x86_64" )
SET ( TARGET_X64 1 )
SET ( PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_X86_64" )
ELSEIF ( TARGET_CPU STREQUAL "x86" )
SET ( TARGET_X86 1 )
SET ( PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_X86" )
ELSEIF ( TARGET_CPU STREQUAL "arm" )
SET ( TARGET_ARM 1 )
SET ( PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_ARM" )
ENDIF ( TARGET_CPU STREQUAL "x86_64" )
IF ( NOT CMAKE_OSX_ARCHITECTURES )
IF ( TARGET_CPU STREQUAL "x86_64" )
SET ( TARGET_X64 1 )
ELSEIF ( TARGET_CPU STREQUAL "x86" )
SET ( TARGET_X86 1 )
ELSEIF ( TARGET_CPU STREQUAL "armv7s" )
SET ( TARGET_ARM 1 )
SET ( TARGET_ARMV7S 1 )
ELSEIF ( TARGET_CPU STREQUAL "armv7" )
SET ( TARGET_ARM 1 )
SET ( TARGET_ARMV7 1 )
ELSEIF ( TARGET_CPU STREQUAL "armv6" )
SET ( TARGET_ARM 1 )
SET ( TARGET_ARMV6 1 )
ELSEIF ( TARGET_CPU STREQUAL "armv5" )
SET ( TARGET_ARM 1 )
SET ( TARGET_ARMV5 1 )
ELSEIF ( TARGET_CPU STREQUAL "arm" )
SET ( TARGET_ARM 1 )
ENDIF ( TARGET_CPU STREQUAL "x86_64" )
ENDIF ( NOT CMAKE_OSX_ARCHITECTURES )
# F i x l i b r a r y p a t h s s u f f i x e s f o r D e b i a n M u l t i A r c h
SET ( DEBIAN_MULTIARCH $ENV{ DEB_HOST_MULTIARCH } )
IF ( DEBIAN_MULTIARCH )
SET ( CMAKE_LIBRARY_ARCHITECTURE ${ DEBIAN_MULTIARCH } )
ENDIF ( DEBIAN_MULTIARCH )
IF ( CMAKE_LIBRARY_ARCHITECTURE )
SET ( CMAKE_LIBRARY_PATH /lib/ ${ CMAKE_LIBRARY_ARCHITECTURE } /usr/lib/ ${ CMAKE_LIBRARY_ARCHITECTURE } ${ CMAKE_LIBRARY_PATH } )
IF ( LIBRARY_ARCHITECTURE )
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 )
SET ( CMAKE_LIBRARY_PATH ${ CMAKE_LIBRARY_PATH } /lib32 /usr/lib32 )
ENDIF ( TARGET_X86 )
ENDIF ( CMAKE_LIBRARY_ARCHITECTURE )
ENDIF ( LIBRARY_ARCHITECTURE )
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 )
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 )
ADD_PLATFORM_FLAGS ( "/Gy- /MP" )
# / O x i s w o r k i n g w i t h V C + + 2 0 1 0 , b u t c u s t o m o p t i m i z a t i o n s d o n ' t e x i s t
SET ( SPEED_OPTIMIZATIONS "/Ox /GF /GS-" )
SET ( RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS} ")
# w i t h o u t i n l i n i n g i t ' s u n u s a b l e , u s e c u s t o m o p t i m i z a t i o n s a g a i n
SET ( MIN_OPTIMIZATIONS "/Od /Ob1" )
SET ( DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS} ")
ELSEIF ( MSVC90 )
ADD_PLATFORM_FLAGS ( "/Gy- /MP" )
# d o n ' t u s e a / O [ 0 1 2 x ] f l a g i f y o u w a n t c u s t o m o p t i m i z a t i o n s
SET ( SPEED_OPTIMIZATIONS "/Ob2 /Oi /Ot /Oy /GT /GF /GS-" )
SET ( RELEASE_CFLAGS "/Ob2 /Oi /Ot /Oy /GT /GF /GS- ${RELEASE_CFLAGS} ")
# w i t h o u t i n l i n i n g i t ' s u n u s a b l e , u s e c u s t o m o p t i m i z a t i o n s a g a i n
SET ( MIN_OPTIMIZATIONS "/Ob1" )
SET ( DEBUG_CFLAGS "/Ob1 /GF- ${DEBUG_CFLAGS} ")
ELSEIF ( MSVC80 )
ADD_PLATFORM_FLAGS ( "/Gy- /Wp64" )
# d o n ' t u s e a / O [ 0 1 2 x ] f l a g i f y o u w a n t c u s t o m o p t i m i z a t i o n s
SET ( SPEED_OPTIMIZATIONS "/Ox /GF /GS-" )
SET ( RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS} ")
# w i t h o u t i n l i n i n g i t ' s u n u s a b l e , u s e c u s t o m o p t i m i z a t i o n s a g a i n
SET ( MIN_OPTIMIZATIONS "/Od /Ob1" )
SET ( DEBUG_CFLAGS "/Od /Ob1 ${DEBUG_CFLAGS} ")
ELSE ( MSVC10 )
MESSAGE ( FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}" )
ENDIF ( MSVC10 )
SET ( PLATFORM_CFLAGS "${PLATFORM_CFLAGS} /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zm1000 /MP /Gy-" )
ADD_PLATFORM_FLAGS( "/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /Zm1000 /wd4250 ")
IF ( TARGET_X64 )
# F i x a b u g w i t h I n t e l l i s e n s e
SET ( PLATFORM_CFLAGS "${PLATFORM_CFLAGS} /D_WIN64" )
ADD_PLATFORM_FLAGS( " /D_WIN64")
# F i x a c o m p i l a t i o n e r r o r f o r s o m e b i g C + + f i l e s
SET ( MIN_OPTIMIZATIONS "${MIN_OPTIMIZATIONS} /bigobj" )
SET ( RELEASE_CFLAGS "${RELEASE_CFLAG S} /bigobj")
ELSE ( TARGET_X64 )
# A l l o w s 3 2 b i t s a p p l i c a t i o n s t o u s e 3 G B o f R A M
SET ( PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /LARGEADDRESSAWARE" )
ENDIF ( TARGET_X64 )
# E x c e p t i o n s a r e o n l y s e t f o r C + +
SET ( PLATFORM_CXXFLAGS "${PLATFORM_C FLAGS} /EHa")
SET ( PLATFORM_CXXFLAGS "${PLATFORM_C XX FLAGS} /EHa")
IF ( WITH_SYMBOLS )
SET ( NL_RELEASE_CFLAGS "/Zi ${NL_RELEASE_CFLAGS}" )
@ -508,88 +535,204 @@ MACRO(NL_SETUP_BUILD)
SET ( NL_RELEASE_LINKFLAGS "/RELEASE ${NL_RELEASE_LINKFLAGS}" )
ENDIF ( WITH_SYMBOLS )
SET ( NL_DEBUG_CFLAGS "/Zi /MDd /RTC1 /D_DEBUG ${ MIN_OPTIMIZATION S} ${NL_DEBUG_CFLAGS}")
SET ( NL_RELEASE_CFLAGS "/MD /DNDEBUG ${ SPEED_OPTIMIZATION S} ${NL_RELEASE_CFLAGS}")
SET ( NL_DEBUG_CFLAGS "/Zi /MDd /RTC1 /D_DEBUG ${ DEBUG_CFLAG S} ${NL_DEBUG_CFLAGS}")
SET ( NL_RELEASE_CFLAGS "/MD /DNDEBUG ${ RELEASE_CFLAG S} ${NL_RELEASE_CFLAGS}")
SET ( NL_DEBUG_LINKFLAGS "/DEBUG /OPT:NOREF /OPT:NOICF /NODEFAULTLIB:msvcrt /INCREMENTAL:YES ${NL_DEBUG_LINKFLAGS}" )
SET ( NL_RELEASE_LINKFLAGS "/OPT:REF /OPT:ICF /INCREMENTAL:NO ${NL_RELEASE_LINKFLAGS}" )
IF ( WITH_WARNINGS )
SET ( DEBUG_CFLAGS "/W4 ${DEBUG_CFLAGS}" )
ELSE ( WITH_WARNINGS )
SET ( DEBUG_CFLAGS "/W3 ${DEBUG_CFLAGS}" )
ENDIF ( WITH_WARNINGS )
ELSE ( MSVC )
IF ( WIN32 )
SET ( PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DWIN32 -D_WIN32" )
ADD_PLATFORM_FLAGS ( "-DWIN32 -D_WIN32" )
IF ( CLANG )
ADD_PLATFORM_FLAGS ( "-nobuiltininc" )
ENDIF ( CLANG )
ENDIF ( WIN32 )
IF ( APPLE )
IF ( TARGET_CPU STREQUAL "x86" )
SET ( PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -arch i386" )
ENDIF ( TARGET_CPU STREQUAL "x86" )
IF ( TARGET_ARM )
ADD_PLATFORM_FLAGS ( "-mthumb" )
ENDIF ( TARGET_ARM )
IF ( TARGET_CPU STREQUAL "x86_64" )
SET ( PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -arch x86_64" )
ENDIF ( TARGET_CPU STREQUAL "x86_64" )
IF ( APPLE )
IF ( IOS )
SET ( CMAKE_OSX_DEPLOYMENT_TARGET "10.7" CACHE PATH "" FORCE )
ELSE ( IOS )
IF ( NOT CMAKE_OSX_DEPLOYMENT_TARGET )
SET ( CMAKE_OSX_DEPLOYMENT_TARGET "10.6" CACHE PATH "" FORCE )
ENDIF ( NOT CMAKE_OSX_DEPLOYMENT_TARGET )
ENDIF ( IOS )
IF ( XCODE )
IF ( IOS )
SET ( CMAKE_OSX_SYSROOT "iphoneos" CACHE PATH "" FORCE )
ELSE ( IOS )
# SET ( CMAKE_OSX_SYSROOT "macosx" CACHE PATH "" FORCE )
ENDIF ( IOS )
ELSE ( XCODE )
IF ( CMAKE_OSX_ARCHITECTURES )
SET ( TARGETS_COUNT 0 )
SET ( _ARCHS )
FOREACH ( _ARCH ${ CMAKE_OSX_ARCHITECTURES } )
IF ( _ARCH STREQUAL "i386" )
SET ( _ARCHS "${_ARCHS} i386" )
SET ( TARGET_X86 1 )
MATH ( EXPR TARGETS_COUNT "${TARGETS_COUNT}+1" )
ELSEIF ( _ARCH STREQUAL "x86_64" )
SET ( _ARCHS "${_ARCHS} x86_64" )
SET ( TARGET_X64 1 )
MATH ( EXPR TARGETS_COUNT "${TARGETS_COUNT}+1" )
ELSEIF ( _ARCH STREQUAL "armv7" )
SET ( _ARCHS "${_ARCHS} armv7" )
SET ( TARGET_ARMV7 1 )
SET ( TARGET_ARM 1 )
MATH ( EXPR TARGETS_COUNT "${TARGETS_COUNT}+1" )
ELSEIF ( _ARCH STREQUAL "armv6" )
SET ( _ARCHS "${_ARCHS} armv6" )
SET ( TARGET_ARMV6 1 )
SET ( TARGET_ARM 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 )
ENDIF ( CMAKE_OSX_ARCHITECTURES )
IF ( TARGETS_COUNT EQUAL 1 )
IF ( TARGET_ARM )
IF ( TARGET_ARMV7S )
ADD_PLATFORM_FLAGS ( "-arch armv7s" )
ENDIF ( TARGET_ARMV7S )
IF ( TARGET_ARMV7 )
ADD_PLATFORM_FLAGS ( "-arch armv7" )
ENDIF ( TARGET_ARMV7 )
IF ( TARGET_ARMV6 )
ADD_PLATFORM_FLAGS ( "-arch armv6" )
ENDIF ( TARGET_ARMV6 )
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 )
IF ( TARGET_X64 )
ADD_PLATFORM_FLAGS ( "-arch x86_64" )
ENDIF ( TARGET_X64 )
ELSE ( TARGETS_COUNT EQUAL 1 )
IF ( TARGET_ARMV6 )
ADD_PLATFORM_FLAGS ( "-Xarch_armv6 -mthumb -Xarch_armv6 -DHAVE_ARM -Xarch_armv6 -DHAVE_ARMV6" )
ENDIF ( TARGET_ARMV6 )
IF ( TARGET_ARMV7 )
ADD_PLATFORM_FLAGS ( "-Xarch_armv7 -mthumb -Xarch_armv7 -DHAVE_ARM -Xarch_armv7 -DHAVE_ARMV7" )
ENDIF ( TARGET_ARMV7 )
IF ( TARGET_X86 )
ADD_PLATFORM_FLAGS ( "-arch i386 -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" )
ENDIF ( TARGET_X64 )
ENDIF ( TARGETS_COUNT EQUAL 1 )
IF ( IOS )
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 )
ADD_PLATFORM_FLAGS ( "-D__IPHONE_OS_VERSION_MIN_REQUIRED=${IOS_VERSION_NUMBER}" )
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}" )
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 )
SET ( XARCH "-Xarch_i386 " )
ENDIF ( TARGETS_COUNT EQUAL 1 )
# A l w a y s f o r c e - m m a c o s x - v e r s i o n - m i n t o o v e r r i d e e n v i r o n e m e n t v a r i a b l e
ADD_PLATFORM_FLAGS ( "${XARCH}-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}" )
SET ( PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${XARCH}-Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}" )
ENDIF ( CMAKE_IOS_SIMULATOR_SYSROOT AND TARGET_X86 )
ELSE ( IOS )
FOREACH ( _SDK ${ _CMAKE_OSX_SDKS } )
IF ( ${ _SDK } MATCHES "MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET}\\.sdk" )
SET ( CMAKE_OSX_SYSROOT ${ _SDK } CACHE PATH "" FORCE )
ENDIF ( ${ _SDK } MATCHES "MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET}\\.sdk" )
ENDFOREACH ( _SDK )
IF ( CMAKE_OSX_SYSROOT )
ADD_PLATFORM_FLAGS ( "-isysroot ${CMAKE_OSX_SYSROOT}" )
ELSE ( CMAKE_OSX_SYSROOT )
MESSAGE ( FATAL_ERROR "CMAKE_OSX_SYSROOT can't be determinated" )
ENDIF ( CMAKE_OSX_SYSROOT )
# A l w a y s f o r c e - m m a c o s x - v e r s i o n - m i n t o o v e r r i d e e n v i r o n e m e n t v a r i a b l e
ADD_PLATFORM_FLAGS ( "-mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}" )
SET ( PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-macosx_version_min,${CMAKE_OSX_DEPLOYMENT_TARGET}" )
ENDIF ( IOS )
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 ( XCODE )
ELSE ( APPLE )
IF ( HOST_CPU STREQUAL "x86_64" AND TARGET_CPU STREQUAL "x86" )
SET ( PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -m32 -march=i686" )
ADD_PLATFORM_FLAGS( " -m32 -march=i686")
ENDIF ( HOST_CPU STREQUAL "x86_64" AND TARGET_CPU STREQUAL "x86" )
IF ( HOST_CPU STREQUAL "x86" AND TARGET_CPU STREQUAL "x86_64" )
SET ( PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -m64" )
ADD_PLATFORM_FLAGS( " -m64")
ENDIF ( HOST_CPU STREQUAL "x86" AND TARGET_CPU STREQUAL "x86_64" )
ENDIF ( APPLE )
SET ( PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -D_REENTRANT -pipe -Wall -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-unused -fno-strict-aliasing" )
IF ( NOT ${ CMAKE_CXX_COMPILER_ID } STREQUAL "Clang" )
SET ( PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -ansi" )
ENDIF ( NOT ${ CMAKE_CXX_COMPILER_ID } STREQUAL "Clang" )
ADD_PLATFORM_FLAGS ( "-D_REENTRANT -pipe -fno-strict-aliasing" )
IF ( WITH_COVERAGE )
SET ( PLATFORM_CFLAGS "-fprofile-arcs -ftest-coverage ${PLATFORM_CFLAGS}" )
ADD_PLATFORM_FLAGS ( "-fprofile-arcs -ftest-coverage" )
ENDIF ( WITH_COVERAGE )
IF ( WITH_WARNINGS )
ADD_PLATFORM_FLAGS ( "-Wall -W -Wpointer-arith -Wsign-compare -Wno-deprecated-declarations -Wno-multichar -Wno-unused" )
IF ( CLANG )
ADD_PLATFORM_FLAGS ( "-std=gnu99" )
ELSE ( CLANG )
ADD_PLATFORM_FLAGS ( "-ansi" )
ENDIF ( CLANG )
ENDIF ( WITH_WARNINGS )
IF ( APPLE )
SET ( PLATFORM_CFLAGS "-gdwarf-2 ${PLATFORM_CFLAGS}" )
ADD_PLATFORM_FLAGS( "-gdwarf-2 ")
ENDIF ( APPLE )
IF ( APPLE AND XCODE )
# SET ( CMAKE_OSX_SYSROOT "macosx" CACHE PATH "" FORCE )
ELSEIF ( APPLE AND NOT XCODE )
IF ( NOT CMAKE_OSX_DEPLOYMENT_TARGET )
SET ( CMAKE_OSX_DEPLOYMENT_TARGET "10.6" )
ENDIF ( NOT CMAKE_OSX_DEPLOYMENT_TARGET )
FOREACH ( _SDK ${ _CMAKE_OSX_SDKS } )
IF ( ${ _SDK } MATCHES "MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET}\\.sdk" )
SET ( CMAKE_OSX_SYSROOT ${ _SDK } CACHE PATH "" FORCE )
ENDIF ( ${ _SDK } MATCHES "MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET}\\.sdk" )
ENDFOREACH ( _SDK )
IF ( CMAKE_OSX_SYSROOT )
SET ( PLATFORM_CFLAGS "-isysroot ${CMAKE_OSX_SYSROOT} ${PLATFORM_CFLAGS}" )
ELSE ( CMAKE_OSX_SYSROOT )
MESSAGE ( FATAL_ERROR "CMAKE_OSX_SYSROOT can't be determinated" )
ENDIF ( CMAKE_OSX_SYSROOT )
IF ( CMAKE_OSX_ARCHITECTURES )
FOREACH ( _ARCH ${ CMAKE_OSX_ARCHITECTURES } )
SET ( PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -arch ${_ARCH}" )
ENDFOREACH ( _ARCH )
ENDIF ( CMAKE_OSX_ARCHITECTURES )
IF ( CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG )
SET ( PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}" )
ENDIF ( CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG )
SET ( PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,-headerpad_max_install_names" )
IF ( HAVE_FLAG_SEARCH_PATHS_FIRST )
SET ( PLATFORM_LINKFLAGS "-Wl,-search_paths_first ${PLATFORM_LINKFLAGS}" )
ENDIF ( HAVE_FLAG_SEARCH_PATHS_FIRST )
ENDIF ( APPLE AND XCODE )
# F i x " r e l o c a t i o n R _ X 8 6 _ 6 4 _ 3 2 a g a i n s t . . " e r r o r o n x 6 4 p l a t f o r m s
IF ( TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS )
SET ( PLATFORM_CFLAGS "-fPIC ${PLATFORM_CFLAGS}" )
ADD_PLATFORM_FLAGS ( "-fPIC" )
ENDIF ( TARGET_X64 AND WITH_STATIC AND NOT WITH_STATIC_DRIVERS )
SET ( PLATFORM_CXXFLAGS "${PLATFORM_CFLAGS} -ftemplate-depth-48" )
SET ( PLATFORM_CXXFLAGS "${PLATFORM_CXXFLAGS} -ftemplate-depth-48" )
IF ( NOT APPLE )
SET ( PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -Wl,--no-undefined -Wl,--as-needed" )
@ -685,11 +828,11 @@ MACRO(NL_SETUP_PREFIX_PATHS)
# # A l l o w o v e r r i d e o f i n s t a l l _ p r e f i x / l i b p a t h .
IF ( NOT NL_LIB_PREFIX )
IF ( CMAKE_ LIBRARY_ARCHITECTURE)
SET ( NL_LIB_PREFIX "lib/${ CMAKE_ LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries." )
ELSE ( CMAKE_ LIBRARY_ARCHITECTURE)
IF ( LIBRARY_ARCHITECTURE)
SET ( NL_LIB_PREFIX "lib/${ LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries." )
ELSE ( LIBRARY_ARCHITECTURE)
SET ( NL_LIB_PREFIX "lib" CACHE PATH "Installation path for libraries." )
ENDIF ( CMAKE_ LIBRARY_ARCHITECTURE)
ENDIF ( LIBRARY_ARCHITECTURE)
ENDIF ( NOT NL_LIB_PREFIX )
NL_MAKE_ABSOLUTE_PREFIX ( NL_LIB_PREFIX NL_LIB_ABSOLUTE_PREFIX )
@ -698,11 +841,11 @@ MACRO(NL_SETUP_PREFIX_PATHS)
IF ( WIN32 )
SET ( NL_DRIVER_PREFIX "." CACHE PATH "Installation path for drivers." )
ELSE ( WIN32 )
IF ( CMAKE_ LIBRARY_ARCHITECTURE)
SET ( NL_DRIVER_PREFIX "lib/${ CMAKE_ LIBRARY_ARCHITECTURE}/nel" CACHE PATH "Installation path for drivers." )
ELSE ( CMAKE_ LIBRARY_ARCHITECTURE)
IF ( LIBRARY_ARCHITECTURE)
SET ( NL_DRIVER_PREFIX "lib/${ LIBRARY_ARCHITECTURE}/nel" CACHE PATH "Installation path for drivers." )
ELSE ( LIBRARY_ARCHITECTURE)
SET ( NL_DRIVER_PREFIX "lib/nel" CACHE PATH "Installation path for drivers." )
ENDIF ( CMAKE_ LIBRARY_ARCHITECTURE)
ENDIF ( LIBRARY_ARCHITECTURE)
ENDIF ( WIN32 )
ENDIF ( NOT NL_DRIVER_PREFIX )
NL_MAKE_ABSOLUTE_PREFIX ( NL_DRIVER_PREFIX NL_DRIVER_ABSOLUTE_PREFIX )
@ -752,11 +895,11 @@ MACRO(RYZOM_SETUP_PREFIX_PATHS)
# # A l l o w o v e r r i d e o f i n s t a l l _ p r e f i x / l i b p a t h .
IF ( NOT RYZOM_LIB_PREFIX )
IF ( CMAKE_ LIBRARY_ARCHITECTURE)
SET ( RYZOM_LIB_PREFIX "lib/${ CMAKE_ LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries." )
ELSE ( CMAKE_ LIBRARY_ARCHITECTURE)
IF ( LIBRARY_ARCHITECTURE)
SET ( RYZOM_LIB_PREFIX "lib/${ LIBRARY_ARCHITECTURE}" CACHE PATH "Installation path for libraries." )
ELSE ( LIBRARY_ARCHITECTURE)
SET ( RYZOM_LIB_PREFIX "lib" CACHE PATH "Installation path for libraries." )
ENDIF ( CMAKE_ LIBRARY_ARCHITECTURE)
ENDIF ( LIBRARY_ARCHITECTURE)
ENDIF ( NOT RYZOM_LIB_PREFIX )
NL_MAKE_ABSOLUTE_PREFIX ( RYZOM_LIB_PREFIX RYZOM_LIB_ABSOLUTE_PREFIX )
@ -793,7 +936,10 @@ MACRO(SETUP_EXTERNAL)
IF ( VC_ROOT_DIR MATCHES "registry" )
GET_FILENAME_COMPONENT ( VC_ROOT_DIR "[HKEY_CURRENT_USER\\Software\\Microsoft\\VCExpress\\10.0_Config;InstallDir]" ABSOLUTE )
IF ( VC_ROOT_DIR MATCHES "registry" )
FILE ( TO_CMAKE_PATH $ENV{ VS100COMNTOOLS } VC_ROOT_DIR )
SET ( VS100COMNTOOLS $ENV{ VS100COMNTOOLS } )
IF ( VS100COMNTOOLS )
FILE ( TO_CMAKE_PATH ${ VS100COMNTOOLS } VC_ROOT_DIR )
ENDIF ( VS100COMNTOOLS )
IF ( NOT VC_ROOT_DIR )
MESSAGE ( FATAL_ERROR "Unable to find VC++ 2010 directory!" )
ENDIF ( NOT VC_ROOT_DIR )