redis-plus-plus icon indicating copy to clipboard operation
redis-plus-plus copied to clipboard

[BUG] it seems both HIREDIS_LIB and TEST_HIREDIS_LIB should be set to the static lib FILEPATH on Windows

Open icelee123 opened this issue 2 years ago • 1 comments

when set to dll, link.exe failed. the document is misleading

icelee123 avatar May 24 '22 01:05 icelee123

Sorry for the misleading info, but I'm not familiar with Windows building environment. Can you create a PR to fix the doc, or even better make the doc more precisely? Thanks a lot!

Regards

sewenew avatar May 24 '22 12:05 sewenew

On Windows you can have hiredis-lib folder holds hiredis project from github and a lib folder. Copy lib file into lib folder. After specifying the absolute path of hiredis-lib for cmake argument DCMAKE_PREFIX_PATH="Your hiredis-lib Absolute Path", in this way you should solve the problem

Asphalt415 avatar Sep 14 '23 21:09 Asphalt415

@GorZ3rk Thanks a lot for your contribution!

I also post your PR under this issue, so that if someone searches the issue list can find your building steps. If you have problem with it, feel free to let me know, and I'll remove it.

The following building steps are given by @GorZ3rk and tested with VS 2022:

==================================

Build with Visual Studio

If you want to build the project with Visual Studio and have questions about it, please follow the steps below. The following is tested on Visual Studio 2022 Community.

# download two projects into this folder
mkdir redis++
cd redis++
# make sure you create a hiredis first to work as a library
mkdir hiredis-lib
cd hiredis-lib
mkdir lib
git clone https://github.com/redis/hiredis.git
cd hiredis

So far it should be fine with each step. Then open CMakeLists.txt file. Modify the following line and comment it out

...
# SET(CMAKE_DEBUG_POSTFIX d)
...

Then go back to hiredis project folder

mkdir build
cd build
# convert project into visual studio 2022, if necessary choose you version e.g 19 2019 etc.
cmake -G "Visual Studio 17 2022" ..
./hiredis.sln

Set hiredis as Startup Project then click Build Solution in Debug Mode

After successfull build, copy all the files under Debug into hiredis-lib/lib folder

Here the work for hiredis should be finished.

Then go back to redis++ folder. Open Terminal here

git clone https://github.com/sewenew/redis-plus-plus.git
cd redis-plus-plus
mkdir build
cd build

Now you should always have openssl on your PC, otherwise can use chocolatey to install it. For Visual Studio 2022 please install pthread separately using vpckg, following this link

After all preparation. If you want to convert all projects then

cmake -DCMAKE_PREFIX_PATH="$(ABSOLUTE_PATH)\hiredis-lib" -G "Visual Studio 17 2022" ..
cd build
./redis++.sln

set redis++_static as Startup Project then click Build Solution

So far build has been successfully finished!

sewenew avatar Sep 17 '23 10:09 sewenew