-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Investigation into building unit_tests without conan #575
Comments
Getting gtest to run should be very simple on Linux. Take a look at ci/install_dependencies.sh, that should get the job done on the major distros.
…On November 30, 2018 9:15:06 PM GMT+01:00, Robin Mills ***@***.***> wrote:
I'm putting these notes for my benefit and this issue will be closed in
a couple days.
I'm very pleased that we can build and run the unit_tests on msvc
builds thanks to conan. And they build OK on MacOS-X without using
conan. I've been unable to build Exiv2 with conan on Cygwin and/or
MinGW and I've said in the docs that we don't support this. I would
like to find a way of running the unit_tests on Cygwin and/or MinGW.
I've investigated achieving this on Linux and surprised by the
complexity.
From googling around, one procedure is:
1) Download the code:
$ wget
https://github.com/google/googletest/archive/release-1.8.0.tar.gz
2) Untar and build:
$ tar xzf release-1.8.0.tar.gz
$ cd googletest-release-1.8.0/
$ cmake . -DBUILD_SHARED_LIBS=1
$ make
3) Copy the shared object to /usr/local/lib
$ sudo mkdir -p /usr/local/lib
$ find . -name "*.so" -exec sudo cp {} /usr/local/lib \\;
4) inspect the libraries:
$ ls -l /usr/local/lib/libg*.so
-rwxr-xr-x 1 root root 1174485 Nov 30 19:57
/usr/local/lib/libgmock_main.so
-rwxr-xr-x 1 root root 1170038 Nov 30 19:57 /usr/local/lib/libgmock.so
-rwxr-xr-x 1 root root 7798 Nov 30 19:57
/usr/local/lib/libgtest_main.so
-rwxr-xr-x 1 root root 860842 Nov 30 19:57 /usr/local/lib/libgtest.so
5) Build exiv2 with -DEXIV2_BUILD_UNIT_TESTS=1
$ cd <exiv2dir> ; rm -rf build ; mkdir -p build ; cd build
$ cmake .. -DEXIV2_BUILD_UNIT_TESTS=1
$ make
........ rattle and roll .....
Link Errors
------
$ vi ../unitTests/CMakeLists.txt
```
target_link_libraries(unit_tests
PRIVATE
exiv2lib
${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} <-- I added this to be sure the pthreads was
being used
<-- however, I think this only applied if we installed static
lightest.a
)
----
```
$ make
$ bin/unit_tests
|
Thanks Dan. At the moment, I'm trying to get it to work on MinGW and CYGWIN. I'm confident that I'll get it working. It worked effortlessly on the Mac and MSVC (using conan). I didn't get to RC3 yesterday. However I'm really close. Good Luck with the new job. Luis starts his new job on Monday. Excited for both of you. |
1 similar comment
Thanks Dan. At the moment, I'm trying to get it to work on MinGW and CYGWIN. I'm confident that I'll get it working. It worked effortlessly on the Mac and MSVC (using conan). I didn't get to RC3 yesterday. However I'm really close. Good Luck with the new job. Luis starts his new job on Monday. Excited for both of you. |
I'm putting these notes for my benefit and this issue will be closed in a couple days.
I'm very pleased that we can build and run the unit_tests on msvc builds thanks to conan. And they build OK on MacOS-X without using conan. I've been unable to build Exiv2 with conan on Cygwin and/or MinGW and I've said in the docs that we don't support this.
Thanks to Dan's wonderful script ci/install_dependencies.sh, setting up on Linux is easy and is documented in README.md.
The text was updated successfully, but these errors were encountered: