diff --git a/code/nel/CMakeLists.txt b/code/nel/CMakeLists.txt index 29af3e2b6..ff075e315 100644 --- a/code/nel/CMakeLists.txt +++ b/code/nel/CMakeLists.txt @@ -75,6 +75,14 @@ FIND_PACKAGE(Jpeg) NL_SETUP_BUILD() +IF(WITH_STATIC_DRIVERS) + IF(WIN32) + ADD_DEFINITIONS(/DNL_STATIC) + ELSE(WIN32) + ADD_DEFINITIONS(-DNL_STATIC) + ENDIF(WIN32) +ENDIF(WITH_STATIC_DRIVERS) + # On Windows we need to find DirectInput for NLMISC. # This is how we get events. IF(WIN32) @@ -177,6 +185,10 @@ NL_SETUP_BUILD_FLAGS() INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/PCHSupport.cmake) +IF(FINAL_VERSION) + ADD_DEFINITIONS(-DFINAL_VERSION=1) +ENDIF(FINAL_VERSION) + ADD_SUBDIRECTORY(src) ADD_SUBDIRECTORY(include) diff --git a/code/nel/CMakeModules/nel.cmake b/code/nel/CMakeModules/nel.cmake index f3e7162b7..4a3720618 100644 --- a/code/nel/CMakeModules/nel.cmake +++ b/code/nel/CMakeModules/nel.cmake @@ -1,26 +1,69 @@ ### -# Build Library Name +# Helper macro that generates .pc and installs it. +# Argument: name - the name of the .pc package, e.g. "nel-pacs.pc" +### +MACRO(NL_GEN_PC name) + IF(NOT WIN32) + CONFIGURE_FILE(${name}.in "${CMAKE_CURRENT_BINARY_DIR}/${name}") + INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/${name}" DESTINATION lib/pkgconfig) + ENDIF(NOT WIN32) +ENDMACRO(NL_GEN_PC) + +### # -# Arguments: name - undecorated library name -# Sets: LIBNAME - decorated library name ### -MACRO(DECORATE_NEL_LIB name) +MACRO(NL_TARGET_LIB name) + IF(WITH_STATIC) + ADD_LIBRARY(${name} STATIC ${ARGN}) + ELSE(WITH_STATIC) + ADD_LIBRARY(${name} SHARED ${ARGN}) + ENDIF(WITH_STATIC) +ENDMACRO(NL_TARGET_LIB) +### +# +### +MACRO(NL_TARGET_DRIVER name) + IF(WITH_STATIC_DRIVERS) + ADD_LIBRARY(${name} STATIC ${ARGN}) + ELSE(WITH_STATIC_DRIVERS) + ADD_LIBRARY(${name} SHARED ${ARGN}) + ENDIF(WITH_STATIC_DRIVERS) +ENDMACRO(NL_TARGET_DRIVER) + +### +# Helper macro that sets the default library properties. +# Argument: name - the target name whose properties are being set +# Argument: +### +MACRO(NL_DEFAULT_PROPS name label) + SET_TARGET_PROPERTIES(${name} PROPERTIES + VERSION ${NL_VERSION} + SOVERSION ${NL_VERSION_MAJOR} + PROJECT_LABEL ${label}) +ENDMACRO(NL_DEFAULT_PROPS) + +### +# Adds the target suffix on Windows. +# Argument: name - the library's target name. +### +MACRO(NL_ADD_LIB_SUFFIX name) IF(WIN32) - IF(NL_BUILD_MODE MATCHES "NL_RELEASE_DEBUG") - SET(LIBNAME "${name}") - ELSE(NL_BUILD_MODE MATCHES "NL_RELEASE_DEBUG") - IF(NL_BUILD_MODE MATCHES "NL_DEBUG") - SET(LIBNAME "${name}") - ELSE(NL_BUILD_MODE MATCHES "NL_DEBUG") - SET(LIBNAME "${name}") - ENDIF(NL_BUILD_MODE MATCHES "NL_DEBUG") - ENDIF(NL_BUILD_MODE MATCHES "NL_RELEASE_DEBUG") - ELSE(WIN32) - SET(LIBNAME "${name}") + SET_TARGET_PROPERTIES(${name} PROPERTIES DEBUG_POSTFIX "_d" RELEASE_POSTFIX "_r") ENDIF(WIN32) +ENDMACRO(NL_ADD_LIB_SUFFIX) -ENDMACRO(DECORATE_NEL_LIB) +### +# Adds the runtime link flags for Win32 binaries. +# Argument: name - the target to add the link flags to. +### +MACRO(NL_ADD_RUNTIME_FLAGS name) + IF(WIN32) + SET_TARGET_PROPERTIES(${name} PROPERTIES + LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}" + LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}") + ENDIF(WIN32) +ENDMACRO(NL_ADD_RUNTIME_FLAGS) ### # Checks build vs. source location. Prevents In-Source builds. @@ -48,6 +91,15 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS) OPTION(WITH_LOGGING "With Logging" ON ) OPTION(WITH_COVERAGE "With Code Coverage Support" OFF) OPTION(WITH_PCH "With Precompiled Headers" ON ) + OPTION(FINAL_VERSION "Build in Final Version mode" ON ) + + # Default to static building on Windows. + IF(WIN32) + OPTION(WITH_STATIC "With static libraries." ON ) + ELSE(WIN32) + OPTION(WITH_STATIC "With static libraries." OFF) + ENDIF(WIN32) + OPTION(WITH_STATIC_DRIVERS "With static drivers." OFF) ### # Core libraries @@ -178,7 +230,7 @@ MACRO(NL_SETUP_BUILD_FLAGS) ## MinSizeRel SET(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} ${NL_RELEASEDEBUG_CFLAGS} ${PLATFORM_CFLAGS} ") SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${NL_RELEASEDEBUG_CFLAGS} ${PLATFORM_CFLAGS} ") - SET(LINK_FLAGS_MINSIZEREL "${CMAKE_LINK_FLAGS_MINSIZEREL} ${NL_RELEASEDEBUG_LINK_CFLAGS} ${PLATFORM_LINKFLAGS} ") + SET(CMAKE_LINK_FLAGS_MINSIZEREL "${CMAKE_LINK_FLAGS_MINSIZEREL} ${NL_RELEASEDEBUG_LINK_CFLAGS} ${PLATFORM_LINKFLAGS} ") ENDMACRO(NL_SETUP_BUILD_FLAGS) MACRO(NL_SETUP_PREFIX_PATHS) diff --git a/code/nel/include/nel/3d/driver.h b/code/nel/include/nel/3d/driver.h index 6428baab5..2a0d061fd 100644 --- a/code/nel/include/nel/3d/driver.h +++ b/code/nel/include/nel/3d/driver.h @@ -186,6 +186,9 @@ public: /// Set the title of the NeL window virtual void setWindowTitle(const ucstring &title)=0; + /// Set icon(s) of the NeL window + virtual void setWindowIcon(const std::vector &bitmaps)=0; + /// Set the position of the NeL window virtual void setWindowPos(sint32 x, sint32 y)=0; diff --git a/code/nel/include/nel/3d/driver_user.h b/code/nel/include/nel/3d/driver_user.h index 1bda23c27..699691d89 100644 --- a/code/nel/include/nel/3d/driver_user.h +++ b/code/nel/include/nel/3d/driver_user.h @@ -148,6 +148,9 @@ public: /// Set the title of the NeL window virtual void setWindowTitle(const ucstring &title); + /// Set icon(s) of the NeL window + virtual void setWindowIcon(const std::vector &bitmaps); + /// Set the position of the NeL window virtual void setWindowPos(sint32 x, sint32 y); diff --git a/code/nel/include/nel/3d/ps_color.h b/code/nel/include/nel/3d/ps_color.h index 1c52d68e4..a46e2122a 100644 --- a/code/nel/include/nel/3d/ps_color.h +++ b/code/nel/include/nel/3d/ps_color.h @@ -34,7 +34,7 @@ namespace NL3D { template <> -const char *CPSAttribMaker::getType() { return "CRGBA"; } +inline const char *CPSAttribMaker::getType() { return "CRGBA"; } // Depending on the driver, the format of colors in vertex buffer may change. We don't want to change the format for each data that is (dynamically) in vertex buffer, so diff --git a/code/nel/include/nel/3d/ps_float.h b/code/nel/include/nel/3d/ps_float.h index 20878de27..8dcc732aa 100644 --- a/code/nel/include/nel/3d/ps_float.h +++ b/code/nel/include/nel/3d/ps_float.h @@ -28,7 +28,7 @@ namespace NL3D { template <> -const char *CPSAttribMaker::getType() { return "float"; } +inline const char *CPSAttribMaker::getType() { return "float"; } /// these are some attribute makers for float /// This is a float blender class. It just blend between 2 values diff --git a/code/nel/include/nel/3d/ps_int.h b/code/nel/include/nel/3d/ps_int.h index 1985ec6d7..d821ad7b9 100644 --- a/code/nel/include/nel/3d/ps_int.h +++ b/code/nel/include/nel/3d/ps_int.h @@ -26,7 +26,7 @@ namespace NL3D { template <> -const char *CPSAttribMaker::getType() { return "int32"; } +inline const char *CPSAttribMaker::getType() { return "int32"; } /// these are some attribute makers for int diff --git a/code/nel/include/nel/3d/ps_plane_basis_maker.h b/code/nel/include/nel/3d/ps_plane_basis_maker.h index b7ae6de29..51714a368 100644 --- a/code/nel/include/nel/3d/ps_plane_basis_maker.h +++ b/code/nel/include/nel/3d/ps_plane_basis_maker.h @@ -28,7 +28,7 @@ namespace NL3D { template <> -const char *CPSAttribMaker::getType() { return "CPlaneBasis";} +inline const char *CPSAttribMaker::getType() { return "CPlaneBasis";} /** these are some attribute makers for plane_basis * This is a plane basis class. It just blend between 2 plane by linearly interpolating the normal diff --git a/code/nel/include/nel/3d/u_driver.h b/code/nel/include/nel/3d/u_driver.h index 4e7b2eb05..ce421b46d 100644 --- a/code/nel/include/nel/3d/u_driver.h +++ b/code/nel/include/nel/3d/u_driver.h @@ -186,6 +186,9 @@ public: /// Set the title of the NeL window virtual void setWindowTitle(const ucstring &title)=0; + /// Set icon(s) of the NeL window + virtual void setWindowIcon(const std::vector &bitmaps)=0; + /// Set the position of the NeL window virtual void setWindowPos(sint32 x, sint32 y)=0; diff --git a/code/nel/include/nel/misc/bitmap.h b/code/nel/include/nel/misc/bitmap.h index 99fa5527f..2a2361b55 100644 --- a/code/nel/include/nel/misc/bitmap.h +++ b/code/nel/include/nel/misc/bitmap.h @@ -621,6 +621,10 @@ public: void getDibData(uint8*& extractData); +#ifdef NL_OS_WINDOWS + HICON getHICON(sint iconWidth, sint iconHeight, sint iconDepth, const NLMISC::CRGBA &col = NLMISC::CRGBA::White, sint hotSpotX = 0, sint hotSpotY = 0, bool cursor = false) const; +#endif + CBitmap& operator= (const CBitmap& from) { if (&from == this) diff --git a/code/nel/include/nel/misc/path.h b/code/nel/include/nel/misc/path.h index 52088d67b..98896a216 100644 --- a/code/nel/include/nel/misc/path.h +++ b/code/nel/include/nel/misc/path.h @@ -700,6 +700,11 @@ struct CFile * Call this method to get a temporary output filename. If you have successfully saved your data, delete the old filename and move the new one. */ static void getTemporaryOutputFilename (const std::string &originalFilename, std::string &tempFilename); + + /** Get application directory. + * \return directory where applications should write files. + */ + static std::string getApplicationDirectory(const std::string &appName = ""); }; } // NLMISC diff --git a/code/nel/samples/3d/cluster_viewer/CMakeLists.txt b/code/nel/samples/3d/cluster_viewer/CMakeLists.txt index 22691e258..16208dd28 100644 --- a/code/nel/samples/3d/cluster_viewer/CMakeLists.txt +++ b/code/nel/samples/3d/cluster_viewer/CMakeLists.txt @@ -1,18 +1,14 @@ FILE(GLOB SRC *.cpp) -ADD_EXECUTABLE(nl_sample_clusterview ${SRC}) +ADD_EXECUTABLE(nl_sample_clusterview WIN32 ${SRC}) ADD_DEFINITIONS(-DCV_DIR="\\"${NL_SHARE_PREFIX}/nl_sample_clusterview/\\"") INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nl_sample_clusterview ${LIBXML2_LIBRARIES} ${PLATFORM_LINKFLAGS} nelmisc nel3d) -IF(WIN32) - SET_TARGET_PROPERTIES(nl_sample_clusterview PROPERTIES - LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}" - LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}" - LINK_FLAGS "/SUBSYSTEM:WINDOWS" - PROJECT_LABEL "Samples, 3D: Cluster Viewer") -ENDIF(WIN32) +NL_ADD_RUNTIME_FLAGS(nl_sample_clusterview) +NL_DEFAULT_PROPS(nl_sample_clusterview "Samples, 3D: Cluster Viewer") + ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) INSTALL(TARGETS nl_sample_clusterview RUNTIME DESTINATION bin COMPONENT samples3d) diff --git a/code/nel/samples/3d/font/CMakeLists.txt b/code/nel/samples/3d/font/CMakeLists.txt index be5294180..503fa3e7a 100644 --- a/code/nel/samples/3d/font/CMakeLists.txt +++ b/code/nel/samples/3d/font/CMakeLists.txt @@ -1,18 +1,14 @@ FILE(GLOB SRC *.cpp) -ADD_EXECUTABLE(nl_sample_font ${SRC}) +ADD_EXECUTABLE(nl_sample_font WIN32 ${SRC}) ADD_DEFINITIONS(-DFONT_DIR="\\"${NL_SHARE_PREFIX}/nl_sample_font/\\"") INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nl_sample_font ${LIBXML2_LIBRARIES} ${PLATFORM_LINKFLAGS} nelmisc nel3d) -IF(WIN32) - SET_TARGET_PROPERTIES(nl_sample_font PROPERTIES - LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}" - LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}" - LINK_FLAGS "/SUBSYSTEM:WINDOWS" - PROJECT_LABEL "Samples, 3D: Font") -ENDIF(WIN32) +NL_DEFAULT_PROPS(nl_sample_font "Samples, 3D: Font") +NL_ADD_RUNTIME_FLAGS(nl_sample_font) + ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) INSTALL(TARGETS nl_sample_font RUNTIME DESTINATION bin COMPONENT samples3d) diff --git a/code/nel/samples/3d/shape_viewer/CMakeLists.txt b/code/nel/samples/3d/shape_viewer/CMakeLists.txt index 9f337e933..e0544ef1e 100644 --- a/code/nel/samples/3d/shape_viewer/CMakeLists.txt +++ b/code/nel/samples/3d/shape_viewer/CMakeLists.txt @@ -1,14 +1,16 @@ FILE(GLOB SRC *.cpp) -ADD_EXECUTABLE(nl_sample_shapeview ${SRC}) +ADD_EXECUTABLE(nl_sample_shapeview WIN32 ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nl_sample_shapeview ${LIBXML2_LIBRARIES} ${PLATFORM_LINKFLAGS} nelmisc nel3d) +NL_DEFAULT_PROPS(nl_sample_shapeview "Samples, 3D: Font") +NL_ADD_RUNTIME_FLAGS(nl_sample_shapeview) + IF(WIN32) SET_TARGET_PROPERTIES(nl_sample_shapeview PROPERTIES LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}" LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}" - LINK_FLAGS "/SUBSYSTEM:WINDOWS" PROJECT_LABEL "Samples, 3D: Shape Viewer") ENDIF(WIN32) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) diff --git a/code/nel/samples/georges/CMakeLists.txt b/code/nel/samples/georges/CMakeLists.txt index b7ebc962e..abbeb60af 100644 --- a/code/nel/samples/georges/CMakeLists.txt +++ b/code/nel/samples/georges/CMakeLists.txt @@ -6,12 +6,9 @@ ADD_DEFINITIONS(-DGF_DIR="\\"${NL_SHARE_PREFIX}/nl_sample_georges/\\"") INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nl_sample_georges ${LIBXML2_LIBRARIES} ${PLATFORM_LINKFLAGS} nelgeorges nelmisc) -IF(WIN32) - SET_TARGET_PROPERTIES(nl_sample_georges PROPERTIES - LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}" - LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}" - PROJECT_LABEL "Samples: Georges") -ENDIF(WIN32) +NL_DEFAULT_PROPS(nl_sample_georges "Samples: Georges") +NL_ADD_RUNTIME_FLAGS(nl_sample_georges) + ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) INSTALL(TARGETS nl_sample_georges RUNTIME DESTINATION bin COMPONENT samplesgeorges) diff --git a/code/nel/samples/misc/command/CMakeLists.txt b/code/nel/samples/misc/command/CMakeLists.txt index 9f471c4c0..b49cc0511 100644 --- a/code/nel/samples/misc/command/CMakeLists.txt +++ b/code/nel/samples/misc/command/CMakeLists.txt @@ -4,12 +4,9 @@ ADD_EXECUTABLE(nl_sample_command ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nl_sample_command ${PLATFORM_LINKFLAGS} nelmisc) -IF(WIN32) - SET_TARGET_PROPERTIES(nl_sample_command PROPERTIES - LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}" - LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}" - PROJECT_LABEL "Samples, Misc: Commands") -ENDIF(WIN32) +NL_DEFAULT_PROPS(nl_sample_command "Samples, Misc: Commands") +NL_ADD_RUNTIME_FLAGS(nl_sample_command) + ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) INSTALL(TARGETS nl_sample_command RUNTIME DESTINATION bin COMPONENT samplesmisc) diff --git a/code/nel/samples/misc/configfile/CMakeLists.txt b/code/nel/samples/misc/configfile/CMakeLists.txt index bf71cf7fc..e0b16b701 100644 --- a/code/nel/samples/misc/configfile/CMakeLists.txt +++ b/code/nel/samples/misc/configfile/CMakeLists.txt @@ -6,12 +6,9 @@ ADD_DEFINITIONS(-DNL_SAMPLE_CFG="\\"${NL_SHARE_PREFIX}/nl_sample_configfile/\\"" INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nl_sample_configfile ${LIBXML2_LIBRARIES} ${PLATFORM_LINKFLAGS} nelmisc) -IF(WIN32) - SET_TARGET_PROPERTIES(nl_sample_configfile PROPERTIES - LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}" - LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}" - PROJECT_LABEL "Samples, Misc: Config Files") -ENDIF(WIN32) +NL_DEFAULT_PROPS(nl_sample_configfile "Samples, Misc: Config Files") +NL_ADD_RUNTIME_FLAGS(nl_sample_configfile) + ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) INSTALL(TARGETS nl_sample_configfile RUNTIME DESTINATION bin COMPONENT samplesmisc) diff --git a/code/nel/samples/misc/debug/CMakeLists.txt b/code/nel/samples/misc/debug/CMakeLists.txt index 66a06a968..4b0569045 100644 --- a/code/nel/samples/misc/debug/CMakeLists.txt +++ b/code/nel/samples/misc/debug/CMakeLists.txt @@ -1,18 +1,12 @@ FILE(GLOB SRC *.cpp) -DECORATE_NEL_LIB("nelmisc") -SET(NLMISC_LIB ${LIBNAME}) - ADD_EXECUTABLE(nl_sample_debug ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nl_sample_debug ${LIBXML2_LIBRARIES} ${PLATFORM_LINKFLAGS} nelmisc) -IF(WIN32) - SET_TARGET_PROPERTIES(nl_sample_debug PROPERTIES - LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}" - LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}" - PROJECT_LABEL "Samples, Misc: Debugging") -ENDIF(WIN32) +NL_DEFAULT_PROPS(nl_sample_debug "Samples, Misc: Debugging") +NL_ADD_RUNTIME_FLAGS(nl_sample_debug) + ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) INSTALL(TARGETS nl_sample_debug RUNTIME DESTINATION bin COMPONENT samplesmisc) diff --git a/code/nel/samples/misc/i18n/CMakeLists.txt b/code/nel/samples/misc/i18n/CMakeLists.txt index 9136a2503..9fc44db13 100644 --- a/code/nel/samples/misc/i18n/CMakeLists.txt +++ b/code/nel/samples/misc/i18n/CMakeLists.txt @@ -6,12 +6,9 @@ ADD_DEFINITIONS(-DNL_LANG_DATA="\\"${NL_SHARE_PREFIX}/nl_sample_i18n/\\"") INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nl_sample_i18n ${LIBXML2_LIBRARIES} ${PLATFORM_LINKFLAGS} nelmisc) -IF(WIN32) - SET_TARGET_PROPERTIES(nl_sample_i18n PROPERTIES - LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}" - LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}" - PROJECT_LABEL "Samples, Misc: I18N") -ENDIF(WIN32) +NL_DEFAULT_PROPS(nl_sample_i18n "Samples, Misc: I18N") +NL_ADD_RUNTIME_FLAGS(nl_sample_i18n) + ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) INSTALL(TARGETS nl_sample_i18n RUNTIME DESTINATION bin COMPONENT samplesmisc) diff --git a/code/nel/samples/misc/log/CMakeLists.txt b/code/nel/samples/misc/log/CMakeLists.txt index 6ee6ad078..7f7085c83 100644 --- a/code/nel/samples/misc/log/CMakeLists.txt +++ b/code/nel/samples/misc/log/CMakeLists.txt @@ -1,18 +1,12 @@ FILE(GLOB SRC *.cpp) -DECORATE_NEL_LIB("nelmisc") -SET(NLMISC_LIB ${LIBNAME}) - ADD_EXECUTABLE(nl_sample_log ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nl_sample_log ${LIBXML2_LIBRARIES} ${PLATFORM_LINKFLAGS} nelmisc) -IF(WIN32) - SET_TARGET_PROPERTIES(nl_sample_log PROPERTIES - LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}" - LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}" - PROJECT_LABEL "Samples, Misc: Logging") -ENDIF(WIN32) +NL_DEFAULT_PROPS(nl_sample_log "Samples, Misc: Logging") +NL_ADD_RUNTIME_FLAGS(nl_sample_log) + ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) INSTALL(TARGETS nl_sample_log RUNTIME DESTINATION bin COMPONENT samplesmisc) diff --git a/code/nel/samples/misc/strings/CMakeLists.txt b/code/nel/samples/misc/strings/CMakeLists.txt index 72b448b78..c0942fc2d 100644 --- a/code/nel/samples/misc/strings/CMakeLists.txt +++ b/code/nel/samples/misc/strings/CMakeLists.txt @@ -4,12 +4,9 @@ ADD_EXECUTABLE(nl_sample_strings ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nl_sample_strings ${LIBXML2_LIBRARIES} ${PLATFORM_LINKFLAGS} nelmisc) -IF(WIN32) - SET_TARGET_PROPERTIES(nl_sample_strings PROPERTIES - LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}" - LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}" - PROJECT_LABEL "Samples, Misc: Strings") -ENDIF(WIN32) +NL_DEFAULT_PROPS(nl_sample_strings "Samples, Misc: Strings") +NL_ADD_RUNTIME_FLAGS(nl_sample_strings) + ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) INSTALL(TARGETS nl_sample_strings RUNTIME DESTINATION bin COMPONENT samplesmisc) diff --git a/code/nel/samples/misc/types_check/CMakeLists.txt b/code/nel/samples/misc/types_check/CMakeLists.txt index d03fa394a..229a085f7 100644 --- a/code/nel/samples/misc/types_check/CMakeLists.txt +++ b/code/nel/samples/misc/types_check/CMakeLists.txt @@ -1,18 +1,11 @@ FILE(GLOB SRC *.cpp) -DECORATE_NEL_LIB("nelmisc") -SET(NLMISC_LIB ${LIBNAME}) - ADD_EXECUTABLE(nl_sample_types_check ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) -TARGET_LINK_LIBRARIES(nl_sample_types_check ${LIBXML2_LIBRARIES} ${PLATFORM_LINKFLAGS} ${NLMISC_LIB}) -IF(WIN32) - SET_TARGET_PROPERTIES(nl_sample_types_check PROPERTIES - LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}" - LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}" - ) -ENDIF(WIN32) +TARGET_LINK_LIBRARIES(nl_sample_types_check ${LIBXML2_LIBRARIES} ${PLATFORM_LINKFLAGS} nelmisc) +NL_ADD_RUNTIME_FLAGS(nl_sample_types_check) + ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) -INSTALL(TARGETS nl_sample_types_check RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT samplesmisc) +INSTALL(TARGETS nl_sample_types_check RUNTIME DESTINATION bin COMPONENT samplesmisc) diff --git a/code/nel/samples/net/udp/CMakeLists.txt b/code/nel/samples/net/udp/CMakeLists.txt index 251211546..8b0511728 100644 --- a/code/nel/samples/net/udp/CMakeLists.txt +++ b/code/nel/samples/net/udp/CMakeLists.txt @@ -2,35 +2,22 @@ FILE(GLOB SRC *.cpp) ADD_EXECUTABLE(nl_sample_udpclient client.cpp graph.cpp graph.h simlag.cpp simlag.h) -IF(WIN32) - ADD_EXECUTABLE(nl_sample_udpserver WIN32 bench_service.cpp receive_task.cpp receive_task.h) -ELSE(WIN32) - ADD_EXECUTABLE(nl_sample_udpserver bench_service.cpp receive_task.cpp receive_task.h) -ENDIF(WIN32) +ADD_EXECUTABLE(nl_sample_udpserver WIN32 bench_service.cpp receive_task.cpp receive_task.h) ADD_DEFINITIONS(-DUDP_DIR="\\"${NL_SHARE_PREFIX}/nl_sample_udp/\\"") IF(WITH_3D) ADD_DEFINITIONS(-DUSE_3D) - DECORATE_NEL_LIB("nel3d") - SET(NL3D_LIB ${LIBNAME}) -ELSE(WITH_3D) - SET(NL3D_LIB "") ENDIF(WITH_3D) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nl_sample_udpclient ${PLATFORM_LINKFLAGS} nelmisc nelnet nel3d) TARGET_LINK_LIBRARIES(nl_sample_udpserver ${PLATFORM_LINKFLAGS} nelmisc nelnet) -IF(WIN32) - SET_TARGET_PROPERTIES(nl_sample_udpclient PROPERTIES - LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}" - LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}" - PROJECT_LABEL "Samples, Net, UDP: UDP Client") - SET_TARGET_PROPERTIES(nl_sample_udpserver PROPERTIES - LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}" - LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}" - PROJECT_LABEL "Samples, Net, UDP: UDP Server") -ENDIF(WIN32) +NL_DEFAULT_PROPS(nl_sample_udpclient "Samples, Net, UDP: UDP Client") +NL_DEFAULT_PROPS(nl_sample_udpserver "Samples, Net, UDP: UDP Server") +NL_ADD_RUNTIME_FLAGS(nl_sample_udpclient) +NL_ADD_RUNTIME_FLAGS(nl_sample_udpserver) + ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) INSTALL(TARGETS nl_sample_udpclient nl_sample_udpserver RUNTIME DESTINATION bin COMPONENT samplesnet) diff --git a/code/nel/src/3d/CMakeLists.txt b/code/nel/src/3d/CMakeLists.txt index d32a1a6a5..82acc0f91 100644 --- a/code/nel/src/3d/CMakeLists.txt +++ b/code/nel/src/3d/CMakeLists.txt @@ -662,26 +662,15 @@ SOURCE_GROUP(Shadows FILES shadow_poly_receiver.cpp ../../include/nel/3d/shadow_poly_receiver.h) -IF(NOT WIN32) - ADD_LIBRARY(nel3d SHARED ${SRC}) - CONFIGURE_FILE(nel-3d.pc.in nel-3d.pc) - INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/nel-3d.pc" DESTINATION lib/pkgconfig) -ELSE(NOT WIN32) - ADD_LIBRARY(nel3d STATIC ${SRC}) -ENDIF(NOT WIN32) +NL_TARGET_LIB(nel3d ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${FREETYPE_INCLUDE_DIRS} ${JPEG_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nel3d nelmisc ${FREETYPE_LIBRARY} ${JPEG_LIBRARY}) -SET_TARGET_PROPERTIES(nel3d PROPERTIES - VERSION ${NL_VERSION} - SOVERSION ${NL_VERSION_MAJOR} - PROJECT_LABEL "Library: NeL 3D") +NL_DEFAULT_PROPS(nel3d "Library: NeL 3D") + +NL_ADD_LIB_SUFFIX(nel3d) IF(WIN32) - SET_TARGET_PROPERTIES(nel3d PROPERTIES - DEBUG_POSTFIX "_d" - RELEASE_POSTFIX "_r") - IF(JPEG_FOUND) ADD_DEFINITIONS(/DUSE_JPEG) ENDIF(JPEG_FOUND) @@ -697,6 +686,7 @@ IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(nel3d ${CMAKE_CURRENT_SOURCE_DIR}/std3d.h ${CMAKE_CURRENT_SOURCE_DIR}/std3d.cpp) ENDIF(WITH_PCH) +NL_GEN_PC(nel-3d.pc) INSTALL(TARGETS nel3d LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) ADD_SUBDIRECTORY(driver) diff --git a/code/nel/src/3d/driver.cpp b/code/nel/src/3d/driver.cpp index d8a195c3a..39d72c7c3 100644 --- a/code/nel/src/3d/driver.cpp +++ b/code/nel/src/3d/driver.cpp @@ -34,7 +34,7 @@ namespace NL3D { // *************************************************************************** -const uint32 IDriver::InterfaceVersion = 0x67; // changed window pos from uint32 to sint32 +const uint32 IDriver::InterfaceVersion = 0x68; // added setWindowIcon // *************************************************************************** IDriver::IDriver() : _SyncTexDrvInfos( "IDriver::_SyncTexDrvInfos" ) diff --git a/code/nel/src/3d/driver/direct3d/CMakeLists.txt b/code/nel/src/3d/driver/direct3d/CMakeLists.txt index f007893db..0bf8aa40f 100644 --- a/code/nel/src/3d/driver/direct3d/CMakeLists.txt +++ b/code/nel/src/3d/driver/direct3d/CMakeLists.txt @@ -1,23 +1,15 @@ FILE(GLOB SRC *.cpp *.h *.def) -DECORATE_NEL_LIB("nel_drv_direct3d_win") -SET(NLDRV_D3D_LIB ${LIBNAME}) -DECORATE_NEL_LIB("nel3d") -SET(NL3D_LIB ${LIBNAME}) - -ADD_LIBRARY(nel_drv_direct3d_win SHARED ${SRC}) +NL_TARGET_DRIVER(nel_drv_direct3d_win ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${FREETYPE_INC} ${DXSDK_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nel_drv_direct3d_win nel3d ${LIBXML2_LIBRARIES} ${FREETYPE_LIB} ${DXSDK_D3DX9_LIBRARY} ${DXSDK_D3D9_LIBRARY} ${DXSDK_DINPUT_LIBRARY} ${DXSDK_GUID_LIBRARY}) -SET_TARGET_PROPERTIES(nel_drv_direct3d_win PROPERTIES - VERSION ${NL_VERSION} - SOVERSION ${NL_VERSION_MAJOR} - LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}" - LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}" - DEBUG_POSTFIX "_d" - RELEASE_POSTFIX "_r" - PROJECT_LABEL "Driver, Video: Direct3D") + +NL_DEFAULT_PROPS(nel_drv_direct3d_win "Driver, Video: Direct3D") +NL_ADD_RUNTIME_FLAGS(nel_drv_direct3d_win) +NL_ADD_LIB_SUFFIX(nel_drv_direct3d_win) + ADD_DEFINITIONS(/Ddriver_direct3d_EXPORTS) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) @@ -26,7 +18,7 @@ IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(nel_drv_direct3d_win ${CMAKE_CURRENT_SOURCE_DIR}/stddirect3d.h ${CMAKE_CURRENT_SOURCE_DIR}/stddirect3d.cpp) ENDIF(WITH_PCH) -INSTALL(TARGETS nel_drv_direct3d_win LIBRARY DESTINATION lib RUNTIME DESTINATION bin COMPONENT drivers3d) +INSTALL(TARGETS nel_drv_direct3d_win LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin COMPONENT drivers3d) IF(WITH_MAXPLUGIN) INSTALL(TARGETS nel_drv_direct3d_win RUNTIME DESTINATION maxplugin COMPONENT drivers3d) ENDIF(WITH_MAXPLUGIN) diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp index 3986e8e26..e096a4d00 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d.cpp @@ -1712,6 +1712,10 @@ bool CDriverD3D::release() if (_HWnd) { + // make sure window icons are deleted + std::vector bitmaps; + setWindowIcon(bitmaps); + if (_DestroyWindow) DestroyWindow (_HWnd); _HWnd = NULL; @@ -2177,6 +2181,73 @@ void CDriverD3D::setWindowTitle(const ucstring &title) SetWindowTextW(_HWnd,(WCHAR*)title.c_str()); } +// *************************************************************************** +void CDriverD3D::setWindowIcon(const std::vector &bitmaps) +{ + if (!_HWnd) + return; + + static HICON winIconBig = NULL; + static HICON winIconSmall = NULL; + + if (winIconBig) + { + DestroyIcon(winIconBig); + winIconBig = NULL; + } + + if (winIconSmall) + { + DestroyIcon(winIconSmall); + winIconSmall = NULL; + } + + sint smallIndex = -1; + uint smallWidth = GetSystemMetrics(SM_CXSMICON); + uint smallHeight = GetSystemMetrics(SM_CYSMICON); + + sint bigIndex = -1; + uint bigWidth = GetSystemMetrics(SM_CXICON); + uint bigHeight = GetSystemMetrics(SM_CYICON); + + // find icons with the exact size + for(uint i = 0; i < bitmaps.size(); ++i) + { + if (smallIndex == -1 && bitmaps[i].getWidth() == smallWidth && bitmaps[i].getHeight() == smallHeight) + smallIndex = i; + + if (bigIndex == -1 && bitmaps[i].getWidth() == bigWidth && bitmaps[i].getHeight() == bigHeight) + bigIndex = i; + } + + // find icons with taller size (we will resize them) + for(uint i = 0; i < bitmaps.size(); ++i) + { + if (smallIndex == -1 && bitmaps[i].getWidth() >= smallWidth && bitmaps[i].getHeight() >= smallHeight) + smallIndex = i; + + if (bigIndex == -1 && bitmaps[i].getWidth() >= bigWidth && bitmaps[i].getHeight() >= bigHeight) + bigIndex = i; + } + + if (smallIndex > -1) + winIconSmall = bitmaps[smallIndex].getHICON(smallWidth, smallHeight, 32); + + if (bigIndex > -1) + winIconBig = bitmaps[bigIndex].getHICON(bigWidth, bigHeight, 32); + + if (winIconBig) + { + SendMessage(_HWnd, WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)winIconSmall); + SendMessage(_HWnd, WM_SETICON, 1 /* ICON_BIG */, (LPARAM)winIconBig); + } + else + { + SendMessage(_HWnd, WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)winIconSmall); + SendMessage(_HWnd, WM_SETICON, 1 /* ICON_BIG */, (LPARAM)winIconSmall); + } +} + // *************************************************************************** void CDriverD3D::setWindowPos(sint32 x, sint32 y) { diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d.h b/code/nel/src/3d/driver/direct3d/driver_direct3d.h index 52dca1dc5..ccd414782 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d.h +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d.h @@ -759,6 +759,9 @@ public: /// Set the title of the NeL window virtual void setWindowTitle(const ucstring &title); + /// Set icon(s) of the NeL window + virtual void setWindowIcon(const std::vector &bitmaps); + /// Set the position of the NeL window virtual void setWindowPos(sint32 x, sint32 y); diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d.vcproj b/code/nel/src/3d/driver/direct3d/driver_direct3d.vcproj index 6d02e3abe..bc522553e 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d.vcproj +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d.vcproj @@ -1,7 +1,7 @@ &bitmaps); + + /// Set position of the NeL window virtual void setWindowPos(sint32 x, sint32 y); /// Show or hide the NeL window diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp index acc84ef13..3fecf8188 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -35,11 +35,13 @@ # ifdef XRANDR # include # endif +# include #endif // NL_OS_UNIX #include "nel/misc/mouse_device.h" #include "nel/misc/di_event_emitter.h" #include "nel/3d/u_driver.h" +#include "nel/misc/file.h" using namespace std; using namespace NLMISC; @@ -296,6 +298,123 @@ bool CDriverGL::unInit() return true; } +void CDriverGL::setWindowIcon(const std::vector &bitmaps) +{ + if (_win == EmptyWindow) + return; + +#if defined(NL_OS_WINDOWS) + + static HICON winIconBig = NULL; + static HICON winIconSmall = NULL; + + if (winIconBig) + { + DestroyIcon(winIconBig); + winIconBig = NULL; + } + + if (winIconSmall) + { + DestroyIcon(winIconSmall); + winIconSmall = NULL; + } + + sint smallIndex = -1; + uint smallWidth = GetSystemMetrics(SM_CXSMICON); + uint smallHeight = GetSystemMetrics(SM_CYSMICON); + + sint bigIndex = -1; + uint bigWidth = GetSystemMetrics(SM_CXICON); + uint bigHeight = GetSystemMetrics(SM_CYICON); + + // find icons with the exact size + for(uint i = 0; i < bitmaps.size(); ++i) + { + if (smallIndex == -1 && bitmaps[i].getWidth() == smallWidth && bitmaps[i].getHeight() == smallHeight) + smallIndex = i; + + if (bigIndex == -1 && bitmaps[i].getWidth() == bigWidth && bitmaps[i].getHeight() == bigHeight) + bigIndex = i; + } + + // find icons with taller size (we will resize them) + for(uint i = 0; i < bitmaps.size(); ++i) + { + if (smallIndex == -1 && bitmaps[i].getWidth() >= smallWidth && bitmaps[i].getHeight() >= smallHeight) + smallIndex = i; + + if (bigIndex == -1 && bitmaps[i].getWidth() >= bigWidth && bitmaps[i].getHeight() >= bigHeight) + bigIndex = i; + } + + if (smallIndex > -1) + winIconSmall = bitmaps[smallIndex].getHICON(smallWidth, smallHeight, 32); + + if (bigIndex > -1) + winIconBig = bitmaps[bigIndex].getHICON(bigWidth, bigHeight, 32); + + if (winIconBig) + { + SendMessage(_win, WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)winIconSmall); + SendMessage(_win, WM_SETICON, 1 /* ICON_BIG */, (LPARAM)winIconBig); + } + else + { + SendMessage(_win, WM_SETICON, 0 /* ICON_SMALL */, (LPARAM)winIconSmall); + SendMessage(_win, WM_SETICON, 1 /* ICON_BIG */, (LPARAM)winIconSmall); + } + +#elif defined(NL_OS_MAC) + + // nothing to do + +#elif defined(NL_OS_UNIX) + + std::vector icon_data; + + if (!bitmaps.empty()) + { + // process each bitmap + for(uint i = 0; i < bitmaps.size(); ++i) + { + // get bitmap width and height + uint width = bitmaps[i].getWidth(); + uint height = bitmaps[i].getHeight(); + + // icon_data position for bitmap + uint pos = (uint)icon_data.size(); + + // extend icon_data size for bitmap + icon_data.resize(pos + 2 + width*height); + + // set bitmap width and height + icon_data[pos++] = width; + icon_data[pos++] = height; + + // convert RGBA to ARGB + CObjectVector pixels = bitmaps[i].getPixels(); + for(uint j = 0; j < pixels.size(); j+=4) + icon_data[pos++] = pixels[j] << 16 | pixels[j+1] << 8 | pixels[j+2] | pixels[j+3] << 24; + } + } + + Atom _NET_WM_ICON = XInternAtom(_dpy, "_NET_WM_ICON", False); + + if (!icon_data.empty()) + { + // change window icon + XChangeProperty(_dpy, _win, _NET_WM_ICON, XA_CARDINAL, 32, PropModeReplace, (const unsigned char *) &icon_data[0], icon_data.size()); + } + else + { + // delete window icon if no bitmap is available + XDeleteProperty(_dpy, _win, _NET_WM_ICON); + } + +#endif // NL_OS_WINDOWS +} + // -------------------------------------------------- bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool resizeable) throw(EBadDisplay) { @@ -967,7 +1086,7 @@ bool CDriverGL::setScreenMode(const GfxMode &mode) if (ChangeDisplaySettings(&devMode, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) { - nlwarning("Fullscreen mode switch failed"); + nlwarning("3D: Fullscreen mode switch failed"); return false; } @@ -1135,6 +1254,10 @@ bool CDriverGL::destroyWindow() { H_AUTO_OGL(CDriverGL_destroyWindow) + // make sure window icons are deleted + std::vector bitmaps; + setWindowIcon(bitmaps); + #ifdef NL_OS_WINDOWS // Then delete. diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_adapter.mm b/code/nel/src/3d/driver/opengl/mac/cocoa_adapter.mm index aa0cf9dbb..029617d7d 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_adapter.mm +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_adapter.mm @@ -25,7 +25,7 @@ #include "cocoa_event_emitter.h" #include "cocoa_opengl_view.h" -// Virtual key codes are only defined here. We still do not need to link carbon. +// Virtual key codes are only defined here. Still do not need to link carbon. // see: http://lists.apple.com/archives/Cocoa-dev/2009/May/msg01180.html #include @@ -33,6 +33,27 @@ namespace NL3D { namespace MAC { +// This cocoa adapter can be used in two environments: +// First: There is no other code which creates the NSApplication object, so +// NeL is completely in charge of starting and setting up the application. +// In this case, the NSAutoreleasePool needed to handle the cocoa style memory +// management is created by this code. +// Second: There is already a NSApplication set up. This could be the case if +// NeL is used for example in a Qt widget. So Qt already created all the +// NSApplication infrastructure, so it is not set up by this code again! +// +// Thats why, the g_pool variable (containing a pointer to the NSAutoreleasePool +// created by this code) can be used to check whether NeL created the +// NSApplication infrastructure itself or not. +// +// WARNING: +// Currently the NSApplication infrastructure is automatically created with the +// call to createWindow(). So if for example Qt already created NSApplication, +// createWindow() must not be called. Instead, setDisplay() can be provided with +// a window handle (on Mac OS Cocoa Qt this is a NSView*). In this case, this +// cocoa adapter will skip the NSApplication setup and embed itself into the +// provided view running in the already set up application. + static NSAutoreleasePool* g_pool = nil; /* TODO move to event emitter class @@ -40,6 +61,7 @@ static NSAutoreleasePool* g_pool = nil; static bool g_emulateRawMode = false; static int g_bufferSize[2] = { 0, 0 }; +/// setup an apple style application menu (located at the top bar of the screen) static void setupApplicationMenu() { NSMenu* menu; @@ -98,6 +120,29 @@ static void setupApplicationMenu() [[NSApp mainMenu] addItem:menuItem]; } +/// set up the basic NSApplication and NSAutoreleasePool needed for Cocoa +static bool setupNSApplication() +{ + // if the pool was already created, return an error + if(g_pool) + return false; + + // create a pool, cocoa code would leak memory otherwise + g_pool = [[NSAutoreleasePool alloc] init]; + + // init the application object + [NSApplication sharedApplication]; + + // create the menu in the top screen bar + setupApplicationMenu(); + + // finish the application launching + [NSApp finishLaunching]; + + return true; +} + +/// setup an open gl view and embed it in the provided parent view static void setupGLView(NSView* superview) { /* @@ -169,20 +214,13 @@ bool unInit() return true; } +/// setup the basic cocoa app infrastructure and create a window nlWindow createWindow(const GfxMode& mode) { - // create a pool, cocoa code would leak memory otherwise - g_pool = [[NSAutoreleasePool alloc] init]; + if(!setupNSApplication()) + nlerror("createWindow must not be called before the old window was " + "destroyed using destroyWindow()!"); - // init the application object - [NSApplication sharedApplication]; - - // create the menu in the top screen bar - setupApplicationMenu(); - - // tell the application that we are running now - [NSApp finishLaunching]; - // describe how the window should look like and behave unsigned int styleMask = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask; @@ -201,7 +239,7 @@ nlWindow createWindow(const GfxMode& mode) // enable mouse move events, NeL wants them [window setAcceptsMouseMovedEvents:YES]; - // there are no overlapping subviews, so we can use the magical optimization! + // there are no overlapping subviews, can use the magical optimization :) [window useOptimizedDrawing:YES]; // put the window to the front and make it the key window @@ -217,6 +255,7 @@ nlWindow createWindow(const GfxMode& mode) return view; } +/// destroy the given window and uninitialize the cocoa application bool destroyWindow(nlWindow wnd) { NSView* view = (NSView*)wnd; @@ -229,10 +268,12 @@ bool destroyWindow(nlWindow wnd) // release the pool [g_pool release]; + g_pool = nil; return true; } +/// set the displays settings, if no win is provided, a new one will be created nlWindow setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable) { NSView* view = (NSView*)wnd; @@ -247,6 +288,7 @@ nlWindow setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeabl return view; } +/// switch between fullscreen and windowed mode bool setWindowStyle(nlWindow wnd, bool fullscreen) { if(wnd == EmptyWindow) @@ -315,7 +357,7 @@ bool setWindowStyle(nlWindow wnd, bool fullscreen) return true; } - +/// get the current mode of the screen void getCurrentScreenMode(nlWindow wnd, GfxMode& mode) { NSView* superview = (NSView*)wnd; @@ -347,6 +389,7 @@ void getCurrentScreenMode(nlWindow wnd, GfxMode& mode) } } +/// get the size of the window's content area void getWindowSize(nlWindow wnd, uint32 &width, uint32 &height) { NSView* superview = (NSView*)wnd; @@ -378,6 +421,7 @@ void getWindowSize(nlWindow wnd, uint32 &width, uint32 &height) } } +/// set the size of the window's content area void setWindowSize(nlWindow wnd, uint32 width, uint32 height) { NSView* superview = (NSView*)wnd; @@ -398,8 +442,8 @@ void setWindowSize(nlWindow wnd, uint32 width, uint32 height) } else { - // there is only a pool if nel created the window itself assuming that - // nel is also in charge of the main loop + // there is only a pool if NeL created the window itself + // else, the window is not NeL's, so it must not be changed if(g_pool) { NSWindow* window = [view window]; @@ -421,7 +465,7 @@ void setWindowSize(nlWindow wnd, uint32 width, uint32 height) g_bufferSize[1] = height; } - +/// get the position of the window void getWindowPos(nlWindow wnd, sint32 &x, sint32 &y) { NSView* superview = (NSView*)wnd; @@ -448,6 +492,7 @@ void getWindowPos(nlWindow wnd, sint32 &x, sint32 &y) y = screenRect.size.height - windowRect.size.height - windowRect.origin.y; } +/// set the position of the window void setWindowPos(nlWindow wnd, sint32 x, sint32 y) { NSView* superview = (NSView*)wnd; @@ -466,6 +511,7 @@ void setWindowPos(nlWindow wnd, sint32 x, sint32 y) [window setFrameTopLeftPoint:NSMakePoint(x, y)]; } +/// set the windows title (not the title of the application) void setWindowTitle(nlWindow wnd, const ucstring& title) { NSView* superview = (NSView*)wnd; @@ -480,6 +526,7 @@ void showWindow(bool show) nldebug("show: %d - implement me!", show); } +/// make the opengl context the current one bool activate(nlWindow wnd) { NSView* superview = (NSView*)wnd; @@ -493,6 +540,7 @@ bool activate(nlWindow wnd) return true; } +/// flush current back buffer to screen void swapBuffers(nlWindow wnd) { NSView* superview = (NSView*)wnd; @@ -509,6 +557,7 @@ void setCapture(bool capture) // no need to capture } +/// show or hide the mouse cursor void showCursor(bool show) { // Mac OS manages a show/hide counter for the cursor, so hiding the cursor @@ -535,6 +584,7 @@ void showCursor(bool show) nlerror("cannot show / hide cursor"); } +/// set the mouse position void setMousePos(nlWindow wnd, float x, float y) { NSView* superview = (NSView*)wnd; @@ -571,7 +621,8 @@ void setMousePos(nlWindow wnd, float x, float y) TODO: this function has to be moved to a more central place to handle key mapping on mac x11 as well */ -NLMISC::TKey virtualKeycodeToNelKey(unsigned short keycode) +/// map from virtual key code to nel internal key code +static NLMISC::TKey virtualKeycodeToNelKey(unsigned short keycode) { switch(keycode) { @@ -702,7 +753,8 @@ NLMISC::TKey virtualKeycodeToNelKey(unsigned short keycode) TODO: this function has to be moved to a more central place to handle key mapping on mac x11 as well */ -NLMISC::TKeyButton modifierFlagsToNelKeyButton(unsigned int modifierFlags) +/// convert modifier key state to nel internal modifier key state +static NLMISC::TKeyButton modifierFlagsToNelKeyButton(unsigned int modifierFlags) { unsigned int buttons = 0; if (modifierFlags & NSControlKeyMask) buttons |= NLMISC::ctrlKeyButton; @@ -711,7 +763,8 @@ NLMISC::TKeyButton modifierFlagsToNelKeyButton(unsigned int modifierFlags) return (NLMISC::TKeyButton)buttons; } -bool isTextKeyEvent(NSEvent* event) +/// check whether a given event represents input text +static bool isTextKeyEvent(NSEvent* event) { // if there are no characters provided with this event, it is not a text event if([[event characters] length] == 0) @@ -763,16 +816,18 @@ bool isTextKeyEvent(NSEvent* event) return false; } +/// switch between raw mode emulation, see IEventEmitter::emulateMouseRawMode() void emulateMouseRawMode(bool enable) { g_emulateRawMode = enable; } +/// submit events provided by the application to an event server void submitEvents(NLMISC::CEventServer& server, bool allWindows, NLMISC::CCocoaEventEmitter* eventEmitter) { - // there is only a pool if nel created the window itself assuming that - // nel is also in charge of the main loop + // if there is a pool, NeL needs to clean it up + // otherwise, other code must have created it (for example Qt) if(g_pool) { // cocoa style memory cleanup @@ -780,7 +835,7 @@ void submitEvents(NLMISC::CEventServer& server, g_pool = [[NSAutoreleasePool alloc] init]; } - // we break if there was no event to handle + // break if there was no event to handle /* TODO maximum number of events processed in one update? */ while(true) { @@ -809,49 +864,46 @@ void submitEvents(NLMISC::CEventServer& server, continue; } + // convert the modifiers for nel to pass them with the events + NLMISC::TKeyButton modifiers = + modifierFlagsToNelKeyButton([event modifierFlags]); + switch(event.type) { case NSLeftMouseDown: { - /* - TODO modifiers with mouse events - */ server.postEvent(new NLMISC::CEventMouseDown( - mouseX, mouseY, NLMISC::leftButton /* modifiers */, eventEmitter)); + mouseX, mouseY, + (NLMISC::TMouseButton)(NLMISC::leftButton | modifiers), + eventEmitter)); } break; case NSLeftMouseUp: { - /* - TODO modifiers with mouse events - */ server.postEvent(new NLMISC::CEventMouseUp( - mouseX, mouseY, NLMISC::leftButton /* modifiers */, eventEmitter)); + mouseX, mouseY, + (NLMISC::TMouseButton)(NLMISC::leftButton | modifiers), + eventEmitter)); break; } case NSRightMouseDown: { - /* - TODO modifiers with mouse events - */ server.postEvent(new NLMISC::CEventMouseDown( - mouseX, mouseY, NLMISC::rightButton /* modifiers */, eventEmitter)); + mouseX, mouseY, + (NLMISC::TMouseButton)(NLMISC::rightButton | modifiers), + eventEmitter)); break; } case NSRightMouseUp: { - /* - TODO modifiers with mouse events - */ server.postEvent(new NLMISC::CEventMouseUp( - mouseX, mouseY, NLMISC::rightButton /* modifiers */, eventEmitter)); + mouseX, mouseY, + (NLMISC::TMouseButton)(NLMISC::rightButton | modifiers), + eventEmitter)); break; } case NSMouseMoved: { - /* - TODO modifiers with mouse events - */ NLMISC::CEvent* nelEvent; // when emulating raw mode, send the delta in a CGDMouseMove event @@ -861,17 +913,14 @@ void submitEvents(NLMISC::CEventServer& server, // normally send position in a CEventMouseMove else - nelEvent = new NLMISC::CEventMouseMove(mouseX, mouseY, - (NLMISC::TMouseButton)0 /* modifiers */, eventEmitter); + nelEvent = new NLMISC::CEventMouseMove( + mouseX, mouseY, (NLMISC::TMouseButton)modifiers, eventEmitter); server.postEvent(nelEvent); break; } case NSLeftMouseDragged: { - /* - TODO modifiers with mouse events - */ NLMISC::CEvent* nelEvent; // when emulating raw mode, send the delta in a CGDMouseMove event @@ -882,16 +931,14 @@ void submitEvents(NLMISC::CEventServer& server, // normally send position in a CEventMouseMove else nelEvent = new NLMISC::CEventMouseMove(mouseX, mouseY, - NLMISC::leftButton /* modifiers */, eventEmitter); + (NLMISC::TMouseButton)(NLMISC::leftButton | modifiers), + eventEmitter); server.postEvent(nelEvent); break; } case NSRightMouseDragged: { - /* - TODO modifiers with mouse events - */ NLMISC::CEvent* nelEvent; // when emulating raw mode, send the delta in a CGDMouseMove event @@ -902,7 +949,8 @@ void submitEvents(NLMISC::CEventServer& server, // normally send position in a CEventMouseMove else nelEvent = new NLMISC::CEventMouseMove(mouseX, mouseY, - NLMISC::rightButton /* modifiers */, eventEmitter); + (NLMISC::TMouseButton)(NLMISC::rightButton | modifiers), + eventEmitter); server.postEvent(nelEvent); break; @@ -951,12 +999,9 @@ void submitEvents(NLMISC::CEventServer& server, case NSCursorUpdate:break; case NSScrollWheel: { - /* - TODO modifiers with mouse events - */ if(fabs(event.deltaY) > 0.1) server.postEvent(new NLMISC::CEventMouseWheel( - mouseX, mouseY, (NLMISC::TMouseButton)0 /* modifiers */, + mouseX, mouseY, (NLMISC::TMouseButton)modifiers, (event.deltaY > 0), eventEmitter)); break; diff --git a/code/nel/src/3d/driver_user.cpp b/code/nel/src/3d/driver_user.cpp index ea8a44e83..523aaf4ba 100644 --- a/code/nel/src/3d/driver_user.cpp +++ b/code/nel/src/3d/driver_user.cpp @@ -332,6 +332,13 @@ void CDriverUser::setWindowTitle(const ucstring &title) _Driver->setWindowTitle(title); } +// *************************************************************************** +void CDriverUser::setWindowIcon(const std::vector &bitmaps) +{ + NL3D_HAUTO_UI_DRIVER; + _Driver->setWindowIcon(bitmaps); +} + // *************************************************************************** void CDriverUser::setWindowPos(sint32 x, sint32 y) { diff --git a/code/nel/src/georges/CMakeLists.txt b/code/nel/src/georges/CMakeLists.txt index 7b46520eb..07bdeac61 100644 --- a/code/nel/src/georges/CMakeLists.txt +++ b/code/nel/src/georges/CMakeLists.txt @@ -4,26 +4,13 @@ FILE(GLOB PUB_H ../../include/nel/georges/*.h) SOURCE_GROUP(headers FILES ${PRIV_H} ${PUB_H}) -IF(NOT WIN32) - ADD_LIBRARY(nelgeorges SHARED ${SRC}) - CONFIGURE_FILE(nel-georges.pc.in nel-georges.pc) - INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/nel-georges.pc" DESTINATION lib/pkgconfig) -ELSE(NOT WIN32) - ADD_LIBRARY(nelgeorges STATIC ${SRC}) -ENDIF(NOT WIN32) +NL_TARGET_LIB(nelgeorges ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nelgeorges nelmisc) -SET_TARGET_PROPERTIES(nelgeorges PROPERTIES - VERSION ${NL_VERSION} - SOVERSION ${NL_VERSION_MAJOR} - PROJECT_LABEL "Library: NeL Georges") +NL_DEFAULT_PROPS(nelgeorges "Library: NeL Georges") -IF(WIN32) - SET_TARGET_PROPERTIES(nelgeorges PROPERTIES - DEBUG_POSTFIX "_d" - RELEASE_POSTFIX "_r") -ENDIF(WIN32) +NL_ADD_LIB_SUFFIX(nelgeorges) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) @@ -31,4 +18,5 @@ IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(nelgeorges ${CMAKE_CURRENT_SOURCE_DIR}/stdgeorges.h ${CMAKE_CURRENT_SOURCE_DIR}/stdgeorges.cpp) ENDIF(WITH_PCH) +NL_GEN_PC(nel-georges.pc) INSTALL(TARGETS nelgeorges LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) diff --git a/code/nel/src/ligo/CMakeLists.txt b/code/nel/src/ligo/CMakeLists.txt index c1ddd5b27..0ee8ac180 100644 --- a/code/nel/src/ligo/CMakeLists.txt +++ b/code/nel/src/ligo/CMakeLists.txt @@ -1,27 +1,14 @@ FILE(GLOB SRC *.cpp *.h) -IF(NOT WIN32) - ADD_LIBRARY(nelligo SHARED ${SRC}) - CONFIGURE_FILE(nel-ligo.pc.in nel-ligo.pc) - INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/nel-ligo.pc" DESTINATION lib/pkgconfig) -ELSE(NOT WIN32) - ADD_LIBRARY(nelligo STATIC ${SRC}) -ENDIF(NOT WIN32) +NL_TARGET_LIB(nelligo ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nelligo ${LIBXML2_LIBRARIES} nelmisc) -SET_TARGET_PROPERTIES(nelligo PROPERTIES - VERSION ${NL_VERSION} - SOVERSION ${NL_VERSION_MAJOR} - PROJECT_LABEL "Library: NeL Ligo") - -IF(WIN32) - SET_TARGET_PROPERTIES(nelligo PROPERTIES - DEBUG_POSTFIX "_d" - RELEASE_POSTFIX "_r") -ENDIF(WIN32) +NL_DEFAULT_PROPS(nelligo "Library: NeL Ligo") +NL_ADD_LIB_SUFFIX(nelligo) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) +NL_GEN_PC(nel-ligo.pc) INSTALL(TARGETS nelligo LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) diff --git a/code/nel/src/logic/CMakeLists.txt b/code/nel/src/logic/CMakeLists.txt index 806190233..0f01f0641 100644 --- a/code/nel/src/logic/CMakeLists.txt +++ b/code/nel/src/logic/CMakeLists.txt @@ -1,23 +1,12 @@ FILE(GLOB SRC *.cpp *.h) -IF(NOT WIN32) - ADD_LIBRARY(nellogic SHARED ${SRC}) -ELSE(NOT WIN32) - ADD_LIBRARY(nellogic STATIC ${SRC}) -ENDIF(NOT WIN32) +NL_TARGET_LIB(nellogic ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nellogic ${LIBXML2_LIBRARIES} nelmisc nelnet) -SET_TARGET_PROPERTIES(nellogic PROPERTIES - VERSION ${NL_VERSION} - SOVERSION ${NL_VERSION_MAJOR} - PROJECT_LABEL "Library: NeL Logic") +NL_DEFAULT_PROPS(nellogic "Library: NeL Logic") -IF(WIN32) - SET_TARGET_PROPERTIES(nellogic PROPERTIES - DEBUG_POSTFIX "_d" - RELEASE_POSTFIX "_r") -ENDIF(WIN32) +NL_ADD_LIB_SUFFIX(nellogic) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) diff --git a/code/nel/src/misc.vcproj b/code/nel/src/misc.vcproj index 017efdf64..dfb888354 100644 --- a/code/nel/src/misc.vcproj +++ b/code/nel/src/misc.vcproj @@ -442,7 +442,7 @@ > modulateFromColor(*srcColorPtr, col); + std::swap(destColorPtr->R, destColorPtr->B); + ++ srcColorPtr; + ++ destColorPtr; + } + while (srcColorPtr != srcColorPtrLast); + // + HBITMAP colorHbm = NULL; + HBITMAP maskHbm = NULL; + // + if (iconDepth == 16) + { + std::vector colorBm16(iconWidth * iconHeight); + const CRGBA *src32 = (const CRGBA *) &colorBm.getPixels(0)[0]; + + for (uint k = 0; k < colorBm16.size(); ++k) + { + colorBm16[k] = ((uint16)(src32[k].R&0xf8)>>3) | ((uint16)(src32[k].G&0xfc)<<3) | ((uint16)(src32[k].B & 0xf8)<<8); + } + + colorHbm = CreateBitmap(iconWidth, iconHeight, 1, 16, &colorBm16[0]); + std::vector bitMask((iconWidth * iconHeight + 7) / 8, 0); + + for (uint k = 0;k < colorBm16.size(); ++k) + { + if (src32[k].A <= 120) + { + bitMask[k / 8] |= (0x80 >> (k & 7)); + } + } + + maskHbm = CreateBitmap(iconWidth, iconHeight, 1, 1, &bitMask[0]); + } + else + { + colorHbm = CreateBitmap(iconWidth, iconHeight, 1, 32, &colorBm.getPixels(0)[0]); + maskHbm = CreateBitmap(iconWidth, iconHeight, 1, 32, &colorBm.getPixels(0)[0]); + } + + ICONINFO iconInfo; + iconInfo.fIcon = cursor ? FALSE:TRUE; + iconInfo.xHotspot = (DWORD) hotSpotX; + iconInfo.yHotspot = (DWORD) hotSpotY; + iconInfo.hbmMask = maskHbm; + iconInfo.hbmColor = colorHbm; + + if (colorHbm && maskHbm) + { + result = CreateIconIndirect(&iconInfo); + } + + // + if (colorHbm) DeleteObject(colorHbm); + if (maskHbm) DeleteObject(maskHbm); + + return result; +} + +#endif + } // NLMISC diff --git a/code/nel/src/misc/path.cpp b/code/nel/src/misc/path.cpp index e30982056..7750ce7d1 100644 --- a/code/nel/src/misc/path.cpp +++ b/code/nel/src/misc/path.cpp @@ -2435,4 +2435,30 @@ void CFile::getTemporaryOutputFilename (const std::string &originalFilename, std while (CFile::isExists(tempFilename)); } +std::string CFile::getApplicationDirectory(const std::string &appName) +{ + static std::string appPath; + if (appPath.empty()) + { +#ifdef NL_OS_WINDOWS + wchar_t buffer[MAX_PATH]; + SHGetSpecialFolderPathW(NULL, buffer, CSIDL_APPDATA, TRUE); + appPath = CPath::standardizePath(ucstring((ucchar*)buffer).toUtf8()); +#else + appPath = CPath::standardizePath(getenv("HOME")); +#endif + } + + std::string path = appPath; +#ifdef NL_OS_WINDOWS + if (!appName.empty()) + path = CPath::standardizePath(path + appName); +#else + if (!appName.empty()) + path = CPath::standardizePath(path + "." + toLower(appName)); +#endif + + return path; +} + } // NLMISC diff --git a/code/nel/src/net/CMakeLists.txt b/code/nel/src/net/CMakeLists.txt index 712ce0e5a..fa6e35e05 100644 --- a/code/nel/src/net/CMakeLists.txt +++ b/code/nel/src/net/CMakeLists.txt @@ -2,18 +2,7 @@ FILE(GLOB SRC "*.cpp") FILE(GLOB NET_MANAGER "net_manager.*") LIST(REMOVE_ITEM SRC ${NET_MANAGER}) -DECORATE_NEL_LIB("nelmisc") -SET(NLMISC_LIB ${LIBNAME}) -DECORATE_NEL_LIB("nelnet") -SET(NLNET_LIB ${LIBNAME}) - -IF(NOT WIN32) - ADD_LIBRARY(nelnet SHARED ${SRC}) - CONFIGURE_FILE(nel-net.pc.in nel-net.pc) - INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/nel-net.pc" DESTINATION lib/pkgconfig) -ELSE(NOT WIN32) - ADD_LIBRARY(nelnet STATIC ${SRC}) -ENDIF(NOT WIN32) +NL_TARGET_LIB(nelnet ${SRC}) IF(WITH_GTK) IF(GTK2_FOUND) @@ -24,22 +13,16 @@ ENDIF(WITH_GTK) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) -TARGET_LINK_LIBRARIES(nelnet ${LIBXML2_LIBRARIES} ${NLMISC_LIB}) -SET_TARGET_PROPERTIES(nelnet PROPERTIES - VERSION ${NL_VERSION} - SOVERSION ${NL_VERSION_MAJOR} - PROJECT_LABEL "Library: NeL Net") +TARGET_LINK_LIBRARIES(nelnet ${LIBXML2_LIBRARIES} nelmisc) +NL_DEFAULT_PROPS(nelnet "Library: NeL Net") -IF(WIN32) - SET_TARGET_PROPERTIES(${NLNET_LIB} PROPERTIES - DEBUG_POSTFIX "_d" - RELEASE_POSTFIX "_r") -ENDIF(WIN32) +NL_ADD_LIB_SUFFIX(nelnet) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) IF(WITH_PCH) - ADD_NATIVE_PRECOMPILED_HEADER(${NLNET_LIB} ${CMAKE_CURRENT_SOURCE_DIR}/stdnet.h ${CMAKE_CURRENT_SOURCE_DIR}/stdnet.cpp) + ADD_NATIVE_PRECOMPILED_HEADER(nelnet ${CMAKE_CURRENT_SOURCE_DIR}/stdnet.h ${CMAKE_CURRENT_SOURCE_DIR}/stdnet.cpp) ENDIF(WITH_PCH) -INSTALL(TARGETS ${NLNET_LIB} LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) +NL_GEN_PC(nel-net.pc) +INSTALL(TARGETS nelnet LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) diff --git a/code/nel/src/net/service.cpp b/code/nel/src/net/service.cpp index 9f917e21b..8f57d1c92 100644 --- a/code/nel/src/net/service.cpp +++ b/code/nel/src/net/service.cpp @@ -254,11 +254,7 @@ void cbDirectoryChanged (IVariable &var) // Update the running directory if needed if (var.getName() == "RunningDirectory") { -#ifdef NL_OS_WINDOWS - _chdir (vp.c_str()); -#else - chdir (vp.c_str()); -#endif + CPath::setCurrentPath(vp); } // Call the callback if provided diff --git a/code/nel/src/pacs/CMakeLists.txt b/code/nel/src/pacs/CMakeLists.txt index 722f151d9..4f1c5e48d 100644 --- a/code/nel/src/pacs/CMakeLists.txt +++ b/code/nel/src/pacs/CMakeLists.txt @@ -1,27 +1,17 @@ FILE(GLOB SRC *.cpp *.h) -IF(NOT WIN32) - ADD_LIBRARY(nelpacs SHARED ${SRC}) - CONFIGURE_FILE(nel-pacs.pc.in nel-pacs.pc) - INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/nel-pacs.pc" DESTINATION lib/pkgconfig) -ELSE(NOT WIN32) - ADD_LIBRARY(nelpacs STATIC ${SRC}) -ENDIF(NOT WIN32) +NL_TARGET_LIB(nelpacs ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nelpacs ${LIBXML2_LIBRARIES} nelmisc) -SET_TARGET_PROPERTIES(nelpacs PROPERTIES - VERSION ${NL_VERSION} - SOVERSION ${NL_VERSION_MAJOR} - PROJECT_LABEL "Library: NeL PACS") +NL_DEFAULT_PROPS(nelpacs "Library: NeL PACS") ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) -IF(WIN32) - SET_TARGET_PROPERTIES(nelpacs PROPERTIES DEBUG_POSTFIX "_d" RELEASE_POSTFIX "_r") -ENDIF(WIN32) +NL_ADD_LIB_SUFFIX(nelpacs) IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(nelpacs ${CMAKE_CURRENT_SOURCE_DIR}/stdpacs.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpacs.cpp) ENDIF(WITH_PCH) +NL_GEN_PC(nel-pacs.pc) INSTALL(TARGETS nelpacs LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) diff --git a/code/nel/src/sound/CMakeLists.txt b/code/nel/src/sound/CMakeLists.txt index 36d43c182..28fe90c71 100644 --- a/code/nel/src/sound/CMakeLists.txt +++ b/code/nel/src/sound/CMakeLists.txt @@ -6,32 +6,20 @@ IF(APPLE) SET(SRC ${SRC} driver/sound_driver.cpp driver/buffer.cpp) ENDIF(APPLE) -IF(NOT WIN32) - ADD_LIBRARY(nelsound SHARED ${SRC}) - CONFIGURE_FILE(nel-sound.pc.in nel-sound.pc) - INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/nel-sound.pc" DESTINATION lib/pkgconfig) -ELSE(NOT WIN32) - ADD_LIBRARY(nelsound STATIC ${SRC}) -ENDIF(NOT WIN32) +nl_target_lib(nelsound ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nelsound ${LIBXML2_LIBRARIES} nelligo nelgeorges nel3d) -SET_TARGET_PROPERTIES(nelsound PROPERTIES - VERSION ${NL_VERSION} - SOVERSION ${NL_VERSION_MAJOR} - PROJECT_LABEL "Library: NeL Sound") +nl_default_props(nelsound "Library: NeL Sound") ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) -IF(WIN32) - SET_TARGET_PROPERTIES(nelsound PROPERTIES - DEBUG_POSTFIX "_d" - RELEASE_POSTFIX "_r") -ENDIF(WIN32) +nl_add_lib_suffix(nelsound) IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(nelsound ${CMAKE_CURRENT_SOURCE_DIR}/stdsound.h ${CMAKE_CURRENT_SOURCE_DIR}/stdsound.cpp) ENDIF(WITH_PCH) +nl_gen_pc(nel-sound.pc) INSTALL(TARGETS nelsound LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) ADD_SUBDIRECTORY(driver) diff --git a/code/nel/src/sound/driver/CMakeLists.txt b/code/nel/src/sound/driver/CMakeLists.txt index 6ac614a69..3c504a20f 100644 --- a/code/nel/src/sound/driver/CMakeLists.txt +++ b/code/nel/src/sound/driver/CMakeLists.txt @@ -1,22 +1,13 @@ FILE(GLOB SRC *.cpp *.h) -IF(NOT WIN32) - ADD_LIBRARY(nelsnd_lowlevel SHARED ${SRC}) -ELSE(NOT WIN32) - ADD_LIBRARY(nelsnd_lowlevel STATIC ${SRC}) -ENDIF(NOT WIN32) +nl_target_lib(nelsnd_lowlevel ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nelsnd_lowlevel ${LIBXML2_LIBRARIES} nelsound) -SET_TARGET_PROPERTIES(nelsnd_lowlevel PROPERTIES - VERSION ${NL_VERSION} - SOVERSION ${NL_VERSION_MAJOR} - PROJECT_LABEL "Library: NeL Sound Lowlevel") +nl_default_props(nelsnd_lowlevel "Library: NeL Sound Lowlevel") ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) -IF(WIN32) - SET_TARGET_PROPERTIES(nelsnd_lowlevel PROPERTIES DEBUG_POSTFIX "_d" RELEASE_POSTFIX "_r") -ENDIF(WIN32) +nl_add_lib_suffix(nelsnd_lowlevel) INSTALL(TARGETS nelsnd_lowlevel LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) diff --git a/code/nel/src/sound/driver/openal/CMakeLists.txt b/code/nel/src/sound/driver/openal/CMakeLists.txt index cb180898c..401a8d1ea 100644 --- a/code/nel/src/sound/driver/openal/CMakeLists.txt +++ b/code/nel/src/sound/driver/openal/CMakeLists.txt @@ -1,12 +1,12 @@ FILE(GLOB SRC *.cpp *.h) -ADD_LIBRARY(nel_drv_openal SHARED ${SRC}) +NL_TARGET_DRIVER(nel_drv_openal ${SRC}) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${OPENAL_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nel_drv_openal ${LIBXML2_LIBRARIES} ${OPENAL_LIBRARY} nelsnd_lowlevel) -SET_TARGET_PROPERTIES(nel_drv_openal PROPERTIES - VERSION ${NL_VERSION} - SOVERSION ${NL_VERSION_MAJOR}) +NL_DEFAULT_PROPS(nel_drv_openal "Driver, Sound: OpenAL") +NL_ADD_LIB_SUFFIX(nel_drv_openal) +NL_ADD_RUNTIME_FLAGS(nel_drv_openal) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) IF(WIN32) @@ -14,13 +14,6 @@ IF(WIN32) FIND_PACKAGE(EFXUtil) INCLUDE_DIRECTORIES(${EFXUTIL_INCLUDE_DIR}) TARGET_LINK_LIBRARIES(nel_drv_openal ${EFXUTIL_LIBRARY}) - - SET_TARGET_PROPERTIES(nel_drv_openal PROPERTIES - LINK_FLAGS_DEBUG "${CMAKE_LINK_FLAGS_DEBUG}" - LINK_FLAGS_RELEASE "${CMAKE_LINK_FLAGS_RELEASE}" - DEBUG_POSTFIX "_d" - RELEASE_POSTFIX "_r" - PROJECT_LABEL "Driver, Sound: OpenAL") ENDIF(WIN32) IF(WITH_PCH) diff --git a/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/nel_3dsmax_shared.vcproj b/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/nel_3dsmax_shared.vcproj index e9f01673d..d8a9a63ea 100644 --- a/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/nel_3dsmax_shared.vcproj +++ b/code/nel/tools/3d/plugin_max/nel_3dsmax_shared/nel_3dsmax_shared.vcproj @@ -1,7 +1,7 @@ -# -# Redistribution and use is allowed according to the terms of the New -# BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. -# - -set(GTK2_DEBUG ON) - -macro(GTK2_DEBUG_MESSAGE _message) - if (GTK2_DEBUG) - message(STATUS "(DEBUG) ${_message}") - endif (GTK2_DEBUG) -endmacro(GTK2_DEBUG_MESSAGE _message) - -if (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS) - # in cache already - set(GTK2_FOUND TRUE) -else (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS) - if (UNIX) - # use pkg-config to get the directories and then use these values - # in the FIND_PATH() and FIND_LIBRARY() calls - include(UsePkgConfig) - - pkgconfig(gtk+-2.0 _GTK2IncDir _GTK2LinkDir _GTK2LinkFlags _GTK2Cflags) - - find_path(GTK2_GTK_INCLUDE_DIR - NAMES - gtk/gtk.h - PATHS - $ENV{GTK2_HOME} - ${_GTK2IncDir} - /usr/include/gtk-2.0 - /usr/local/include/gtk-2.0 - /opt/include/gtk-2.0 - /opt/gnome/include/gtk-2.0 - /sw/include/gtk-2.0 - ) - gtk2_debug_message("GTK2_GTK_INCLUDE_DIR is ${GTK2_GTK_INCLUDE_DIR}") - - # Some Linux distributions (e.g. Red Hat) have glibconfig.h - # and glib.h in different directories, so we need to look - # for both. - # - Atanas Georgiev - pkgconfig(glib-2.0 _GLIB2IncDir _GLIB2LinkDir _GLIB2LinkFlags _GLIB2Cflags) - pkgconfig(gmodule-2.0 _GMODULE2IncDir _GMODULE2LinkDir _GMODULE2LinkFlags _GMODULE2Cflags) - - find_path(GTK2_GLIBCONFIG_INCLUDE_DIR - NAMES - glibconfig.h - PATHS - ${_GLIB2IncDir} - ${_GMODULE2IncDir} - /opt/gnome/lib64/glib-2.0/include - /opt/gnome/lib/glib-2.0/include - /opt/lib/glib-2.0/include - /usr/lib64/glib-2.0/include - /usr/lib/glib-2.0/include - /sw/lib/glib-2.0/include - ) - gtk2_debug_message("GTK2_GLIBCONFIG_INCLUDE_DIR is ${GTK2_GLIBCONFIG_INCLUDE_DIR}") - - find_path(GTK2_GLIB_INCLUDE_DIR - NAMES - glib.h - PATHS - ${_GLIB2IncDir} - ${_GMODULE2IncDir} - /opt/include/glib-2.0 - /opt/gnome/include/glib-2.0 - /usr/include/glib-2.0 - /sw/include/glib-2.0 - ) - gtk2_debug_message("GTK2_GLIB_INCLUDE_DIR is ${GTK2_GLIB_INCLUDE_DIR}") - - pkgconfig(gdk-2.0 _GDK2IncDir _GDK2LinkDir _GDK2LinkFlags _GDK2Cflags) - - find_path(GTK2_GDK_INCLUDE_DIR - NAMES - gdkconfig.h - PATHS - ${_GDK2IncDir} - /opt/gnome/lib/gtk-2.0/include - /opt/gnome/lib64/gtk-2.0/include - /opt/lib/gtk-2.0/include - /usr/lib/gtk-2.0/include - /usr/lib64/gtk-2.0/include - /sw/lib/gtk-2.0/include - ) - gtk2_debug_message("GTK2_GDK_INCLUDE_DIR is ${GTK2_GDK_INCLUDE_DIR}") - - find_path(GTK2_GTKGL_INCLUDE_DIR - NAMES - gtkgl/gtkglarea.h - PATHS - ${_GLIB2IncDir} - /usr/include - /usr/include/gtkgl-2.0 - /usr/local/include - /usr/openwin/share/include - /opt/gnome/include - /opt/include - /sw/include - ) - gtk2_debug_message("GTK2_GTKGL_INCLUDE_DIR is ${GTK2_GTKGL_INCLUDE_DIR}") - - pkgconfig(libglade-2.0 _GLADEIncDir _GLADELinkDir _GLADELinkFlags _GLADECflags) - - find_path(GTK2_GLADE_INCLUDE_DIR - NAMES - glade/glade.h - PATHS - ${_GLADEIncDir} - /opt/gnome/include/libglade-2.0 - /usr/include/libglade-2.0 - /opt/include/libglade-2.0 - /sw/include/libglade-2.0 - ) - gtk2_debug_message("GTK2_GLADE_INCLUDE_DIR is ${GTK2_GLADE_INCLUDE_DIR}") - - pkgconfig(pango _PANGOIncDir _PANGOLinkDir _PANGOLinkFlags _PANGOCflags) - - find_path(GTK2_PANGO_INCLUDE_DIR - NAMES - pango/pango.h - PATHS - ${_PANGOIncDir} - /usr/include/pango-1.0 - /opt/gnome/include/pango-1.0 - /opt/include/pango-1.0 - /sw/include/pango-1.0 - ) - gtk2_debug_message("GTK2_PANGO_INCLUDE_DIR is ${GTK2_PANGO_INCLUDE_DIR}") - - pkgconfig(cairo _CAIROIncDir _CAIROLinkDir _CAIROLinkFlags _CAIROCflags) - - find_path(GTK2_CAIRO_INCLUDE_DIR - NAMES - cairo.h - PATHS - ${_CAIROIncDir} - /opt/gnome/include/cairo - /usr/include - /usr/include/cairo - /opt/include - /opt/include/cairo - /sw/include - /sw/include/cairo - ) - gtk2_debug_message("GTK2_CAIRO_INCLUDE_DIR is ${GTK2_CAIRO_INCLUDE_DIR}") - - pkgconfig(atk _ATKIncDir _ATKLinkDir _ATKLinkFlags _ATKCflags) - - find_path(GTK2_ATK_INCLUDE_DIR - NAMES - atk/atk.h - PATHS - ${_ATKIncDir} - /opt/gnome/include/atk-1.0 - /usr/include/atk-1.0 - /opt/include/atk-1.0 - /sw/include/atk-1.0 - ) - gtk2_debug_message("GTK2_ATK_INCLUDE_DIR is ${GTK2_ATK_INCLUDE_DIR}") - - find_library(GTK2_GTK_LIBRARY - NAMES - gtk-x11-2.0 - PATHS - ${_GTK2LinkDir} - /usr/lib - /usr/local/lib - /usr/openwin/lib - /usr/X11R6/lib - /opt/gnome/lib - /opt/lib - /sw/lib - ) - gtk2_debug_message("GTK2_GTK_LIBRARY is ${GTK2_GTK_LIBRARY}") - - find_library(GTK2_GDK_LIBRARY - NAMES - gdk-x11-2.0 - PATHS - ${_GDK2LinkDir} - /usr/lib - /usr/local/lib - /usr/openwin/lib - /usr/X11R6/lib - /opt/gnome/lib - /opt/lib - /sw/lib - ) - gtk2_debug_message("GTK2_GDK_LIBRARY is ${GTK2_GDK_LIBRARY}") - - find_library(GTK2_GDK_PIXBUF_LIBRARY - NAMES - gdk_pixbuf-2.0 - PATHS - ${_GDK2LinkDir} - /usr/lib - /usr/local/lib - /usr/openwin/lib - /usr/X11R6/lib - /opt/gnome/lib - /opt/lib - /sw/lib - ) - gtk2_debug_message("GTK2_GDK_PIXBUF_LIBRARY is ${GTK2_GDK_PIXBUF_LIBRARY}") - - find_library(GTK2_GMODULE_LIBRARY - NAMES - gmodule-2.0 - PATHS - ${_GMODULE2LinkDir} - /usr/lib - /usr/local/lib - /usr/openwin/lib - /usr/X11R6/lib - /opt/gnome/lib - /opt/lib - /sw/lib - ) - gtk2_debug_message("GTK2_GMODULE_LIBRARY is ${GTK2_GMODULE_LIBRARY}") - - find_library(GTK2_GTHREAD_LIBRARY - NAMES - gthread-2.0 - PATHS - ${_GTK2LinkDir} - /usr/lib - /usr/local/lib - /usr/openwin/lib - /usr/X11R6/lib - /opt/gnome/lib - /opt/lib - /sw/lib - ) - gtk2_debug_message("GTK2_GTHREAD_LIBRARY is ${GTK2_GTHREAD_LIBRARY}") - - find_library(GTK2_GOBJECT_LIBRARY - NAMES - gobject-2.0 - PATHS - ${_GTK2LinkDir} - /usr/lib - /usr/local/lib - /usr/openwin/lib - /usr/X11R6/lib - /opt/gnome/lib - /opt/lib - /sw/lib - ) - gtk2_debug_message("GTK2_GOBJECT_LIBRARY is ${GTK2_GOBJECT_LIBRARY}") - - find_library(GTK2_GLIB_LIBRARY - NAMES - glib-2.0 - PATHS - ${_GLIB2LinkDir} - /usr/lib - /usr/local/lib - /usr/openwin/lib - /usr/X11R6/lib - /opt/gnome/lib - /opt/lib - /sw/lib - ) - gtk2_debug_message("GTK2_GLIB_LIBRARY is ${GTK2_GLIB_LIBRARY}") - - find_library(GTK2_GTKGL_LIBRARY - NAMES - gtkgl-2.0 - PATHS - ${_GTK2LinkDir} - /usr/lib - /usr/local/lib - /usr/openwin/lib - /usr/X11R6/lib - /opt/gnome/lib - /opt/lib - /sw/lib - ) - gtk2_debug_message("GTK2_GTKGL_LIBRARY is ${GTK2_GTKGL_LIBRARY}") - - find_library(GTK2_GLADE_LIBRARY - NAMES - glade-2.0 - PATHS - ${_GLADELinkDir} - /usr/lib - /usr/local/lib - /usr/openwin/lib - /usr/X11R6/lib - /opt/gnome/lib - /opt/lib - /sw/lib - ) - gtk2_debug_message("GTK2_GLADE_LIBRARY is ${GTK2_GLADE_LIBRARY}") - - find_library(GTK2_PANGO_LIBRARY - NAMES - pango-1.0 - PATHS - ${_PANGOLinkDir} - /usr/lib - /usr/local/lib - /usr/openwin/lib - /usr/X11R6/lib - /opt/gnome/lib - /opt/lib - /sw/lib - ) - gtk2_debug_message("GTK2_PANGO_LIBRARY is ${GTK2_PANGO_LIBRARY}") - - find_library(GTK2_CAIRO_LIBRARY - NAMES - pangocairo-1.0 - PATHS - ${_CAIROLinkDir} - /usr/lib - /usr/local/lib - /usr/openwin/lib - /usr/X11R6/lib - /opt/gnome/lib - /opt/lib - /sw/lib - ) - gtk2_debug_message("GTK2_PANGO_LIBRARY is ${GTK2_CAIRO_LIBRARY}") - - find_library(GTK2_ATK_LIBRARY - NAMES - atk-1.0 - PATHS - ${_ATKinkDir} - /usr/lib - /usr/local/lib - /usr/openwin/lib - /usr/X11R6/lib - /opt/gnome/lib - /opt/lib - /sw/lib - ) - gtk2_debug_message("GTK2_ATK_LIBRARY is ${GTK2_ATK_LIBRARY}") - - set(GTK2_INCLUDE_DIRS - ${GTK2_GTK_INCLUDE_DIR} - ${GTK2_GLIBCONFIG_INCLUDE_DIR} - ${GTK2_GLIB_INCLUDE_DIR} - ${GTK2_GDK_INCLUDE_DIR} - ${GTK2_GLADE_INCLUDE_DIR} - ${GTK2_PANGO_INCLUDE_DIR} - ${GTK2_CAIRO_INCLUDE_DIR} - ${GTK2_ATK_INCLUDE_DIR} - ) - - if (GTK2_GTK_LIBRARY AND GTK2_GTK_INCLUDE_DIR) - if (GTK2_GDK_LIBRARY AND GTK2_GDK_PIXBUF_LIBRARY AND GTK2_GDK_INCLUDE_DIR) - if (GTK2_GMODULE_LIBRARY) - if (GTK2_GTHREAD_LIBRARY) - if (GTK2_GOBJECT_LIBRARY) - if (GTK2_GLADE_LIBRARY AND GTK2_GLADE_INCLUDE_DIR) - if (GTK2_PANGO_LIBRARY AND GTK2_PANGO_INCLUDE_DIR) - if (GTK2_CAIRO_LIBRARY AND GTK2_CAIRO_INCLUDE_DIR) - if (GTK2_ATK_LIBRARY AND GTK2_ATK_INCLUDE_DIR) - - # set GTK2 libraries - set (GTK2_LIBRARIES - ${GTK2_GTK_LIBRARY} - ${GTK2_GDK_LIBRARY} - ${GTK2_GDK_PIXBUF_LIBRARY} - ${GTK2_GMODULE_LIBRARY} - ${GTK2_GTHREAD_LIBRARY} - ${GTK2_GOBJECT_LIBRARY} - ${GTK2_GLADE_LIBRARY} - ${GTK2_PANGO_LIBRARY} - ${GTK2_CAIRO_LIBRARY} - ${GTK2_ATK_LIBRARY} - ) - - # check for gtkgl support - if (GTK2_GTKGL_LIBRARY AND GTK2_GTKGL_INCLUDE_DIR) - set(GTK2_GTKGL_FOUND TRUE) - - set(GTK2_INCLUDE_DIRS - ${GTK2_INCLUDE_DIRS} - ${GTK2_GTKGL_INCLUDE_DIR} - ) - - set(GTK2_LIBRARIES - ${GTK2_LIBRARIES} - ${GTK2_GTKGL_LIBRARY} - ) - endif (GTK2_GTKGL_LIBRARY AND GTK2_GTKGL_INCLUDE_DIR) - - else (GTK2_ATK_LIBRARY AND GTK2_ATK_INCLUDE_DIR) - message(SEND_ERROR "Could not find ATK") - endif (GTK2_ATK_LIBRARY AND GTK2_ATK_INCLUDE_DIR) - else (GTK2_CAIRO_LIBRARY AND GTK2_CAIRO_INCLUDE_DIR) - message(SEND_ERROR "Could not find CAIRO") - endif (GTK2_CAIRO_LIBRARY AND GTK2_CAIRO_INCLUDE_DIR) - else (GTK2_PANGO_LIBRARY AND GTK2_PANGO_INCLUDE_DIR) - message(SEND_ERROR "Could not find PANGO") - endif (GTK2_PANGO_LIBRARY AND GTK2_PANGO_INCLUDE_DIR) - else (GTK2_GLADE_LIBRARY AND GTK2_GLADE_INCLUDE_DIR) - message(SEND_ERROR "Could not find GLADE") - endif (GTK2_GLADE_LIBRARY AND GTK2_GLADE_INCLUDE_DIR) - else (GTK2_GOBJECT_LIBRARY) - message(SEND_ERROR "Could not find GOBJECT") - endif (GTK2_GOBJECT_LIBRARY) - else (GTK2_GTHREAD_LIBRARY) - message(SEND_ERROR "Could not find GTHREAD") - endif (GTK2_GTHREAD_LIBRARY) - else (GTK2_GMODULE_LIBRARY) - message(SEND_ERROR "Could not find GMODULE") - endif (GTK2_GMODULE_LIBRARY) - else (GTK2_GDK_LIBRARY AND GTK2_GDK_PIXBUF_LIBRARY AND GTK2_GDK_INCLUDE_DIR) - message(SEND_ERROR "Could not find GDK (GDK_PIXBUF)") - endif (GTK2_GDK_LIBRARY AND GTK2_GDK_PIXBUF_LIBRARY AND GTK2_GDK_INCLUDE_DIR) - else (GTK2_GTK_LIBRARY AND GTK2_GTK_INCLUDE_DIR) - message(SEND_ERROR "Could not find GTK2-X11") - endif (GTK2_GTK_LIBRARY AND GTK2_GTK_INCLUDE_DIR) - - if (GTK2_INCLUDE_DIRS AND GTK2_LIBRARIES) - set(GTK2_FOUND TRUE) - endif (GTK2_INCLUDE_DIRS AND GTK2_LIBRARIES) - - if (GTK2_FOUND) - if (NOT GTK2_FIND_QUIETLY) - message(STATUS "Found GTK2: ${GTK2_LIBRARIES}") - endif (NOT GTK2_FIND_QUIETLY) - else (GTK2_FOUND) - if (GTK2_FIND_REQUIRED) - message(FATAL_ERROR "Could not find GTK2") - endif (GTK2_FIND_REQUIRED) - endif (GTK2_FOUND) - - # show the GTK2_INCLUDE_DIRS and GTK2_LIBRARIES variables only in the advanced view - mark_as_advanced(GTK2_INCLUDE_DIRS GTK2_LIBRARIES) - - endif (UNIX) -endif (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS) - diff --git a/code/ryzom/CMakeModules/FindJpeg.cmake b/code/ryzom/CMakeModules/FindJpeg.cmake deleted file mode 100644 index 454f0fdc2..000000000 --- a/code/ryzom/CMakeModules/FindJpeg.cmake +++ /dev/null @@ -1,50 +0,0 @@ -# - Locate Jpeg library -# This module defines -# JPEG_LIBRARY, the library to link against -# JPEG_FOUND, if false, do not try to link to JPEG -# JPEG_INCLUDE_DIR, where to find headers. - -IF(JPEG_LIBRARY AND JPEG_INCLUDE_DIR) - # in cache already - SET(JPEG_FIND_QUIETLY TRUE) -ENDIF(JPEG_LIBRARY AND JPEG_INCLUDE_DIR) - - -FIND_PATH(JPEG_INCLUDE_DIR - jpeglib.h - PATHS - $ENV{JPEG_DIR}/include - /usr/local/include - /usr/include - /sw/include - /opt/local/include - /opt/csw/include - /opt/include - PATH_SUFFIXES jpeg -) - -FIND_LIBRARY(JPEG_LIBRARY - NAMES jpeg libjpeg - PATHS - $ENV{JPEG_DIR}/lib - /usr/local/lib - /usr/lib - /usr/local/X11R6/lib - /usr/X11R6/lib - /sw/lib - /opt/local/lib - /opt/csw/lib - /opt/lib - /usr/freeware/lib64 -) - -IF(JPEG_LIBRARY AND JPEG_INCLUDE_DIR) - SET(JPEG_FOUND "YES") - IF(NOT JPEG_FIND_QUIETLY) - MESSAGE(STATUS "Found Jpeg: ${JPEG_LIBRARY}") - ENDIF(NOT JPEG_FIND_QUIETLY) -ELSE(JPEG_LIBRARY AND JPEG_INCLUDE_DIR) - IF(NOT JPEG_FIND_QUIETLY) - MESSAGE(STATUS "Warning: Unable to find Jpeg!") - ENDIF(NOT JPEG_FIND_QUIETLY) -ENDIF(JPEG_LIBRARY AND JPEG_INCLUDE_DIR) diff --git a/code/ryzom/CMakeModules/nel.cmake b/code/ryzom/CMakeModules/nel.cmake index 25ecef21e..96f935964 100644 --- a/code/ryzom/CMakeModules/nel.cmake +++ b/code/ryzom/CMakeModules/nel.cmake @@ -131,50 +131,50 @@ MACRO(NL_SETUP_BUILD_FLAGS) SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${NL_RELEASEDEBUG_CFLAGS} ${PLATFORM_CFLAGS} ") ENDMACRO(NL_SETUP_BUILD_FLAGS) -MACRO(NL_SETUP_PREFIX_PATHS) - ## Allow override of install_prefix/etc path. - IF(NOT NL_ETC_PREFIX) +MACRO(RYZOM_SETUP_PREFIX_PATHS) + ## Allow override of install_prefix path. + IF(NOT RYZOM_PREFIX) IF(WIN32) - SET(NL_ETC_PREFIX "../etc" CACHE PATH "Installation path for configurations") + SET(RYZOM_PREFIX "." CACHE PATH "Installation path") ELSE(WIN32) - SET(NL_ETC_PREFIX "${CMAKE_INSTALL_PREFIX}/etc" CACHE PATH "Installation path for configurations") + SET(RYZOM_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE PATH "Installation path") ENDIF(WIN32) - ENDIF(NOT NL_ETC_PREFIX) + ENDIF(NOT RYZOM_PREFIX) + + ## Allow override of install_prefix/etc path. + IF(NOT RYZOM_ETC_PREFIX) + IF(WIN32) + SET(RYZOM_ETC_PREFIX "." CACHE PATH "Installation path for configurations") + ELSE(WIN32) + SET(RYZOM_ETC_PREFIX "${CMAKE_INSTALL_PREFIX}/etc/ryzom" CACHE PATH "Installation path for configurations") + ENDIF(WIN32) + ENDIF(NOT RYZOM_ETC_PREFIX) ## Allow override of install_prefix/share path. - IF(NOT NL_SHARE_PREFIX) + IF(NOT RYZOM_SHARE_PREFIX) IF(WIN32) - SET(NL_SHARE_PREFIX "../share" CACHE PATH "Installation path for data.") + SET(RYZOM_SHARE_PREFIX "." CACHE PATH "Installation path for data.") ELSE(WIN32) - SET(NL_SHARE_PREFIX "${CMAKE_INSTALL_PREFIX}/share" CACHE PATH "Installation path for data.") + SET(RYZOM_SHARE_PREFIX "${CMAKE_INSTALL_PREFIX}/share/ryzom" CACHE PATH "Installation path for data.") ENDIF(WIN32) - ENDIF(NOT NL_SHARE_PREFIX) + ENDIF(NOT RYZOM_SHARE_PREFIX) ## Allow override of install_prefix/sbin path. - IF(NOT NL_SBIN_PREFIX) + IF(NOT RYZOM_SBIN_PREFIX) IF(WIN32) - SET(NL_SBIN_PREFIX "../sbin" CACHE PATH "Installation path for admin tools and services.") + SET(RYZOM_SBIN_PREFIX "." CACHE PATH "Installation path for admin tools and services.") ELSE(WIN32) - SET(NL_SBIN_PREFIX "${CMAKE_INSTALL_PREFIX}/sbin" CACHE PATH "Installation path for admin tools and services.") + SET(RYZOM_SBIN_PREFIX "${CMAKE_INSTALL_PREFIX}/sbin" CACHE PATH "Installation path for admin tools and services.") ENDIF(WIN32) - ENDIF(NOT NL_SBIN_PREFIX) + ENDIF(NOT RYZOM_SBIN_PREFIX) ## Allow override of install_prefix/bin path. - IF(NOT NL_BIN_PREFIX) + IF(NOT RYZOM_BIN_PREFIX) IF(WIN32) - SET(NL_BIN_PREFIX "../bin" CACHE PATH "Installation path for tools and applications.") + SET(RYZOM_BIN_PREFIX "." CACHE PATH "Installation path for tools and applications.") ELSE(WIN32) - SET(NL_BIN_PREFIX "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation path for tools and applications.") + SET(RYZOM_BIN_PREFIX "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation path for client and tools.") ENDIF(WIN32) - ENDIF(NOT NL_BIN_PREFIX) + ENDIF(NOT RYZOM_BIN_PREFIX) - ## Allow override of install_prefix/bin path. - IF(NOT NL_LOG_PREFIX) - IF(WIN32) - SET(NL_LOG_PREFIX "../var/log" CACHE PATH "Installation path for tools and applications.") - ELSE(WIN32) - SET(NL_LOG_PREFIX "${CMAKE_INSTALL_PREFIX}/var/log" CACHE PATH "Installation path for tools and applications.") - ENDIF(WIN32) - ENDIF(NOT NL_LOG_PREFIX) - -ENDMACRO(NL_SETUP_PREFIX_PATHS) +ENDMACRO(RYZOM_SETUP_PREFIX_PATHS) diff --git a/code/ryzom/client/CMakeLists.txt b/code/ryzom/client/CMakeLists.txt index 4b7537b55..642244536 100644 --- a/code/ryzom/client/CMakeLists.txt +++ b/code/ryzom/client/CMakeLists.txt @@ -1 +1,7 @@ ADD_SUBDIRECTORY(src) + +IF(UNIX AND NOT APPLE) + ADD_SUBDIRECTORY(unix) +ENDIF(UNIX AND NOT APPLE) + +INSTALL(FILES client_default.cfg DESTINATION ${RYZOM_ETC_PREFIX}) diff --git a/code/ryzom/client/src/CMakeLists.txt b/code/ryzom/client/src/CMakeLists.txt index 273b09022..a82b2214c 100644 --- a/code/ryzom/client/src/CMakeLists.txt +++ b/code/ryzom/client/src/CMakeLists.txt @@ -1,8 +1,8 @@ -ADD_SUBDIRECTORY(seven_zip) - # These are Windows/MFC apps IF(WIN32) + ADD_SUBDIRECTORY(seven_zip) ADD_SUBDIRECTORY(bug_report) + SET(SEVENZIP_LIBRARY "ryzom_sevenzip") ENDIF(WIN32) ADD_SUBDIRECTORY(client_sheets) @@ -10,8 +10,8 @@ ADD_SUBDIRECTORY(client_sheets) FILE(GLOB SRC *.cpp *.h motion/*.cpp motion/*.h motion/modes/*.cpp motion/modes/*.h r2/*.h r2/*.cpp r2/dmc/*.h r2/dmc/*.cpp interface_v3/*.h interface_v3/*.cpp) # Filter out the source files not actually compiled. -LIST(REMOVE_ITEM SRC - ${CMAKE_CURRENT_SOURCE_DIR}/animated_scene_object.cpp +LIST(REMOVE_ITEM SRC + ${CMAKE_CURRENT_SOURCE_DIR}/animated_scene_object.cpp ${CMAKE_CURRENT_SOURCE_DIR}/animated_scene_object.h ${CMAKE_CURRENT_SOURCE_DIR}/animation_fx_sheet.h ${CMAKE_CURRENT_SOURCE_DIR}/animation_fx_sheet.cpp @@ -38,7 +38,7 @@ if(APPLE) SET(MACOSX_BUNDLE_INFO_STRING "Ryzom Core Client") SET(MACOSX_BUNDLE_ICON_FILE "") SET(MACOSX_BUNDLE_GUI_IDENTIFIER "") - SET(MACOSX_BUNDLE_LONG_VERSION_STRING "0.8.0") + SET(MACOSX_BUNDLE_LONG_VERSION_STRING ${NL_VERSION}) SET(MACOSX_BUNDLE_BUNDLE_NAME "Ryzom Core Client") SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "0.8") SET(MACOSX_BUNDLE_BUNDLE_VERSION "1.0") @@ -53,7 +53,7 @@ if(APPLE) # COMMAND ${CMAKE_COMMAND} -E make_directory # ${CMAKE_CURRENT_BINARY_DIR}/ryzom_client.app/Contents/Frameworks # # copy framework into app bundle - # COMMAND ${CMAKE_COMMAND} -E copy ${SOME_LIBRARY} + # COMMAND ${CMAKE_COMMAND} -E copy ${SOME_LIBRARY} # ${CMAKE_CURRENT_BINARY_DIR}/ryzom_client.app/Contents/Frameworks # # ... # # install_name_tool the lib pathes @@ -63,32 +63,32 @@ ELSE(APPLE) ENDIF(APPLE) INCLUDE_DIRECTORIES( - ${LIBXML2_INCLUDE_DIR} - ${NEL_INCLUDE_DIR} - ${LUA_INCLUDE_DIR} - ${LIBWWW_INCLUDE_DIR} - ${CURL_INCLUDE_DIRS} + ${LIBXML2_INCLUDE_DIR} + ${NEL_INCLUDE_DIR} + ${LUA_INCLUDE_DIR} + ${LIBWWW_INCLUDE_DIR} + ${CURL_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}) -TARGET_LINK_LIBRARIES(ryzom_client ${PLATFORM_LINKFLAGS} - ${LIBXML2_LIBRARIES} - ${NELMISC_LIBRARY} - ryzom_gameshare - ${NELNET_LIBRARY} - ${NELLIGO_LIBRARY} - ${NELGEORGES_LIBRARY} - ${NEL3D_LIBRARY} - ${LUA_LIBRARIES} - ${CURL_LIBRARIES} - ${NELSOUND_LIBRARY} +TARGET_LINK_LIBRARIES(ryzom_client ${PLATFORM_LINKFLAGS} + ${LIBXML2_LIBRARIES} + ${NELMISC_LIBRARY} + ryzom_gameshare + ${NELNET_LIBRARY} + ${NELLIGO_LIBRARY} + ${NELGEORGES_LIBRARY} + ${NEL3D_LIBRARY} + ${LUA_LIBRARIES} + ${CURL_LIBRARIES} + ${NELSOUND_LIBRARY} ${NELSNDDRV_LIBRARY} - ryzom_clientsheets - ${NELPACS_LIBRARY} - ${LIBWWW_LIBRARY} - ryzom_sevenzip + ryzom_clientsheets + ${NELPACS_LIBRARY} + ${LIBWWW_LIBRARY} + ${SEVENZIP_LIBRARY} luabind # TODO: find luabind and expat cleanly using a find script expat) - + IF(NOT WITH_COCOA) TARGET_LINK_LIBRARIES(ryzom_client ${X11_LIBRARIES}) ENDIF(NOT WITH_COCOA) @@ -99,4 +99,4 @@ IF(WITH_PCH) ADD_NATIVE_PRECOMPILED_HEADER(ryzom_client ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp) ENDIF(WITH_PCH) -INSTALL(TARGETS ryzom_client RUNTIME DESTINATION bin COMPONENT client BUNDLE DESTINATION /Applications) +INSTALL(TARGETS ryzom_client RUNTIME DESTINATION ${RYZOM_BIN_PREFIX} COMPONENT client BUNDLE DESTINATION /Applications) diff --git a/code/ryzom/client/src/client.cpp b/code/ryzom/client/src/client.cpp index 93a243949..a7a4de917 100644 --- a/code/ryzom/client/src/client.cpp +++ b/code/ryzom/client/src/client.cpp @@ -345,6 +345,16 @@ int main(int argc, char **argv) // init the Nel context CApplicationContext *appContext = new CApplicationContext; + // if client_default.cfg is not in current directory, use application default directory + if (!CFile::isExists("client_default.cfg")) + { + std::string currentPath = CFile::getApplicationDirectory("Ryzom"); + + if (!CFile::isExists(currentPath)) CFile::createDirectory(currentPath); + + CPath::setCurrentPath(currentPath); + } + // temporary buffer to store Ryzom full path char filename[1024]; @@ -437,31 +447,6 @@ int main(int argc, char **argv) GetModuleFileName(GetModuleHandle(NULL), filename, 1024); -#else - - // TODO for Linux : splashscreen - - if (argc >= 3) - { - LoginLogin = argv[1]; - LoginPassword = argv[2]; - if (!fromString(argv[3], LoginShardId)) LoginShardId = -1; - } - else if (argc >= 2) - { - LoginLogin = argv[1]; - LoginPassword = argv[2]; - LoginShardId = -1; - } - - strcpy(filename, argv[0]); - -#endif - - // initialize patch manager and set the ryzom full path, before it's used - CPatchManager *pPM = CPatchManager::getInstance(); - pPM->setRyzomFilename(NLMISC::CFile::getFilename(filename)); - // Delete the .bat file because it s not useful anymore if (NLMISC::CFile::fileExists("updt_nl.bat")) NLMISC::CFile::deleteFile("updt_nl.bat"); @@ -488,6 +473,31 @@ int main(int argc, char **argv) } } +#else + + // TODO for Linux : splashscreen + + if (argc >= 3) + { + LoginLogin = argv[1]; + LoginPassword = argv[2]; + if (!fromString(argv[3], LoginShardId)) LoginShardId = -1; + } + else if (argc >= 2) + { + LoginLogin = argv[1]; + LoginPassword = argv[2]; + LoginShardId = -1; + } + + strcpy(filename, argv[0]); + +#endif + + // initialize patch manager and set the ryzom full path, before it's used + CPatchManager *pPM = CPatchManager::getInstance(); + pPM->setRyzomFilename(NLMISC::CFile::getFilename(filename)); + ///////////////////////////////// // Initialize the application. // #ifndef TEST_CRASH_COUNTER diff --git a/code/ryzom/client/src/client_cfg.cpp b/code/ryzom/client/src/client_cfg.cpp index 87d4f038c..3caa08763 100644 --- a/code/ryzom/client/src/client_cfg.cpp +++ b/code/ryzom/client/src/client_cfg.cpp @@ -39,6 +39,10 @@ #include "game_share/time_weather_season/time_and_season.h" #include "game_share/ryzom_version.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif // HAVE_CONFIG_H + /////////// // MACRO // /////////// @@ -1966,7 +1970,43 @@ void CClientConfig::serial(class NLMISC::IStream &f) throw(NLMISC::EStream) void CClientConfig::init(const string &configFileName) { if(!CFile::fileExists(configFileName)) - nlwarning("CFG::init: '%s' Not Found !!!", configFileName.c_str ()); + { + std::string defaultConfigFileName = "client_default.cfg"; + bool found = false; + + if (CFile::isExists(defaultConfigFileName)) found = true; + +#ifdef RYZOM_ETC_PREFIX + if (!found) + { + defaultConfigFileName = std::string(RYZOM_ETC_PREFIX"/") + defaultConfigFileName; + if (CFile::isExists(defaultConfigFileName)) found = true; + } +#endif // RYZOM_ETC_PREFIX + + if (found) + { + // create the basic .cfg that link the default one + FILE *fp = fopen(configFileName.c_str(), "w"); + if (fp == NULL) + { + nlerror ("CFG::init: Can't create config file '%s'", configFileName.c_str()); + } + else + { + nlwarning("CFG::init: creating '%s' with default values", configFileName.c_str ()); + } + fprintf(fp, "RootConfigFilename = \"%s\";\n", defaultConfigFileName.c_str()); +#ifdef RYZOM_SHARE_PREFIX + fprintf(fp, "PreDataPath = { \"%s/data\" };\n", RYZOM_SHARE_PREFIX); +#endif // RYZOM_SHARE_PREFIX + fclose(fp); + } + else + { + nlwarning("CFG::init: '%s' Not Found !!!", defaultConfigFileName.c_str()); + } + } // if the config file will be modified, it calls automatically the function setValuesOnFileChange() ClientCfg.ConfigFile.setCallback (CClientConfig::setValuesOnFileChange); diff --git a/code/ryzom/client/src/client_sheets/item_sheet.cpp b/code/ryzom/client/src/client_sheets/item_sheet.cpp index 3bb4810c8..7950e923b 100644 --- a/code/ryzom/client/src/client_sheets/item_sheet.cpp +++ b/code/ryzom/client/src/client_sheets/item_sheet.cpp @@ -239,7 +239,7 @@ void CItemSheet::build(const NLGEORGES::UFormElm &item) debug(toString("The slot name %d is Empty.", i)); // Push the possible slots for the item in the list. - SlotBF|= SINT64_CONSTANT(1)<< (SLOTTYPE::stringToSlotType(NLMISC::strupr(slotName))); + SlotBF|= SINT64_CONSTANT(1)<< (SLOTTYPE::stringToSlotType(NLMISC::toUpper(slotName))); } } } @@ -258,7 +258,7 @@ void CItemSheet::build(const NLGEORGES::UFormElm &item) } else { - Family = (ITEMFAMILY::EItemFamily) ITEMFAMILY::stringToItemFamily(NLMISC::strupr( family) ); + Family = (ITEMFAMILY::EItemFamily) ITEMFAMILY::stringToItemFamily(NLMISC::toUpper( family) ); if(Family == ITEMFAMILY::UNDEFINED) debug("Item Family Undefined."); } @@ -272,7 +272,7 @@ void CItemSheet::build(const NLGEORGES::UFormElm &item) } else { - ItemType = (ITEM_TYPE::TItemType) ITEM_TYPE::stringToItemType(NLMISC::strupr(itemtype) ); + ItemType = (ITEM_TYPE::TItemType) ITEM_TYPE::stringToItemType(NLMISC::toUpper(itemtype) ); if (ItemType == ITEM_TYPE::UNDEFINED) debug("Item Type Undefined."); } diff --git a/code/ryzom/client/src/client_sheets/sbrick_sheet.cpp b/code/ryzom/client/src/client_sheets/sbrick_sheet.cpp index 76000d099..c9379e1ed 100644 --- a/code/ryzom/client/src/client_sheets/sbrick_sheet.cpp +++ b/code/ryzom/client/src/client_sheets/sbrick_sheet.cpp @@ -103,7 +103,7 @@ void CSBrickSheet::build (const NLGEORGES::UFormElm &root) { string sheetName= Id.toString(); std::string::size_type end= sheetName.find(".sbrick")-2; - BrickFamily = BRICK_FAMILIES::toSBrickFamily ( strupr(sheetName.substr(0,end)) ); + BrickFamily = BRICK_FAMILIES::toSBrickFamily ( NLMISC::toUpper(sheetName.substr(0,end)) ); if(BrickFamily==BRICK_FAMILIES::Unknown) nlwarning("Unknown Family for SBrick: %s", sheetName.c_str()); } diff --git a/code/ryzom/client/src/color_slot_manager.cpp b/code/ryzom/client/src/color_slot_manager.cpp index d8e7116f6..905eecef5 100644 --- a/code/ryzom/client/src/color_slot_manager.cpp +++ b/code/ryzom/client/src/color_slot_manager.cpp @@ -266,7 +266,7 @@ bool CColorSlotManager::parseTexName(const char *texName, std::string *texNameWi static std::string nameToParse; static std::string currentExt; static TIntCoupleVect slotsId; - nameToParse = NLMISC::strupr(NLMISC::CFile::getFilenameWithoutExtension(texName)); + nameToParse = NLMISC::toUpper(NLMISC::CFile::getFilenameWithoutExtension(texName)); TStrPos currPos = nameToParse.length(); @@ -377,9 +377,8 @@ bool CColorSlotManager::changeTexName(std::string &texName, TIntCouple *slotIDs, static TIntCoupleVect srcSlotIDs; everythingOk = true; - texNameNoExt = NLMISC::CFile::getFilenameWithoutExtension(texName); + texNameNoExt = NLMISC::toUpper(NLMISC::CFile::getFilenameWithoutExtension(texName)); texExt = NLMISC::CFile::getExtension(texName); - NLMISC::strupr(texNameNoExt); TTex2Slots::const_iterator texIt = _TexMap.find(texNameNoExt); if (texIt != _TexMap.end()) { diff --git a/code/ryzom/client/src/init.cpp b/code/ryzom/client/src/init.cpp index 9f19b4844..a047d9455 100644 --- a/code/ryzom/client/src/init.cpp +++ b/code/ryzom/client/src/init.cpp @@ -168,7 +168,7 @@ uint TipsOfTheDayIndex; // XML allocator functions -// Due to Bug #906, we disable the stl xml allocation +// Due to Bug #906, we disable the stl xml allocation /* static volatile bool XmlAllocUsesSTL = true; @@ -324,7 +324,7 @@ void ExitClientError (const char *format, ...) MessageBoxW (NULL, (WCHAR*)ucstr.c_str(), (WCHAR*)CI18N::get ("TheSagaOfRyzom").c_str (), MB_OK|MB_ICONERROR); */ #else - fprintf (stderr, str); + fprintf (stderr, "%s\n", str); #endif // Exit extern void quitCrashReport (); @@ -691,7 +691,7 @@ void prelogInit() // _CrtSetDbgFlag( _CRTDBG_CHECK_CRT_DF ); // Init XML Lib allocator - // Due to Bug #906, we disable the stl xml allocation + // Due to Bug #906, we disable the stl xml allocation // nlverify (xmlMemSetup (XmlFree4NeL, XmlMalloc4NeL, XmlRealloc4NeL, XmlStrdup4NeL) == 0); // Init the debug memory @@ -727,8 +727,14 @@ void prelogInit() setReportEmailFunction ((void*)sendEmail); setDefaultEmailParams ("smtp.nevrax.com", "", "ryzombug@nevrax.com"); + // create the data dir. + if (!CFile::isExists("data")) CFile::createDirectory("data"); + // create the save dir. - CFile::createDirectory("save"); + if (!CFile::isExists("save")) CFile::createDirectory("save"); + + // create the user dir. + if (!CFile::isExists("user")) CFile::createDirectory("user"); #if !FINAL_VERSION // if we're not in final version then start the file access logger to keep track of the files that we read as we play @@ -908,6 +914,23 @@ void prelogInit() // Set the title Driver->setWindowTitle(CI18N::get("TheSagaOfRyzom")); +#if defined(NL_OS_UNIX) && !defined(NL_OS_MAC) + vector bitmaps; + + string fileName = "/usr/share/pixmaps/ryzom.png"; + + CIFile file; + + if (file.open(fileName)) + { + CBitmap bitmap; + if (bitmap.load(file)) + bitmaps.push_back(bitmap); + } + + Driver->setWindowIcon(bitmaps); +#endif + sint32 posX = 0, posY = 0; if (ClientCfg.Windowed) diff --git a/code/ryzom/client/src/interface_v3/action_handler_debug.cpp b/code/ryzom/client/src/interface_v3/action_handler_debug.cpp index eaa24e354..cfaeac55f 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_debug.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_debug.cpp @@ -71,7 +71,9 @@ class CAHDisplayInfos : public IActionHandler { // can only be used by devs and CSR or in local mode #if FINAL_VERSION +# ifdef NL_OS_WINDOWS if( ClientCfg.Local || hasPrivilegeDEV() || hasPrivilegeSGM() || hasPrivilegeGM() || hasPrivilegeSG() || hasPrivilegeEM() || hasPrivilegeVG() ) +# endif #endif { ShowInfos = (ShowInfos+1)%6; diff --git a/code/ryzom/client/src/interface_v3/action_handler_misc.cpp b/code/ryzom/client/src/interface_v3/action_handler_misc.cpp index 9a4f5f232..565165987 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_misc.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_misc.cpp @@ -595,12 +595,16 @@ void displayScreenShotSavedInfo(const string &filename) pIM->displaySystemInfo(msg); } +void initScreenshot() +{ + if (!CFile::isExists(ScreenshotsDirectory)) CFile::createDirectory(ScreenshotsDirectory); +} + void screenShotTGA() { CBitmap btm; getBuffer (btm); - if(!ScreenshotsDirectory.empty() && !CFile::isExists(ScreenshotsDirectory)) CFile::createDirectory(ScreenshotsDirectory); string filename = CFile::findNewFile (ScreenshotsDirectory+"screenshot.tga"); COFile fs(filename); btm.writeTGA(fs, 24, false); @@ -613,7 +617,6 @@ void screenShotPNG() CBitmap btm; getBuffer (btm); - if(!ScreenshotsDirectory.empty() && !CFile::isExists(ScreenshotsDirectory)) CFile::createDirectory(ScreenshotsDirectory); string filename = CFile::findNewFile (ScreenshotsDirectory+"screenshot.png"); COFile fs(filename); if (!btm.writePNG(fs, 24)) @@ -634,7 +637,6 @@ void screenShotJPG() CBitmap btm; getBuffer (btm); - if(!ScreenshotsDirectory.empty() && !CFile::isExists(ScreenshotsDirectory)) CFile::createDirectory(ScreenshotsDirectory); string filename = CFile::findNewFile (ScreenshotsDirectory+"screenshot.jpg"); COFile fs(filename); btm.writeJPG(fs); diff --git a/code/ryzom/client/src/interface_v3/action_handler_misc.h b/code/ryzom/client/src/interface_v3/action_handler_misc.h index 39e9c9eb0..5e9328832 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_misc.h +++ b/code/ryzom/client/src/interface_v3/action_handler_misc.h @@ -174,6 +174,7 @@ public: /** Capture current content of framebuffer and save the result. If a custom size is asked in ClientCfg, then the scene is rendered again * instead (possibly multiple time) */ +void initScreenshot(); void screenShotTGA(); void screenShotPNG(); void screenShotJPG(); diff --git a/code/ryzom/client/src/interface_v3/action_phrase_faber.cpp b/code/ryzom/client/src/interface_v3/action_phrase_faber.cpp index b7b2afce2..bb4b72ecc 100644 --- a/code/ryzom/client/src/interface_v3/action_phrase_faber.cpp +++ b/code/ryzom/client/src/interface_v3/action_phrase_faber.cpp @@ -105,8 +105,7 @@ void CActionPhraseFaber::launchFaberCastWindow(sint32 memoryLine, uint memoryIn _FaberPlanBrickFamilies.clear(); if(rootBrick->Properties.size()>0) { - string prop= rootBrick->Properties[0].Text; - strupr(prop); + string prop= NLMISC::toUpper(rootBrick->Properties[0].Text); vector strList; splitString(prop, " ", strList); // The prop Id should be 'FPLAN:' diff --git a/code/ryzom/client/src/interface_v3/character_3d.cpp b/code/ryzom/client/src/interface_v3/character_3d.cpp index a2624f87b..2c21f9c8e 100644 --- a/code/ryzom/client/src/interface_v3/character_3d.cpp +++ b/code/ryzom/client/src/interface_v3/character_3d.cpp @@ -71,6 +71,7 @@ SCharacter3DSetup::SCharacter3DSetup () } Tattoo = 0; EyesColor = 0; + HairColor = 0; CharHeight = 0.0f; ChestWidth = 0.0f; ArmsWidth = 0.0f; diff --git a/code/ryzom/client/src/interface_v3/ctrl_scroll.cpp b/code/ryzom/client/src/interface_v3/ctrl_scroll.cpp index 5ea043daf..652bd5ed7 100644 --- a/code/ryzom/client/src/interface_v3/ctrl_scroll.cpp +++ b/code/ryzom/client/src/interface_v3/ctrl_scroll.cpp @@ -833,7 +833,7 @@ void CCtrlScroll::moveTargetX (sint32 dx) _TrackPos = (sint32)factor; } - // invlidate only position. 1 pass is sufficient + // invalidate only position. 1 pass is sufficient invalidateCoords(1); } @@ -873,7 +873,7 @@ void CCtrlScroll::moveTargetY (sint32 dy) _TrackPos = (sint32)factor; } - // invlidate only position. 1 pass is sufficient + // invalidate only position. 1 pass is sufficient invalidateCoords(1); } diff --git a/code/ryzom/client/src/interface_v3/custom_mouse.cpp b/code/ryzom/client/src/interface_v3/custom_mouse.cpp index af1bb7209..c7d127803 100644 --- a/code/ryzom/client/src/interface_v3/custom_mouse.cpp +++ b/code/ryzom/client/src/interface_v3/custom_mouse.cpp @@ -370,7 +370,6 @@ HICON CCustomMouse::buildCursor(const CBitmap &src, NLMISC::CRGBA col, uint8 rot uint mouseH = GetSystemMetrics(SM_CYCURSOR); nlassert(src.getWidth() == mouseW); nlassert(src.getHeight() == mouseH); - HICON result = 0; CBitmap rotSrc = src; if (rot > 3) rot = 3; // mimic behavior of 'CViewRenderer::drawRotFlipBitmapTiled' (why not rot & 3 ??? ...) switch(rot) @@ -380,62 +379,7 @@ HICON CCustomMouse::buildCursor(const CBitmap &src, NLMISC::CRGBA col, uint8 rot case 2: rotSrc.rot90CW(); rotSrc.rot90CW(); break; case 3: rotSrc.rot90CCW(); break; } - CBitmap colorBm; - colorBm.resize(mouseW, mouseH, CBitmap::RGBA); - const CRGBA *srcColorPtr = (CRGBA *) &(rotSrc.getPixels()[0]); - const CRGBA *srcColorPtrLast = srcColorPtr + (mouseW * mouseH); - CRGBA *destColorPtr = (CRGBA *) &(colorBm.getPixels()[0]); - static volatile uint8 alphaThreshold = 127; - do - { - destColorPtr->modulateFromColor(*srcColorPtr, col); - std::swap(destColorPtr->R, destColorPtr->B); - ++ srcColorPtr; - ++ destColorPtr; - } - while (srcColorPtr != srcColorPtrLast); - // - HBITMAP colorHbm = 0; - HBITMAP maskHbm = 0; - // - if (_ColorDepth == ColorDepth16) - { - std::vector colorBm16(colorBm.getWidth() * colorBm.getHeight()); - const CRGBA *src32 = (const CRGBA *) &colorBm.getPixels(0)[0]; - for (uint k = 0;k < colorBm16.size(); ++k) - { - colorBm16[k] = ((uint16)(src32[k].R&0xf8)>>3) | ((uint16)(src32[k].G&0xfc)<<3) | ((uint16)(src32[k].B & 0xf8)<<8); - } - colorHbm = CreateBitmap(mouseW, mouseH, 1, 16, &colorBm16[0]); - std::vector bitMask((colorBm.getWidth() * colorBm.getHeight() + 7) / 8, 0); - for (uint k = 0;k < colorBm16.size(); ++k) - { - if (src32[k].A <= 120) - { - bitMask[k / 8] |= (0x80 >> (k & 7)); - } - } - maskHbm = CreateBitmap(mouseW, mouseH, 1, 1, &bitMask[0]); - } - else - { - colorHbm = CreateBitmap(mouseW, mouseH, 1, 32, &colorBm.getPixels(0)[0]); - maskHbm = CreateBitmap(mouseW, mouseH, 1, 32, &colorBm.getPixels(0)[0]); - } - ICONINFO iconInfo; - iconInfo.fIcon = FALSE; - iconInfo.xHotspot = (DWORD) hotSpotX; - iconInfo.yHotspot = (DWORD) hotSpotY; - iconInfo.hbmMask = maskHbm; - iconInfo.hbmColor = colorHbm; - if (colorHbm && maskHbm) - { - result = CreateIconIndirect(&iconInfo); - } - // - if (colorHbm) DeleteObject(colorHbm); - if (maskHbm) DeleteObject(maskHbm); - return result; + return rotSrc.getHICON(mouseW, mouseH, _ColorDepth == ColorDepth16 ? 16:32, col, hotSpotX, hotSpotY, true); } diff --git a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index 33f1e8400..c10253128 100644 --- a/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/code/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -378,9 +378,8 @@ bool CCtrlSheetInfo::parseCtrlInfo(xmlNodePtr cur, CInterfaceGroup * /* parentGr // The string may have multiple brick type separated by | string brickTypeArray= (const char*)prop; - strupr(brickTypeArray); vector strList; - NLMISC::splitString(brickTypeArray, "|", strList); + NLMISC::splitString(NLMISC::toUpper(brickTypeArray), "|", strList); // Test All words for(uint i=0;i= 3) { count -= 2; @@ -1088,7 +1088,7 @@ CRGBA CViewRenderer::getTextureColor(sint32 id, sint32 x, sint32 y) sint32 CViewRenderer::getTypoTextureW(char c) { if ((c>=0) && (c=0) && (cprintfAt(0.1f, line, "%.1f ms", smoothFPS.getSmoothValue ()*1000); + TextContext->printfAt(0.1f, line, "FPS %.1f ms - %.1f fps", spf*1000, 1.f/spf); line-= lineStep; // More Smoothed Ms per frame - TextContext->printfAt(0.1f, line, "%.1f ms", moreSmoothFPS.getSmoothValue ()*1000); + spf = moreSmoothFPS.getSmoothValue (); + TextContext->printfAt(0.1f, line, "Smoothed FPS %.1f ms - %.1f fps", spf*1000, 1.f/spf); line-= lineStep; } - - } static NLMISC::CRefPtr HighlightedDebugUI; diff --git a/code/ryzom/client/src/net_manager.cpp b/code/ryzom/client/src/net_manager.cpp index 97cbd9c6d..6a7787a6f 100644 --- a/code/ryzom/client/src/net_manager.cpp +++ b/code/ryzom/client/src/net_manager.cpp @@ -3166,7 +3166,7 @@ private: ucstring web_app; uint i; const uint digitStart= 6; - const uint digitMaxEnd= contentStr.size(); + const uint digitMaxEnd= (uint)contentStr.size(); is_webig = true; diff --git a/code/ryzom/client/unix/CMakeLists.txt b/code/ryzom/client/unix/CMakeLists.txt new file mode 100644 index 000000000..df17996fe --- /dev/null +++ b/code/ryzom/client/unix/CMakeLists.txt @@ -0,0 +1,4 @@ +CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/ryzom.desktop.in" "${CMAKE_CURRENT_BINARY_DIR}/ryzom.desktop") + +INSTALL(FILES ryzom.png DESTINATION share/pixmaps) +INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/ryzom.desktop" DESTINATION share/applications) diff --git a/code/ryzom/client/unix/ryzom.desktop.in b/code/ryzom/client/unix/ryzom.desktop.in new file mode 100644 index 000000000..ded90c67f --- /dev/null +++ b/code/ryzom/client/unix/ryzom.desktop.in @@ -0,0 +1,13 @@ +[Desktop Entry] +Version=1.0 +Name=Ryzom +Name[ru]=Ризом +Type=Application +GenericName=ryzom +Comment=Ryzom client +Comment[fr_FR]=Client Ryzom +Exec=${RYZOM_BIN_PREFIX}/ryzom_client +Icon=ryzom +Terminal=false +Hidden=false +Categories=Game;RolePlaying; diff --git a/code/ryzom/client/unix/ryzom.png b/code/ryzom/client/unix/ryzom.png new file mode 100644 index 000000000..43aae082f Binary files /dev/null and b/code/ryzom/client/unix/ryzom.png differ diff --git a/code/ryzom/common/CMakeLists.txt b/code/ryzom/common/CMakeLists.txt index 4b7537b55..dbf1c937d 100644 --- a/code/ryzom/common/CMakeLists.txt +++ b/code/ryzom/common/CMakeLists.txt @@ -1 +1,10 @@ ADD_SUBDIRECTORY(src) + +#ADD_CUSTOM_COMMAND(OUTPUT "${CMAKE_BINARY_DIR}/share/data_common.bnp" +# COMMAND bnp_make -p ${CMAKE_CURRENT_SOURCE_DIR}/data_common ${CMAKE_BINARY_DIR}/share > /dev/null) + +#ADD_CUSTOM_TARGET(data_common ALL +# DEPENDS "${CMAKE_BINARY_DIR}/share/data_common.bnp") + +#INSTALL(TARGETS data_common ARCHIVE DESTINATION ${RYZOM_SHARE_PREFIX}/data) +#INSTALL(FILES "${CMAKE_BINARY_DIR}/share/data_common.bnp" DESTINATION "${RYZOM_SHARE_PREFIX}/data") diff --git a/code/ryzom/common/src/game_share/server_edition_module.cpp b/code/ryzom/common/src/game_share/server_edition_module.cpp index f1f03163f..2731ed40b 100644 --- a/code/ryzom/common/src/game_share/server_edition_module.cpp +++ b/code/ryzom/common/src/game_share/server_edition_module.cpp @@ -3254,10 +3254,6 @@ void CServerEditionModule::hibernateSession(NLNET::IModuleProxy *sender, TSessio } -static const std::string _SubRep = "r2/"; -//static const std::string _SubRep = ""; - - std::string CServerEditionModule::getSessionFilename(TSessionId sessionId, TCharId charId) const { return NLMISC::toString("r2_session_%.08u_%08u.dat", sessionId.asInt(), charId ); @@ -3265,7 +3261,7 @@ std::string CServerEditionModule::getSessionFilename(TSessionId sessionId, TChar std::string CServerEditionModule::getOverrideRingAccessFilename() const { - return NLMISC::toString("r2/override_ring_access.txt", _SubRep.c_str()); + return "r2/override_ring_access.txt"; } //implementation of characterKicked and command diff --git a/code/ryzom/config.h.cmake b/code/ryzom/config.h.cmake index ac0caa3e0..68b81f02b 100644 --- a/code/ryzom/config.h.cmake +++ b/code/ryzom/config.h.cmake @@ -1,3 +1,6 @@ +#ifndef CONFIG_H +#define CONFIG_H + #cmakedefine HAVE_DL_H 1 #cmakedefine HAVE_EXECINFO_H 1 #cmakedefine HAVE_ICONV 1 @@ -30,3 +33,10 @@ #cmakedefine HAVE_STRTOULL 1 #cmakedefine HAVE_STATVFS 1 #cmakedefine HAVE_STAT64 1 + +#cmakedefine RYZOM_PREFIX "${RYZOM_PREFIX}" +#cmakedefine RYZOM_BIN_PREFIX "${RYZOM_BIN_PREFIX}" +#cmakedefine RYZOM_ETC_PREFIX "${RYZOM_ETC_PREFIX}" +#cmakedefine RYZOM_SHARE_PREFIX "${RYZOM_SHARE_PREFIX}" + +#endif // CONFIG_H diff --git a/code/ryzom/tools/client/client_config/database.cpp b/code/ryzom/tools/client/client_config/database.cpp index 9ad2b018f..493b61594 100644 --- a/code/ryzom/tools/client/client_config/database.cpp +++ b/code/ryzom/tools/client/client_config/database.cpp @@ -82,7 +82,7 @@ void CPage::init (uint id, const char *name, bool bold, uint icon, uint resid, C Parent = parent; Icon = icon; ResId = resid; - ChildId = parent->Children.size (); + ChildId = (uint)parent->Children.size (); if (parent) parent->Children.push_back (this); Name = name; diff --git a/code/ryzom/tools/sheets_packer/sheets_packer.cpp b/code/ryzom/tools/sheets_packer/sheets_packer.cpp index e7f6388b3..83fc43173 100644 --- a/code/ryzom/tools/sheets_packer/sheets_packer.cpp +++ b/code/ryzom/tools/sheets_packer/sheets_packer.cpp @@ -35,7 +35,6 @@ // Client #include "sheets_packer_init.h" -#include "sheets_packer_release.h" /////////// diff --git a/code/ryzom/tools/sheets_packer/sheets_packer.vcproj b/code/ryzom/tools/sheets_packer/sheets_packer.vcproj index 9ae25c46f..798fafe68 100644 --- a/code/ryzom/tools/sheets_packer/sheets_packer.vcproj +++ b/code/ryzom/tools/sheets_packer/sheets_packer.vcproj @@ -1,7 +1,7 @@ - - - - diff --git a/code/ryzom/tools/sheets_packer/sheets_packer_init.cpp b/code/ryzom/tools/sheets_packer/sheets_packer_init.cpp index 906e86e7d..f429aa634 100644 --- a/code/ryzom/tools/sheets_packer/sheets_packer_init.cpp +++ b/code/ryzom/tools/sheets_packer/sheets_packer_init.cpp @@ -30,8 +30,6 @@ #include "nel/ligo/ligo_config.h" #include "nel/ligo/primitive.h" -// 3D Interface. -//#include "nel/3d/u_driver.h" // Application #include "sheets_packer_init.h" #include "sheets_packer_cfg.h" @@ -50,8 +48,7 @@ using namespace std; ///////////// // GLOBALS // ///////////// -//UDriver *Driver = 0; -CFileDisplayer fd("sheets_packer.log", true, "SHEETS_PACKER.LOG"); +CFileDisplayer *fd = NULL; NLLIGO::CLigoConfig LigoConfig; @@ -68,14 +65,16 @@ bool init() // Add a displayer for Debug Infos. createDebug(); + fd = new CFileDisplayer(getLogDirectory() + "sheets_packer.log", true, "SHEETS_PACKER.LOG"); + // register ligo 'standard' class NLLIGO::Register(); - DebugLog->addDisplayer (&fd); - InfoLog->addDisplayer (&fd); - WarningLog->addDisplayer (&fd); - ErrorLog->addDisplayer (&fd); - AssertLog->addDisplayer (&fd); + DebugLog->addDisplayer (fd); + InfoLog->addDisplayer (fd); + WarningLog->addDisplayer (fd); + ErrorLog->addDisplayer (fd); + AssertLog->addDisplayer (fd); // Load the application configuration. nlinfo("Loading config file..."); @@ -104,6 +103,23 @@ bool init() // The init is a success. return true; }// init // + +//--------------------------------------------------- +// release : +// Release all the memory. +//--------------------------------------------------- +void release() +{ + DebugLog->removeDisplayer ("SHEETS_PACKER.LOG"); + InfoLog->removeDisplayer ("SHEETS_PACKER.LOG"); + WarningLog->removeDisplayer ("SHEETS_PACKER.LOG"); + ErrorLog->removeDisplayer ("SHEETS_PACKER.LOG"); + AssertLog->removeDisplayer ("SHEETS_PACKER.LOG"); + + delete fd; + fd = NULL; +}// release // + void outputSomeDebugInfoForPackedSheetCrash() { } diff --git a/code/ryzom/tools/sheets_packer/sheets_packer_init.h b/code/ryzom/tools/sheets_packer/sheets_packer_init.h index 1bdcd4e94..26c476a7c 100644 --- a/code/ryzom/tools/sheets_packer/sheets_packer_init.h +++ b/code/ryzom/tools/sheets_packer/sheets_packer_init.h @@ -27,6 +27,8 @@ // Initialize the application. bool init(); +// Release all. +void release(); #endif // TL_SHEETS_PACKER_INIT_H diff --git a/code/ryzom/tools/sheets_packer/sheets_packer_release.cpp b/code/ryzom/tools/sheets_packer/sheets_packer_release.cpp deleted file mode 100644 index 1f08c1cc4..000000000 --- a/code/ryzom/tools/sheets_packer/sheets_packer_release.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - - - -///////////// -// INCLUDE // -///////////// -#include "stdpch.h" -#include "sheets_packer_release.h" - -#include "nel/misc/debug.h" - - -/////////// -// USING // -/////////// -using namespace NLMISC; - - -/////////////// -// FUNCTIONS // -/////////////// -//--------------------------------------------------- -// release : -// Release all the memory. -//--------------------------------------------------- -void release() -{ - DebugLog->removeDisplayer ("SHEETS_PACKER.LOG"); - InfoLog->removeDisplayer ("SHEETS_PACKER.LOG"); - WarningLog->removeDisplayer ("SHEETS_PACKER.LOG"); - ErrorLog->removeDisplayer ("SHEETS_PACKER.LOG"); - AssertLog->removeDisplayer ("SHEETS_PACKER.LOG"); -}// release // diff --git a/code/ryzom/tools/sheets_packer/sheets_packer_release.h b/code/ryzom/tools/sheets_packer/sheets_packer_release.h deleted file mode 100644 index 0ac0cf7be..000000000 --- a/code/ryzom/tools/sheets_packer/sheets_packer_release.h +++ /dev/null @@ -1,33 +0,0 @@ -// Ryzom - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - - - -#ifndef TL_SHEETS_PACKER_RELEASE_H -#define TL_SHEETS_PACKER_RELEASE_H - -#include "nel/misc/types_nl.h" - - - -// Release all. -void release(); - - - -#endif // TL_SHEETS_PACKER_RELEASE_H - -/* End of sheets_packer_release.h */