diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 4226d4eab..fb0f9b217 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -297,9 +297,9 @@ IF(WIN32) ENDIF(WITH_NEL_CEGUI) # Only the tools require MFC. - IF(WITH_TOOLS) - SET(CMAKE_INSTALL_MFC_LIBRARIES TRUE) - ENDIF(WITH_TOOLS) + #IF(WITH_TOOLS) + # SET(CMAKE_INSTALL_MFC_LIBRARIES TRUE) + #ENDIF(WITH_TOOLS) #INCLUDE(InstallRequiredSystemLibraries) ENDIF(WIN32) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index dd8dee49f..09efd3309 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -315,6 +315,7 @@ MACRO(NL_SETUP_NEL_DEFAULT_OPTIONS) ### # Optional support ### + OPTION(WITH_TOOLS "Build Tools" OFF) OPTION(WITH_NEL_CEGUI "Build CEGUI Renderer" OFF) OPTION(WITH_NEL_TOOLS "Build NeL Tools" ON ) OPTION(WITH_NEL_MAXPLUGIN "Build NeL 3dsMax Plugin" OFF) @@ -324,10 +325,10 @@ MACRO(NL_SETUP_NEL_DEFAULT_OPTIONS) OPTION(WITH_LIBOVR "With LibOVR support" OFF) OPTION(WITH_LIBVR "With LibVR support" OFF) OPTION(WITH_PERFHUD "With NVIDIA PerfHUD support" OFF) - + OPTION(WITH_SSE2 "With SSE2" ON ) OPTION(WITH_SSE3 "With SSE3" ON ) - + IF(NOT MSVC) OPTION(WITH_GCC_FPMATH_BOTH "With GCC -mfpmath=both" OFF) ENDIF(NOT MSVC) @@ -401,7 +402,7 @@ MACRO(NL_SETUP_BUILD) ELSEIF(HOST_CPU MATCHES "i.86") SET(HOST_CPU "x86") ENDIF(HOST_CPU MATCHES "(amd|AMD)64") - + # Determine target CPU # If not specified, use the same CPU as host @@ -1111,7 +1112,7 @@ MACRO(SETUP_EXTERNAL) ENDIF(APPLE) ENDIF(WIN32) - # Android and iOS have pthread + # Android and iOS have pthread IF(ANDROID OR IOS) SET(CMAKE_USE_PTHREADS_INIT 1) SET(Threads_FOUND TRUE) diff --git a/code/tool/bin2c/bin2c.cpp b/code/tool/bin2c/bin2c.cpp index 7f8538d9b..116fe3433 100644 --- a/code/tool/bin2c/bin2c.cpp +++ b/code/tool/bin2c/bin2c.cpp @@ -21,6 +21,8 @@ #include #include +#define max(a, b) ((a) > (b) ? (a) : (b)) + int main(int argc, char* argv[]) { if (argc<2) @@ -29,23 +31,36 @@ int main(int argc, char* argv[]) } else { - char sDir[256]; - char sPath[256]; - char sName[256]; - char sExt[256]; - _splitpath (argv[1], sDir, sPath, sName, sExt); - char sOutput[256]; - if (argc>2) - strcpy (sOutput, argv[2]); + char *cExt = strrchr(argv[1], '.'); + char *cName = max(strrchr(argv[1], '/'), strrchr(argv[1], '\\')) + 1; + char sName[256]; + strcpy(sName, cName); + if (cExt > cName) + { + sName[cExt - cName] = '\x00'; + } + if (argc > 2) + { + strcpy(sOutput, argv[2]); + } else { - _makepath (sOutput, sDir, sPath, sName, ".cpp"); + strcpy(sOutput, argv[1]); + if (cExt <= cName) + { + cExt = sOutput + strlen(sOutput); + cExt[0] = '.'; + } + cExt[1] = 'c'; + cExt[2] = '\x00'; } FILE *pIn=fopen( argv[1], "rb"); if (pIn==NULL) + { printf ("Can't open %s.", argv[1]); + } else { FILE *pOut=fopen( sOutput, "w"); @@ -53,7 +68,7 @@ int main(int argc, char* argv[]) printf ("Can't open %s.", sOutput); else { - fprintf (pOut, + fprintf (pOut, "/**\n" " * Generated by bin2c.exe\n" " * binfile: %s\n" @@ -61,7 +76,7 @@ int main(int argc, char* argv[]) "\n" "extern const unsigned char %s[];\n" "extern const unsigned int %sSize;\n\n" - "static const unsigned char %s[] =\n" + "const unsigned char %s[] =\n" "{\n", argv[1], sName, sName, sName); unsigned int size=0; @@ -82,14 +97,14 @@ int main(int argc, char* argv[]) break; } fprintf (pOut, "};\n\n"); - - fprintf (pOut, "static const unsigned int %sSize = %d;\n\n", sName, size); + + fprintf (pOut, "const unsigned int %sSize = %d;\n\n", sName, size); fclose (pOut); fclose (pIn); } } } - + return 0; }