From c8e656de34ed61710ef3c3741aa0705239c893ab Mon Sep 17 00:00:00 2001 From: cen1 Date: Sat, 24 Feb 2024 20:40:08 +0100 Subject: [PATCH 01/19] clang tidy fixes --- .clang-tidy | 49 ++++++++++++++++++++++++++++++++ .github/workflows/cmake.yml | 2 +- CMakeLists.txt | 3 ++ src/bncsutil/buffer.h | 5 ++++ src/bncsutil/cdkeydecoder.cpp | 1 - src/bncsutil/cdkeydecoder.h | 2 +- src/bncsutil/checkrevision.cpp | 2 +- src/bncsutil/decodekey.cpp | 52 ++++++++++++++++------------------ src/bncsutil/file.cpp | 18 ++++++------ src/bncsutil/file.h | 6 ++-- src/bncsutil/mutil.h | 6 +++- src/bncsutil/mutil_types.h | 4 +++ src/bncsutil/nls.c | 7 ++--- src/bncsutil/pe.h | 4 +++ src/bncsutil/sha1.c | 4 +-- 15 files changed, 113 insertions(+), 52 deletions(-) create mode 100644 .clang-tidy diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000..3adc292 --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,49 @@ +Checks: ' + bugprone-* + ,cert-* + ,cppcoreguidelines-* + ,modernize-* + ,performance-* + ,readability-* + ,portability-* + ,clang-analyzer-unix + ,clang-analyzer-security + ,clang-analyzer-deadcode + ,clang-analyzer-core + ,clang-analyzer-cplusplus + ,clang-analyzer-optin + ,llvm-namespace-comment + ,readability-static-accessed-through-instance + ,misc-const-correctness + ,-bugprone-reserved-identifier + ,-bugprone-implicit-widening-of-multiplication-result + ,-bugprone-easily-swappable-parameters + ,-bugprone-narrowing-conversions + ,-cert-dcl37-c + ,-cert-dcl51-cpp + ,-cert-msc32-c + ,-cert-msc51-cpp + ,-cert-msc30-c + ,-cert-msc50-cpp + ,-modernize-use-trailing-return-type + ,-modernize-macro-to-enum + ,-modernize-use-nullptr + ,-modernize-use-using + ,-modernize-avoid-c-arrays + ,-modernize-use-auto + ,-readability-avoid-unconditional-preprocessor-if + ,-readability-identifier-length + ,-readability-isolate-declaration + ,-readability-magic-numbers + ,-readability-braces-around-statements + ,-readability-function-cognitive-complexity + ,-cppcoreguidelines-macro-to-enum + ,-cppcoreguidelines-macro-usage + ,-cppcoreguidelines-pro-bounds-pointer-arithmetic + ,-cppcoreguidelines-pro-type-cstyle-cast + ,-cppcoreguidelines-init-variables + ,-cppcoreguidelines-avoid-magic-numbers + ,-cppcoreguidelines-pro-bounds-array-to-pointer-decay + ,-cppcoreguidelines-avoid-c-arrays + ,-cppcoreguidelines-narrowing-conversions +' \ No newline at end of file diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index ae32662..9e081d6 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -1,6 +1,6 @@ name: CMake -on: [push] +on: [push, pull_request] env: BUILD_TYPE: Release diff --git a/CMakeLists.txt b/CMakeLists.txt index 5815a4c..0199cce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,8 +37,11 @@ set(SOURCES "src/bncsutil/decodekey.cpp" "src/bncsutil/file.cpp" "src/bncsutil/libinfo.cpp" + "src/bncsutil/nls.c" "src/bncsutil/oldauth.cpp" + "src/bncsutil/pe.c" "src/bncsutil/sha1.c" + "src/bncsutil/stack.c" ) target_sources(bncsutil PRIVATE ${SOURCES} ${HEADERS}) diff --git a/src/bncsutil/buffer.h b/src/bncsutil/buffer.h index 4f5709c..c53b0f3 100644 --- a/src/bncsutil/buffer.h +++ b/src/bncsutil/buffer.h @@ -23,6 +23,9 @@ * Boston, MA 02111-1307 USA */ +#ifndef BUFFER_H +#define BUFFER_H + #include typedef struct msg_buffer *msg_buffer_t; @@ -69,3 +72,5 @@ void buffer_add_32(msg_buffer_t, int32_t); void buffer_add_u32(msg_buffer_t, uint32_t); msg_reader_t create_reader(size_t initial_size); + +#endif diff --git a/src/bncsutil/cdkeydecoder.cpp b/src/bncsutil/cdkeydecoder.cpp index 4573a97..aab52a5 100644 --- a/src/bncsutil/cdkeydecoder.cpp +++ b/src/bncsutil/cdkeydecoder.cpp @@ -31,7 +31,6 @@ #include // for isdigit(), isalnum(), and toupper() #include // for memcpy() #include // for sscanf() -// #include /** * Implementation-specific CD-key hash structure. diff --git a/src/bncsutil/cdkeydecoder.h b/src/bncsutil/cdkeydecoder.h index 0f845f1..424a62a 100644 --- a/src/bncsutil/cdkeydecoder.h +++ b/src/bncsutil/cdkeydecoder.h @@ -59,7 +59,7 @@ MCEXP(CDKeyDecoder) { inline char getHexValue(int v); inline int getNumValue(char v); - inline void mult(const int r, const int x, int* a, int dcByte); + inline void mult(int r, int x, int* a, int dcByte); public: /** diff --git a/src/bncsutil/checkrevision.cpp b/src/bncsutil/checkrevision.cpp index 7d360e2..2097ce9 100644 --- a/src/bncsutil/checkrevision.cpp +++ b/src/bncsutil/checkrevision.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include #endif #ifndef HIWORD diff --git a/src/bncsutil/decodekey.cpp b/src/bncsutil/decodekey.cpp index c38276e..9c89a4b 100644 --- a/src/bncsutil/decodekey.cpp +++ b/src/bncsutil/decodekey.cpp @@ -35,11 +35,9 @@ #include #else #include - #include - #include + #include #endif -#include -#include +#include #ifdef __cplusplus extern "C" { @@ -117,14 +115,14 @@ MEXP(int) kd_quick(const char* cd_key, uint32_t client_token, CDKeyDecoder kd(cd_key, strlen(cd_key)); size_t hash_len; - if (!kd.isKeyValid()) + if (kd.isKeyValid() == 0) return 0; *public_value = kd.getVal1(); *product = kd.getProduct(); hash_len = kd.calculateHash(client_token, server_token); - if (!hash_len || hash_len > buffer_len) + if ((hash_len == 0U) || hash_len > buffer_len) return 0; kd.getHash(hash_buffer); @@ -143,7 +141,7 @@ MEXP(int) kd_init() { return 0;*/ InitializeCriticalSection(&kd_control); #else - if (pthread_mutex_init(&mutex, NULL)) + if (pthread_mutex_init(&mutex, NULL) != 0) return 0; #endif numDecoders = 0; @@ -183,18 +181,18 @@ unsigned int kd_findAvailable() { return i; } -MEXP(int) kd_create(const char* cdkey, int keyLength) { +MEXP(int) kd_create(const char* cdkey, const int keyLength) { unsigned int i; CDKeyDecoder** d; static int dcs_initialized = 0; - if (!dcs_initialized) { - if (!kd_init()) + if (dcs_initialized == 0) { + if (kd_init() == 0) return -1; dcs_initialized = 1; } - if (!kd_lock_decoders()) return -1; + if (kd_lock_decoders() == 0) return -1; i = kd_findAvailable(); if (i == (unsigned int) -1) @@ -246,10 +244,10 @@ MEXP(int) kd_create(char* cdkey, int keyLength) { return (int) i; }*/ -MEXP(int) kd_free(int decoder) { +MEXP(int) kd_free(const int decoder) { CDKeyDecoder* d; - if (!kd_lock_decoders()) return 0; + if (kd_lock_decoders() == 0) return 0; if ((unsigned int) decoder >= sizeDecoders) return 0; @@ -269,7 +267,7 @@ MEXP(int) kd_val2Length(int decoder) { CDKeyDecoder* d; int value; - if (!kd_lock_decoders()) return -1; + if (kd_lock_decoders() == 0) return -1; if ((unsigned int) decoder >= sizeDecoders) return -1; @@ -288,7 +286,7 @@ MEXP(int) kd_product(int decoder) { CDKeyDecoder* d; int value; - if (!kd_lock_decoders()) return -1; + if (kd_lock_decoders() == 0) return -1; if ((unsigned int) decoder >= sizeDecoders) return -1; @@ -303,11 +301,11 @@ MEXP(int) kd_product(int decoder) { return value; } -MEXP(int) kd_val1(int decoder) { +MEXP(int) kd_val1(const int decoder) { CDKeyDecoder* d; int value; - if (!kd_lock_decoders()) return -1; + if (kd_lock_decoders() == 0) return -1; if ((unsigned int) decoder >= sizeDecoders) return -1; @@ -326,7 +324,7 @@ MEXP(int) kd_val2(int decoder) { CDKeyDecoder* d; int value; - if (!kd_lock_decoders()) return -1; + if (kd_lock_decoders() == 0) return -1; if ((unsigned int) decoder >= sizeDecoders) return -1; @@ -341,11 +339,11 @@ MEXP(int) kd_val2(int decoder) { return value; } -MEXP(int) kd_longVal2(int decoder, char* out) { +MEXP(int) kd_longVal2(const int decoder, char* out) { CDKeyDecoder* d; int value; - if (!kd_lock_decoders()) return -1; + if (kd_lock_decoders() == 0) return -1; if ((unsigned int) decoder >= sizeDecoders) return -1; @@ -360,13 +358,13 @@ MEXP(int) kd_longVal2(int decoder, char* out) { return value; } -MEXP(int) kd_calculateHash(int decoder, uint32_t clientToken, - uint32_t serverToken) +MEXP(int) kd_calculateHash(const int decoder, const uint32_t clientToken, + const uint32_t serverToken) { CDKeyDecoder* d; int value; - if (!kd_lock_decoders()) return -1; + if (kd_lock_decoders() == 0) return -1; if ((unsigned int) decoder >= sizeDecoders) return -1; @@ -381,11 +379,11 @@ MEXP(int) kd_calculateHash(int decoder, uint32_t clientToken, return value; } -MEXP(int) kd_getHash(int decoder, char* out) { +MEXP(int) kd_getHash(const int decoder, char* out) { CDKeyDecoder* d; int value; - if (!kd_lock_decoders()) return -1; + if (kd_lock_decoders() == 0) return -1; if ((unsigned int) decoder >= sizeDecoders) return -1; @@ -400,11 +398,11 @@ MEXP(int) kd_getHash(int decoder, char* out) { return value; } -MEXP(int) kd_isValid(int decoder) { +MEXP(int) kd_isValid(const int decoder) { CDKeyDecoder* d; int value; - if (!kd_lock_decoders()) return -1; + if (kd_lock_decoders() == 0) return -1; if ((unsigned int) decoder >= sizeDecoders) return -1; diff --git a/src/bncsutil/file.cpp b/src/bncsutil/file.cpp index bced9af..bf73482 100644 --- a/src/bncsutil/file.cpp +++ b/src/bncsutil/file.cpp @@ -11,8 +11,8 @@ typedef std::map mapping_map; #else #define BWIN 0 -#include -#include +#include +#include #include typedef std::map mapping_map; @@ -29,8 +29,6 @@ struct _file mapping_map mappings; }; -#include - #ifdef __cplusplus extern "C" { #endif @@ -184,7 +182,7 @@ void file_unmap(file_t file, const void* base) #else -file_t file_open(const char* filename, unsigned int mode_flags) +file_t file_open(const char* filename, const unsigned int mode_flags) { char mode[] = "rb"; file_t data; @@ -265,9 +263,9 @@ size_t file_size(file_t file) return size_of_file; } -void* file_map(file_t file, size_t len, off_t offset) +void* file_map(file_t file, const size_t len, const off_t offset) { - int fd = fileno(file->f); + const int fd = fileno(file->f); void* base = mmap((void*) 0, len, PROT_READ, MAP_SHARED, fd, offset); //const char* err; @@ -283,9 +281,9 @@ void* file_map(file_t file, size_t len, off_t offset) return base; } -void file_unmap(file_t file, const void* base) +void file_unmap(file_t file, const void* mapping) { - mapping_map::iterator item = file->mappings.find(base); + mapping_map::iterator item = file->mappings.find(mapping); size_t len; if (item == file->mappings.end()) { @@ -295,7 +293,7 @@ void file_unmap(file_t file, const void* base) len = (*item).second; - munmap((void*) base, len); + munmap((void*) mapping, len); file->mappings.erase(item); } diff --git a/src/bncsutil/file.h b/src/bncsutil/file.h index 3ff4bbd..8e45279 100644 --- a/src/bncsutil/file.h +++ b/src/bncsutil/file.h @@ -26,8 +26,6 @@ #ifndef _FILE_H_INCLUDED_ #define _FILE_H_INCLUDED_ 1 -#include - #ifdef MOS_WINDOWS typedef long off_t; #else @@ -45,7 +43,7 @@ typedef struct _file* file_t; #define FILE_WRITE (0x02) -file_t file_open(const char* filename, unsigned int mode); +file_t file_open(const char* filename, unsigned int mode_flags); void file_close(file_t file); size_t file_read(file_t file, void* ptr, size_t size, size_t count); size_t file_write(file_t file, const void* ptr, size_t size, @@ -59,4 +57,4 @@ void file_unmap(file_t file, const void* mapping); } #endif -#endif /* FILE */ +#endif /* _FILE_H_INCLUDED_ */ diff --git a/src/bncsutil/mutil.h b/src/bncsutil/mutil.h index 5cb5c59..b513d6c 100644 --- a/src/bncsutil/mutil.h +++ b/src/bncsutil/mutil.h @@ -36,7 +36,11 @@ /* Specific-Sized Integers */ #include "mutil_types.h" -#include +#ifdef __cplusplus +#include +#else +#include +#endif // functions for converting a string to a 64-bit number. #if defined(_MSC_VER) diff --git a/src/bncsutil/mutil_types.h b/src/bncsutil/mutil_types.h index e739799..0a3e6c4 100644 --- a/src/bncsutil/mutil_types.h +++ b/src/bncsutil/mutil_types.h @@ -29,7 +29,11 @@ #if defined(_MSC_VER) && (defined(HAVE_STDINT_H) && !HAVE_STDINT_H) #include "ms_stdint.h" #else +#ifdef __cplusplus +#include +#else #include #endif +#endif #endif /* BNCSUTIL_MUTIL_TYPES_H_INCLUDED */ diff --git a/src/bncsutil/nls.c b/src/bncsutil/nls.c index 7e5148b..c6c4e99 100644 --- a/src/bncsutil/nls.c +++ b/src/bncsutil/nls.c @@ -90,7 +90,7 @@ const char bncsutil_NLS_sig_n[] = { unsigned long nls_pre_seed(); -void nls_get_x(nls_t* nls, mpz_t x_c, const char* raw_salt); +void nls_get_x(const nls_t* nls, mpz_t x_c, const char* raw_salt); void nls_get_v_mpz(nls_t* nls, mpz_t v, mpz_t x); @@ -507,8 +507,7 @@ MEXP(void) nls_get_M1(nls_t* nls, char* out, const char* B, const char* salt) { } MEXP(int) nls_check_M2(nls_t* nls, const char* var_M2, const char* B, - const char* salt) -{ + const char* salt) { SHA1Context sha; char local_M2[20]; char* A; @@ -674,7 +673,7 @@ unsigned long nls_pre_seed() { #endif } -void nls_get_x(nls_t* nls, mpz_t x_c, const char* raw_salt) { +void nls_get_x(const nls_t* nls, mpz_t x_c, const char* raw_salt) { char* userpass; uint8_t hash[20], final_hash[20]; SHA1Context shac; diff --git a/src/bncsutil/pe.h b/src/bncsutil/pe.h index 1795a10..8742124 100644 --- a/src/bncsutil/pe.h +++ b/src/bncsutil/pe.h @@ -27,7 +27,11 @@ #define CM_PE_H_INCLUDED 1 #include "mutil.h" +#ifdef __cplusplus +#include +#else #include +#endif #ifdef __cplusplus extern "C" { diff --git a/src/bncsutil/sha1.c b/src/bncsutil/sha1.c index b639c36..ba9353b 100644 --- a/src/bncsutil/sha1.c +++ b/src/bncsutil/sha1.c @@ -38,8 +38,8 @@ (((word) << (bits)) | ((word) >> (32-(bits)))) /* Local Function Prototyptes */ -void SHA1PadMessage(SHA1Context *); -void SHA1ProcessMessageBlock(SHA1Context *); +void SHA1PadMessage(SHA1Context * /*context*/); +void SHA1ProcessMessageBlock(SHA1Context * /*context*/); /* * SHA1Reset From 83825f3c051bfcf2281cf82c5f48d85c66ba50bf Mon Sep 17 00:00:00 2001 From: cen1 Date: Sat, 24 Feb 2024 15:27:40 +0100 Subject: [PATCH 02/19] fix destination param --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1c9a27c..51e3a70 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -98,7 +98,7 @@ jobs: - name: Create archive working-directory: ./build - run: Compress-Archive -Path Release/* -Destination bncsutil_${{ github.ref_name }}_amd64_dll.zip + run: Compress-Archive -Path Release/* -DestinationPath bncsutil_${{ github.ref_name }}_amd64_dll.zip - uses: actions/upload-artifact@v4 with: From e26067cb9c3770d3d02e7100132447b202710b40 Mon Sep 17 00:00:00 2001 From: cen1 Date: Sat, 24 Feb 2024 16:05:14 +0100 Subject: [PATCH 03/19] change package install path --- CMakeLists.txt | 6 +++++- README.md | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0199cce..2dac25b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -105,11 +105,15 @@ SET(CPACK_GENERATOR "DEB" "RPM") SET(CPACK_PACKAGE_NAME "bncsutil") SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Battle.Net Chat Service Utility") SET(CPACK_PACKAGE_VENDOR "bncsutil") -SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md") +SET(CPACK_PACKAGE_DESCRIPTION "\ +This will install the library to /usr/local/lib and header files to /usr/local/include. \ +Make sure these directories are in your library and include paths. \ +") SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING") SET(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}") SET(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}") SET(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}") +set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local") #DEB configuration SET(CPACK_DEBIAN_PACKAGE_SECTION "libs") diff --git a/README.md b/README.md index 262a4a4..9966bed 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ BNCSUtil was originally written by Eric Naeseth (shadypalm88) and has since been maintained over the course of several years by the open source Battle.net community. # Usage -Add `bncsutil.h` to your include directory and link against `bncsutil.lib` or `libbncsutil.so`. +`#include ` and link against `bncsutil.lib` or `libbncsutil.so`. # Building @@ -67,8 +67,8 @@ cmake --build . --target install --config Release After invoking CMake, cd to build folder and generate them with `cpack -G "DEB"` and `cpack -G "RPM"`. You can then use `gdebi` to do a local install of .deb with automatic dependency resolution or `yum localinstall` on rpm distros. For dnf it's `dnf install .rpm`. -Note that this is a "devel" package which also includes header files. +Note that this is a "development" package which also includes header files. -Library installs to `/usr/lib`, include files in `/usr/include/bncsutil`. +Library installs to `/usr/local/lib`, include files in `/usr/local/include/bncsutil`. Packages are also available for download from github releases built on Debian Bookworm and Fedora latest. From 1005d32700485942153ace094fb1e6d9e80f78da Mon Sep 17 00:00:00 2001 From: cen1 Date: Sat, 24 Feb 2024 21:37:52 +0100 Subject: [PATCH 04/19] add 32bit windows build --- .github/workflows/release.yml | 48 +++++++++++++++++++++++++++++++++-- CMakeLists.txt | 2 +- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 51e3a70..222d56f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -69,7 +69,7 @@ jobs: name: libbncsutil-devel-${{ github.ref_name }}.x86_64.rpm path: build/libbncsutil-devel-${{ github.ref_name }}.x86_64.rpm - dll: + dll_amd64: if: true runs-on: windows-latest @@ -106,6 +106,44 @@ jobs: overwrite: true name: bncsutil_${{ github.ref_name }}_amd64_dll.zip path: build/bncsutil_${{ github.ref_name }}_amd64_dll.zip + + dll_x86: + if: true + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + + - uses: TheMrMilchmann/setup-msvc-dev@v3 + with: + arch: x86 + + - name: Install Conan + id: conan + uses: turtlebrowser/get-conan@main + + - name: Init conan + run: conan profile detect + + - name: Install dependencies + shell: cmd + run: conan install . -of build -s build_type=Release -o *:shared=False --build=missing + + - name: Build + shell: cmd + working-directory: ./build + run: .\conanbuild.bat && cmake .. -G "Visual Studio 17 2022" -DCMAKE_GENERATOR_PLATFORM=x86 -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DBUILD_SHARED_LIBS=1 && cmake --build . --config Release + + - name: Create archive + working-directory: ./build + run: Compress-Archive -Path Release/* -DestinationPath bncsutil_${{ github.ref_name }}_x86_dll.zip + + - uses: actions/upload-artifact@v4 + with: + retention-days: 1 + overwrite: true + name: bncsutil_${{ github.ref_name }}_x86_dll.zip + path: build/bncsutil_${{ github.ref_name }}_x86_dll.zip release: @@ -123,10 +161,15 @@ jobs: with: name: libbncsutil-devel-${{ github.ref_name }}.x86_64.rpm - - name: Download dll + - name: Download dll amd64 uses: actions/download-artifact@v4 with: name: bncsutil_${{ github.ref_name }}_amd64_dll.zip + + - name: Download dll x86 + uses: actions/download-artifact@v4 + with: + name: bncsutil_${{ github.ref_name }}_x86_dll.zip - name: Create GitHub Release uses: softprops/action-gh-release@v1 @@ -135,6 +178,7 @@ jobs: libbncsutil-dev_${{ github.ref_name }}_amd64.deb libbncsutil-devel-${{ github.ref_name }}.x86_64.rpm bncsutil_${{ github.ref_name }}_amd64_dll.zip + bncsutil_${{ github.ref_name }}_x86_dll.zip tag_name: ${{ github.ref_name }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 2dac25b..f33f407 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,7 +106,7 @@ SET(CPACK_PACKAGE_NAME "bncsutil") SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Battle.Net Chat Service Utility") SET(CPACK_PACKAGE_VENDOR "bncsutil") SET(CPACK_PACKAGE_DESCRIPTION "\ -This will install the library to /usr/local/lib and header files to /usr/local/include. \ +This will install the library to /usr/local/lib and header files to /usr/local/include.\n \ Make sure these directories are in your library and include paths. \ ") SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING") From a785825bcd5f3f5487a3e0cafcf43f5f26db0669 Mon Sep 17 00:00:00 2001 From: cen1 Date: Sat, 24 Feb 2024 21:41:02 +0100 Subject: [PATCH 05/19] prepare clang format for the future --- .clang-format.todo | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .clang-format.todo diff --git a/.clang-format.todo b/.clang-format.todo new file mode 100644 index 0000000..736f523 --- /dev/null +++ b/.clang-format.todo @@ -0,0 +1,6 @@ +Language: Cpp +BasedOnStyle: llvm +Standard: c++11 +TabWidth: 4 +PointerAlignment: Right +NamespaceIndentation: None \ No newline at end of file From 303f87561ad72465d8e8cbb7df69db0339090798 Mon Sep 17 00:00:00 2001 From: cen1 Date: Sat, 24 Feb 2024 21:41:13 +0100 Subject: [PATCH 06/19] fix release dependency --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 222d56f..d84554e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -147,7 +147,7 @@ jobs: release: - needs: [deb, rpm, dll] + needs: [deb, rpm, dll_amd64, dll_x86] runs-on: ubuntu-latest steps: From f50e6ed6469259ec8c87dd25d68cb9e2bfda9b85 Mon Sep 17 00:00:00 2001 From: cen1 Date: Sat, 24 Feb 2024 21:53:20 +0100 Subject: [PATCH 07/19] bummp vscpp toolset --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d84554e..96df2be 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -117,6 +117,7 @@ jobs: - uses: TheMrMilchmann/setup-msvc-dev@v3 with: arch: x86 + toolset: 17.0 - name: Install Conan id: conan From d0038338e2169ebbda0a8a79a7669ea2aebe6b7a Mon Sep 17 00:00:00 2001 From: cen1 Date: Sat, 24 Feb 2024 22:01:47 +0100 Subject: [PATCH 08/19] specify arch at conan install --- .github/workflows/release.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 96df2be..e8dc0f1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -117,7 +117,6 @@ jobs: - uses: TheMrMilchmann/setup-msvc-dev@v3 with: arch: x86 - toolset: 17.0 - name: Install Conan id: conan @@ -128,12 +127,12 @@ jobs: - name: Install dependencies shell: cmd - run: conan install . -of build -s build_type=Release -o *:shared=False --build=missing + run: conan install . -of build -s build_type=Release -s arch_target=x86 -o *:shared=False --build=missing - name: Build shell: cmd working-directory: ./build - run: .\conanbuild.bat && cmake .. -G "Visual Studio 17 2022" -DCMAKE_GENERATOR_PLATFORM=x86 -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DBUILD_SHARED_LIBS=1 && cmake --build . --config Release + run: .\conanbuild.bat && cmake .. -DCMAKE_GENERATOR_PLATFORM=x86 -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DBUILD_SHARED_LIBS=1 && cmake --build . --config Release - name: Create archive working-directory: ./build From 6801e6e18bc3e2c8d5805aa9c0e35d5f8a3349c1 Mon Sep 17 00:00:00 2001 From: cen1 Date: Sat, 24 Feb 2024 22:08:44 +0100 Subject: [PATCH 09/19] attempt to fix arch flag --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e8dc0f1..ba69740 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -127,7 +127,7 @@ jobs: - name: Install dependencies shell: cmd - run: conan install . -of build -s build_type=Release -s arch_target=x86 -o *:shared=False --build=missing + run: conan install . -of build -s build_type=Release -s arch=x86 -o *:shared=False --build=missing - name: Build shell: cmd From 9b867672fa4cd42d9fdf0cb5ee15cae9bbfe06f5 Mon Sep 17 00:00:00 2001 From: cen1 Date: Sun, 25 Feb 2024 16:18:22 +0100 Subject: [PATCH 10/19] fix mutil build to be compatible with old vb bots --- CMakeLists.txt | 5 +++-- README.md | 18 ++++++++++++++++++ conanfile.py | 17 +++++++++++++++++ src/bncsutil/decodekey.h | 2 ++ src/bncsutil/mutil.h | 15 +++++++-------- 5 files changed, 47 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f33f407..6f6190c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,7 +90,8 @@ if(UNIX) endif() if (WIN32) - add_definitions(-D_CRT_SECURE_NO_WARNINGS -DMUTIL_LIB_BUILD) + message("Enabling MUTIL") + add_definitions(-D_CRT_SECURE_NO_WARNINGS -DMUTIL_LIB_BUILD=1) endif() if (MSVC) @@ -100,7 +101,7 @@ endif() install(TARGETS bncsutil RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) install(FILES ${HEADERS} DESTINATION include/bncsutil) -#CPack configurtion +#CPack configuration SET(CPACK_GENERATOR "DEB" "RPM") SET(CPACK_PACKAGE_NAME "bncsutil") SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Battle.Net Chat Service Utility") diff --git a/README.md b/README.md index 9966bed..9f5d5c1 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ Conan is used to install dependencies. GMP can't be installed as a shared librar In `cmd` or Visual Studio dev console run: +### amd64 ``` "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvarsall.bat" x64 conan install . -of build -s build_type=Release -o *:shared=False --build=missing @@ -39,6 +40,16 @@ cmake .. -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake cmake --build . --config Release ``` +### x86 +``` +"C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvarsall.bat" x86 +conan install . -of build -s build_type=Release -s:h arch=x86 -o *:shared=False --build=missing +cd build +.\conanbuild.bat +cmake .. -G "Visual Studio 17 2022" -DCMAKE_GENERATOR_PLATFORM=x86 -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DBUILD_SHARED_LIBS=1 +cmake --build . --config Release +``` + Alternatively open `build/bncsutil.sln` and build from Visual Studio. ## Linux @@ -72,3 +83,10 @@ Note that this is a "development" package which also includes header files. Library installs to `/usr/local/lib`, include files in `/usr/local/include/bncsutil`. Packages are also available for download from github releases built on Debian Bookworm and Fedora latest. + +# Development with CLion +1. Run conan from cli as per instructions +2. Open the project +3. Tools -> CMake -> Change Project Root -> build +4. Settings -> Build, Execution, Deployment -> CMake -> Add at least this cmake option: -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake + diff --git a/conanfile.py b/conanfile.py index 70ca193..5cabc1e 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,5 +1,7 @@ from conan import ConanFile from conan.tools.files import copy +from conan.tools.files import rename +import os class Bncsutil(ConanFile): settings = "os", "compiler", "build_type", "arch" @@ -10,6 +12,21 @@ class Bncsutil(ConanFile): ) def generate(self): + # Workaround for a stupid conan bug producing wrongly named libraries.. + if self.settings.os == "Windows": + gmp_libdir = self.dependencies["gmp"].cpp_info.libdir + gmp_from_name = f"{gmp_libdir}\libgmp.a" + gmp_to_name = f"{gmp_libdir}\gmp.lib" + gmpxx_from_name = f"{gmp_libdir}\libgmpxx.a" + gmpxx_to_name = f"{gmp_libdir}\gmpxx.lib" + + if os.path.isfile(gmp_from_name): + print("Renaming " + gmp_from_name + " to " + gmp_to_name) + rename(self, gmp_from_name, gmp_to_name) + if os.path.isfile(gmpxx_from_name): + print("Renaming " + gmpxx_from_name + " to " + gmpxx_to_name) + rename(self, gmpxx_from_name, gmpxx_to_name) + for dep in self.dependencies.values(): if dep.cpp_info.libdirs: copy(self, "*.lib", dep.cpp_info.libdirs[0], self.build_folder) diff --git a/src/bncsutil/decodekey.h b/src/bncsutil/decodekey.h index 5dc8033..fceb7d6 100644 --- a/src/bncsutil/decodekey.h +++ b/src/bncsutil/decodekey.h @@ -27,6 +27,8 @@ #ifndef DECODEKEY_H #define DECODEKEY_H +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/src/bncsutil/mutil.h b/src/bncsutil/mutil.h index b513d6c..981a132 100644 --- a/src/bncsutil/mutil.h +++ b/src/bncsutil/mutil.h @@ -150,17 +150,18 @@ # define MUTIL_LIB_BUILD #endif +/** + * I think what this tries to do is differentiate if you are trying to build + * this as a library exporting symbols versus using the library from this same project + * ..which I don't think makes much sense. TODO: evaluate and nuke import part in the future + */ #ifdef MOS_WINDOWS # pragma comment(lib, "Version.lib") # ifdef MUTIL_LIB_BUILD -# if 1 -# define MEXP(type) __declspec(dllexport) type __stdcall -# else -# define MEXP(type) type __stdcall -# endif +# define MEXP(type) __declspec(dllexport) type __cdecl # define MCEXP(name) class __declspec(dllexport) name # else -# define MEXP(type) __declspec(dllimport) type __stdcall +# define MEXP(type) __declspec(dllimport) type __cdecl # define MCEXP(name) class __declspec(dllimport) name # endif #else @@ -178,6 +179,4 @@ #define NULL 0 #endif /* NULL */ -// #include - #endif /* MUTIL_H */ From 7e7b5cda8bf5963b0d448127d0854b94313dfe4b Mon Sep 17 00:00:00 2001 From: cen1 Date: Sun, 25 Feb 2024 16:26:36 +0100 Subject: [PATCH 11/19] document clion --- CMakeLists.txt | 1 - README.md | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f6190c..5deda12 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,7 +90,6 @@ if(UNIX) endif() if (WIN32) - message("Enabling MUTIL") add_definitions(-D_CRT_SECURE_NO_WARNINGS -DMUTIL_LIB_BUILD=1) endif() diff --git a/README.md b/README.md index 9f5d5c1..b835f91 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ Library installs to `/usr/local/lib`, include files in `/usr/local/include/bncsu Packages are also available for download from github releases built on Debian Bookworm and Fedora latest. # Development with CLion -1. Run conan from cli as per instructions +1. Run conan from cli as per build instructions above 2. Open the project 3. Tools -> CMake -> Change Project Root -> build 4. Settings -> Build, Execution, Deployment -> CMake -> Add at least this cmake option: -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake From db5c882e36bc3471dcb882682b8c9106c4a3b919 Mon Sep 17 00:00:00 2001 From: cen1 Date: Sun, 25 Feb 2024 17:00:19 +0100 Subject: [PATCH 12/19] add conan cache, add headers to dll zip --- .github/workflows/release.yml | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ba69740..25ed8ef 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -80,6 +80,12 @@ jobs: with: arch: x64 + - name: Cache Conan + uses: actions/cache@v3 + with: + path: | + ~/.conan/p + - name: Install Conan id: conan uses: turtlebrowser/get-conan@main @@ -98,7 +104,11 @@ jobs: - name: Create archive working-directory: ./build - run: Compress-Archive -Path Release/* -DestinationPath bncsutil_${{ github.ref_name }}_amd64_dll.zip + run: | + New-Item -ItemType Directory -Path include/bncsutil -Force | Out-Null + Copy-Item -Path '../src/bncsutil/*.h' -Destination include/bncsutil + Compress-Archive -Path Release/* -DestinationPath bncsutil_${{ github.ref_name }}_amd64_dll.zip + Compress-Archive -Path include -DestinationPath "bncsutil_${{ github.ref_name }}_amd64_dll.zip" -Update - uses: actions/upload-artifact@v4 with: @@ -122,12 +132,18 @@ jobs: id: conan uses: turtlebrowser/get-conan@main + - name: Cache Conan + uses: actions/cache@v3 + with: + path: | + ~/.conan/p + - name: Init conan run: conan profile detect - name: Install dependencies shell: cmd - run: conan install . -of build -s build_type=Release -s arch=x86 -o *:shared=False --build=missing + run: conan install . -of build -s build_type=Release -s:h arch=x86 -o *:shared=False --build=missing - name: Build shell: cmd @@ -136,7 +152,11 @@ jobs: - name: Create archive working-directory: ./build - run: Compress-Archive -Path Release/* -DestinationPath bncsutil_${{ github.ref_name }}_x86_dll.zip + run: | + New-Item -ItemType Directory -Path include/bncsutil -Force | Out-Null + Copy-Item -Path '../src/bncsutil/*.h' -Destination include/bncsutil + Compress-Archive -Path Release/* -DestinationPath bncsutil_${{ github.ref_name }}_x86_dll.zip + Compress-Archive -Path include -DestinationPath "bncsutil_${{ github.ref_name }}_x86_dll.zip" -Update - uses: actions/upload-artifact@v4 with: From 120011962c4af90ef3dc35d9b757bdc381cd001e Mon Sep 17 00:00:00 2001 From: cen1 Date: Sun, 25 Feb 2024 17:08:39 +0100 Subject: [PATCH 13/19] gha add missing cache key --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 25ed8ef..135465c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -83,6 +83,7 @@ jobs: - name: Cache Conan uses: actions/cache@v3 with: + key: conan-windows-amd64 path: | ~/.conan/p @@ -135,6 +136,7 @@ jobs: - name: Cache Conan uses: actions/cache@v3 with: + key: conan-windows-x86 path: | ~/.conan/p From 0bfcb15a78ad416cd39b43fec3a16495ebff5d04 Mon Sep 17 00:00:00 2001 From: cen1 Date: Sun, 25 Feb 2024 17:17:50 +0100 Subject: [PATCH 14/19] include conanfile in cache key --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 135465c..b7f9364 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -83,7 +83,7 @@ jobs: - name: Cache Conan uses: actions/cache@v3 with: - key: conan-windows-amd64 + key: conan-windows-amd64-${{ hashFiles('conanfile.py') }} path: | ~/.conan/p @@ -136,7 +136,7 @@ jobs: - name: Cache Conan uses: actions/cache@v3 with: - key: conan-windows-x86 + key: conan-windows-x86-${{ hashFiles('conanfile.py') }} path: | ~/.conan/p From 237d542ad346e9ff6dc07784357f363e431aed21 Mon Sep 17 00:00:00 2001 From: cen1 Date: Sun, 25 Feb 2024 17:21:42 +0100 Subject: [PATCH 15/19] fix conan home folder --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b7f9364..f092ef1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -85,7 +85,7 @@ jobs: with: key: conan-windows-amd64-${{ hashFiles('conanfile.py') }} path: | - ~/.conan/p + ~/.conan2/p - name: Install Conan id: conan @@ -138,7 +138,7 @@ jobs: with: key: conan-windows-x86-${{ hashFiles('conanfile.py') }} path: | - ~/.conan/p + ~/.conan2/p - name: Init conan run: conan profile detect From 035445f776edad5ab979b9ed7863ee7d4dcab19e Mon Sep 17 00:00:00 2001 From: cen1 Date: Sun, 25 Feb 2024 17:53:32 +0100 Subject: [PATCH 16/19] minor --- conanfile.py | 12 ++++++------ src/bncsutil/buffer.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/conanfile.py b/conanfile.py index 5cabc1e..9f5fdd2 100644 --- a/conanfile.py +++ b/conanfile.py @@ -12,7 +12,7 @@ class Bncsutil(ConanFile): ) def generate(self): - # Workaround for a stupid conan bug producing wrongly named libraries.. + # Workaround for a conan bug producing wrongly named libraries.. if self.settings.os == "Windows": gmp_libdir = self.dependencies["gmp"].cpp_info.libdir gmp_from_name = f"{gmp_libdir}\libgmp.a" @@ -27,8 +27,8 @@ def generate(self): print("Renaming " + gmpxx_from_name + " to " + gmpxx_to_name) rename(self, gmpxx_from_name, gmpxx_to_name) - for dep in self.dependencies.values(): - if dep.cpp_info.libdirs: - copy(self, "*.lib", dep.cpp_info.libdirs[0], self.build_folder) - if dep.cpp_info.bindirs: - copy(self, "*.dll", dep.cpp_info.bindirs[0], self.build_folder) \ No newline at end of file + for dep in self.dependencies.values(): + if dep.cpp_info.libdirs: + copy(self, "*.lib", dep.cpp_info.libdirs[0], self.build_folder) + if dep.cpp_info.bindirs: + copy(self, "*.dll", dep.cpp_info.bindirs[0], self.build_folder) \ No newline at end of file diff --git a/src/bncsutil/buffer.h b/src/bncsutil/buffer.h index c53b0f3..81249bb 100644 --- a/src/bncsutil/buffer.h +++ b/src/bncsutil/buffer.h @@ -73,4 +73,4 @@ void buffer_add_u32(msg_buffer_t, uint32_t); msg_reader_t create_reader(size_t initial_size); -#endif +#endif /* BUFFER_H */ From 5b6431a68f9ab05ec3bf5c66f3d4ca5b01917073 Mon Sep 17 00:00:00 2001 From: cen1 Date: Sun, 25 Feb 2024 19:14:37 +0100 Subject: [PATCH 17/19] clean up debian conan build --- .github/workflows/cmake.yml | 8 ++++---- README.md | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 9e081d6..71afcb2 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -58,15 +58,15 @@ jobs: run: conan profile detect - name: Install deps with conan - run: conan install . -of ./build -s build_type=Release --build=missing + run: conan install . -of build -s build_type=$BUILD_TYPE --build=missing - name: Cmake - working-directory: ./build + working-directory: build run: bash conanbuild.sh && cmake .. -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DUSE_SYSTEM_LIBS=0 - name: Build - working-directory: ./build - run: cmake --build . + working-directory: build + run: cmake --build . --config Release build-fedora-system: if: true diff --git a/README.md b/README.md index b835f91..1d78ffa 100644 --- a/README.md +++ b/README.md @@ -69,9 +69,9 @@ If you are using pyenv or building python3 from source, make sure you have `libb ``` conan install . -of build -s build_type=Release --build=missing cd build -./conanbuild.sh -cmake .. -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DUSE_SYSTEM_LIBS=0 -cmake --build . --target install --config Release +bash conanbuild.sh +cmake .. -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DUSE_SYSTEM_LIBS=0 +cmake --build . --config Release ``` ## .deb and .rpm packages From 4df4504d9e0275a71136c22700addd0b63be78e0 Mon Sep 17 00:00:00 2001 From: cen1 Date: Sun, 25 Feb 2024 20:27:03 +0100 Subject: [PATCH 18/19] fix USE_SYSTEM_LIBS --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5deda12..454b245 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,9 +47,9 @@ set(SOURCES target_sources(bncsutil PRIVATE ${SOURCES} ${HEADERS}) if (WIN32) - set(USE_SYSTEM_LIBS 0) + option(USE_SYSTEM_LIBS "Use system libraries" OFF) else() - set(USE_SYSTEM_LIBS 1) + option(USE_SYSTEM_LIBS "Use system libraries" ON) endif() if (CMAKE_GENERATOR_PLATFORM EQUAL "x86") @@ -100,6 +100,8 @@ endif() install(TARGETS bncsutil RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) install(FILES ${HEADERS} DESTINATION include/bncsutil) +message("${CMAKE_INCLUDE_PATH}") + #CPack configuration SET(CPACK_GENERATOR "DEB" "RPM") SET(CPACK_PACKAGE_NAME "bncsutil") From 76721ea4cc7ad6bd5dc1be3b4840e5c69423fc00 Mon Sep 17 00:00:00 2001 From: cen1 Date: Sun, 25 Feb 2024 20:47:23 +0100 Subject: [PATCH 19/19] minor --- CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 454b245..5830a5a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,7 +90,7 @@ if(UNIX) endif() if (WIN32) - add_definitions(-D_CRT_SECURE_NO_WARNINGS -DMUTIL_LIB_BUILD=1) + add_definitions(-D_CRT_SECURE_NO_WARNINGS -DMUTIL_LIB_BUILD) endif() if (MSVC) @@ -100,8 +100,6 @@ endif() install(TARGETS bncsutil RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) install(FILES ${HEADERS} DESTINATION include/bncsutil) -message("${CMAKE_INCLUDE_PATH}") - #CPack configuration SET(CPACK_GENERATOR "DEB" "RPM") SET(CPACK_PACKAGE_NAME "bncsutil")