From 3c8cc59c40509f7a1476bd9092e30da3365c58c6 Mon Sep 17 00:00:00 2001 From: Ladislav Zezula Date: Sun, 6 Nov 2016 14:27:57 +0100 Subject: + Public include directories moved to "include" directory --- CMakeLists.txt | 75 ++++++++++++------------- StormLib.bat | 4 +- StormLib_dll.vcproj | 4 ++ StormLib_test.vcproj | 8 +-- StormLib_vs08.vcproj | 16 ++++++ src/SBaseDumpData.cpp | 2 +- src/adpcm/adpcm.cpp | 3 +- src/huffman/huff.cpp | 1 - src/libtomcrypt/src/headers/tomcrypt.h | 4 ++ src/libtomcrypt/src/pk/asn1/der_encode_setof.c | 2 +- src/pklib/pklib.h | 2 - src/sparse/sparse.h | 2 - storm_dll/Storm_dll.vcproj | 4 -- storm_dll/storm.dll | Bin 334312 -> 0 bytes storm_dll/storm.lib | Bin 5238 -> 5238 bytes storm_dll/storm_test.cpp | 2 - test/StormTest.cpp | 18 +++--- 17 files changed, 81 insertions(+), 66 deletions(-) delete mode 100644 storm_dll/storm.dll diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b1ac0b..67db717 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,8 @@ project(StormLib) cmake_minimum_required(VERSION 2.6) +include_directories(include) + set(LIBRARY_NAME storm) set(SRC_FILES @@ -301,16 +303,16 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL Linux) endif() endif() -option(BUILD_SHARED_LIBS "Compile shared libraries" OFF) - -add_library(${LIBRARY_NAME} ${SRC_FILES} ${SRC_ADDITIONAL_FILES}) -target_link_libraries(${LIBRARY_NAME} ${LINK_LIBS}) -target_compile_definitions(${LIBRARY_NAME} PUBLIC -D__STORMLIB_NO_AUTO_LINK__) #CMake should take care of the linking -target_include_directories(${LIBRARY_NAME} PUBLIC include/) -set_target_properties(${LIBRARY_NAME} PROPERTIES PUBLIC_HEADER "include/StormLib.h;include/StormPort.h") -if(BUILD_SHARED_LIBS) +option(WITH_STATIC "Compile static linked library" OFF) +if(WITH_STATIC) + add_library(${LIBRARY_NAME} STATIC ${SRC_FILES} ${SRC_ADDITIONAL_FILES}) + target_link_libraries(${LIBRARY_NAME} ${LINK_LIBS}) +else() + add_library(${LIBRARY_NAME} SHARED ${SRC_FILES} ${SRC_ADDITIONAL_FILES}) + target_link_libraries(${LIBRARY_NAME} ${LINK_LIBS}) if(APPLE) set_target_properties(${LIBRARY_NAME} PROPERTIES FRAMEWORK true) + set_target_properties(${LIBRARY_NAME} PROPERTIES PUBLIC_HEADER "include/StormLib.h include/StormPort.h") set_target_properties(${LIBRARY_NAME} PROPERTIES LINK_FLAGS "-framework Carbon") endif() if(UNIX) @@ -326,42 +328,37 @@ if(BUILD_SHARED_LIBS) if(WIN32) set_target_properties(${LIBRARY_NAME} PROPERTIES OUTPUT_NAME StormLib) endif() -endif() -install(TARGETS ${LIBRARY_NAME} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - FRAMEWORK DESTINATION /Library/Frameworks - PUBLIC_HEADER DESTINATION include - INCLUDES DESTINATION include) -#CPack configurtion -SET(CPACK_GENERATOR "DEB" "RPM") -SET(CPACK_PACKAGE_NAME ${PROJECT_NAME}) -SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MPQ manipulation library") -SET(CPACK_PACKAGE_VENDOR "Ladislav Zezula") -SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README") -SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") -SET(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}") -SET(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}") -SET(CPACK_PACKAGE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}") + install(TARGETS ${LIBRARY_NAME} RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib FRAMEWORK DESTINATION /Library/Frameworks) -#DEB configuration -SET(CPACK_DEBIAN_PACKAGE_SECTION "libs") -SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://www.zezula.net/en/mpq/stormlib.html") -SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "imbacen@gmail.com") -SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64") -SET(CPACK_DEBIAN_PACKAGE_DEPENDS "zlib1g,bzip2") + #CPack configurtion + SET(CPACK_GENERATOR "DEB" "RPM") + SET(CPACK_PACKAGE_NAME ${PROJECT_NAME}) + SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MPQ manipulation library") + SET(CPACK_PACKAGE_VENDOR "Ladislav Zezula") + SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README") + SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") + SET(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}") + SET(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}") + SET(CPACK_PACKAGE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}") -#RPM configuration -SET(CPACK_RPM_PACKAGE_RELEASE 1) -SET(CPACK_RPM_PACKAGE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") -SET(CPACK_RPM_PACKAGE_GROUP "${PROJECT_NAME}") -SET(CPACK_RPM_PACKAGE_URL "http://www.zezula.net/en/mpq/stormlib.html") -SET(CPACK_RPM_PACKAGE_REQUIRES "zlib,bzip2") + #DEB configuration + SET(CPACK_DEBIAN_PACKAGE_SECTION "libs") + SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://www.zezula.net/en/mpq/stormlib.html") + SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "imbacen@gmail.com") + SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64") + SET(CPACK_DEBIAN_PACKAGE_DEPENDS "zlib1g,bzip2") -INCLUDE(CPack) + #RPM configuration + SET(CPACK_RPM_PACKAGE_RELEASE 1) + SET(CPACK_RPM_PACKAGE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") + SET(CPACK_RPM_PACKAGE_GROUP "${PROJECT_NAME}") + SET(CPACK_RPM_PACKAGE_URL "http://www.zezula.net/en/mpq/stormlib.html") + SET(CPACK_RPM_PACKAGE_REQUIRES "zlib,bzip2") + INCLUDE(CPack) + +endif() option(WITH_TEST "Compile Test application" OFF) if(WITH_TEST) diff --git a/StormLib.bat b/StormLib.bat index d675eac..5c25fa4 100644 --- a/StormLib.bat +++ b/StormLib.bat @@ -5,8 +5,8 @@ rem Example: StormLib.bat x64 Debug if not exist ..\aaa goto exit -copy src\StormPort.h ..\aaa\inc -copy src\StormLib.h ..\aaa\inc +copy include\StormPort.h ..\aaa\inc +copy include\StormLib.h ..\aaa\inc if x%1 == xWin32 goto PlatformWin32 if x%1 == xx64 goto PlatformWin64 diff --git a/StormLib_dll.vcproj b/StormLib_dll.vcproj index 0b8d247..f6c9a76 100644 --- a/StormLib_dll.vcproj +++ b/StormLib_dll.vcproj @@ -44,6 +44,7 @@ #include "StormCommon.h" diff --git a/src/adpcm/adpcm.cpp b/src/adpcm/adpcm.cpp index 7c6f48a..e551bda 100644 --- a/src/adpcm/adpcm.cpp +++ b/src/adpcm/adpcm.cpp @@ -13,7 +13,8 @@ /* 10.01.13 3.00 Lad Refactored, beautified, documented :-) */ /*****************************************************************************/ -#include +#include + #include "adpcm.h" //----------------------------------------------------------------------------- diff --git a/src/huffman/huff.cpp b/src/huffman/huff.cpp index d2552a0..877a294 100644 --- a/src/huffman/huff.cpp +++ b/src/huffman/huff.cpp @@ -19,7 +19,6 @@ #include #include -#include #include "huff.h" //----------------------------------------------------------------------------- diff --git a/src/libtomcrypt/src/headers/tomcrypt.h b/src/libtomcrypt/src/headers/tomcrypt.h index 74cdff4..7df3f5a 100644 --- a/src/libtomcrypt/src/headers/tomcrypt.h +++ b/src/libtomcrypt/src/headers/tomcrypt.h @@ -25,6 +25,10 @@ extern "C" { /* descriptor table size */ #define TAB_SIZE 32 +#ifdef _MSC_VER +#pragma warning(disable: 4333) // der_encode_utf8_string.c(91) : warning C4333: '>>' : right shift by too large amount, data loss +#endif + /* error codes [will be expanded in future releases] */ enum { CRYPT_OK=0, /* Result OK */ diff --git a/src/libtomcrypt/src/pk/asn1/der_encode_setof.c b/src/libtomcrypt/src/pk/asn1/der_encode_setof.c index ad7b0f6..b4e97b5 100644 --- a/src/libtomcrypt/src/pk/asn1/der_encode_setof.c +++ b/src/libtomcrypt/src/pk/asn1/der_encode_setof.c @@ -102,7 +102,7 @@ int der_encode_setof(ltc_asn1_list *list, unsigned long inlen, } /* get the size of the static header */ - hdrlen = ((unsigned long)ptr) - ((unsigned long)buf); + hdrlen = (unsigned long)((size_t)ptr - (size_t)buf); /* scan for edges */ diff --git a/src/pklib/pklib.h b/src/pklib/pklib.h index 56508f1..9eb2915 100644 --- a/src/pklib/pklib.h +++ b/src/pklib/pklib.h @@ -11,8 +11,6 @@ #ifndef __PKLIB_H__ #define __PKLIB_H__ -#include - //----------------------------------------------------------------------------- // Defines diff --git a/src/sparse/sparse.h b/src/sparse/sparse.h index eb996e1..12f62b5 100644 --- a/src/sparse/sparse.h +++ b/src/sparse/sparse.h @@ -11,8 +11,6 @@ #ifndef __SPARSE_H__ #define __SPARSE_H__ -#include - void CompressSparse(void * pvOutBuffer, int * pcbOutBuffer, void * pvInBuffer, int cbInBuffer); int DecompressSparse(void * pvOutBuffer, int * pcbOutBuffer, void * pvInBuffer, int cbInBuffer); diff --git a/storm_dll/Storm_dll.vcproj b/storm_dll/Storm_dll.vcproj index da9a11d..6b123ff 100644 --- a/storm_dll/Storm_dll.vcproj +++ b/storm_dll/Storm_dll.vcproj @@ -94,7 +94,6 @@ /> diff --git a/storm_dll/storm.dll b/storm_dll/storm.dll deleted file mode 100644 index e35fc12..0000000 Binary files a/storm_dll/storm.dll and /dev/null differ diff --git a/storm_dll/storm.lib b/storm_dll/storm.lib index 64d3561..ce5f3f4 100644 Binary files a/storm_dll/storm.lib and b/storm_dll/storm.lib differ diff --git a/storm_dll/storm_test.cpp b/storm_dll/storm_test.cpp index 2d1e6bc..b72d589 100644 --- a/storm_dll/storm_test.cpp +++ b/storm_dll/storm_test.cpp @@ -30,8 +30,6 @@ int main() BYTE Buffer[0x100]; DWORD dwBytesRead = 0; - _asm int 3; - if(StormOpenArchive(szArchiveName, 0, 0, &hMpq)) { if(StormOpenFileEx(hMpq, "war3map.j", 0, &hFile)) diff --git a/test/StormTest.cpp b/test/StormTest.cpp index 2cb86a6..a5290a4 100644 --- a/test/StormTest.cpp +++ b/test/StormTest.cpp @@ -11,14 +11,14 @@ #define _CRT_NON_CONFORMING_SWPRINTFS #define _CRT_SECURE_NO_DEPRECATE #define __INCLUDE_CRYPTOGRAPHY__ -#define __STORMLIB_SELF__ // Don't use StormLib.lib +#define __STORMLIB_NO_AUTO_LINK__ // Don't use StormLib.lib #include #ifdef _MSC_VER #include #endif -#include "../src/StormLib.h" +#include "../include/StormLib.h" #include "../src/StormCommon.h" #include "TLogHelper.cpp" // Helper class for showing test results @@ -4482,8 +4482,8 @@ int main(int argc, char * argv[]) if(nError == ERROR_SUCCESS) nError = TestOpenArchive("part-file://MPQ_2010_v2_HashTableCompressed.MPQ.part"); */ - if(nError == ERROR_SUCCESS) - nError = TestOpenArchive_ProtectedMap("MPQ_2002_v1_ProtectedMap_HashTable_FakeValid.w3x", NULL, 114, "5250975ed917375fc6540d7be436d4de"); +// if(nError == ERROR_SUCCESS) +// nError = TestOpenArchive_ProtectedMap("MPQ_2002_v1_ProtectedMap_HashTable_FakeValid.w3x", NULL, 114, "5250975ed917375fc6540d7be436d4de"); /* if(nError == ERROR_SUCCESS) nError = TestOpenArchive("MPQ_2002_v1_ProtectedMap_InvalidUserData.w3x"); @@ -4522,8 +4522,8 @@ int main(int argc, char * argv[]) nError = TestOpenArchive("MPQ_2015_v1_MessListFile.mpq"); */ // Open an protected map - if(nError == ERROR_SUCCESS) - nError = TestOpenArchive_ProtectedMap("MPQ_2015_v1_flem1.w3x", NULL, 20, "1c4c13e627658c473e84d94371e31f37"); +// if(nError == ERROR_SUCCESS) +// nError = TestOpenArchive_ProtectedMap("MPQ_2015_v1_flem1.w3x", NULL, 20, "1c4c13e627658c473e84d94371e31f37"); /* // Open another protected map if(nError == ERROR_SUCCESS) @@ -4550,8 +4550,12 @@ int main(int argc, char * argv[]) if(nError == ERROR_SUCCESS) nError = TestOpenArchive("MPQ_2016_v1_KoreanFile.w3m"); */ +// if(nError == ERROR_SUCCESS) +// nError = TestOpenArchive_ProtectedMap("MPQ_2016_v1_ProtectedMap123.w3x", NULL, 17, "23b09ad3b8d89ec97df8860447abc7eb"); + if(nError == ERROR_SUCCESS) - nError = TestOpenArchive_ProtectedMap("MPQ_2016_v1_ProtectedMap123.w3x", NULL, 17, "23b09ad3b8d89ec97df8860447abc7eb"); + nError = TestOpenArchive_ProtectedMap("MPQ_2016_v1_UnableToOpen.w3x", NULL, 17, "23b09ad3b8d89ec97df8860447abc7eb"); + /* // Open the multi-file archive with wrong prefix to see how StormLib deals with it if(nError == ERROR_SUCCESS) -- cgit v1.2.3