Skip to content
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

CMake-based build system for rhash #71

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

JPeterMugaas
Copy link
Contributor

start on an alternative build system. This is far from finished and I want to implement some tests with it. This is an idea to help get things started. Comments and testing on your system are appreciated.

Todo:

  1. remove dependency upon GNU sed.
  2. make some build tests by translating most of the bash-based tests.
  3. Try to implement some of the other stuff from the ./configure Makefile system including that ccp-doc stuff (I just need to know what it was referring to).
  4. Test on MSYS. I have not yet done that.

As always, flames, comments, and criticism are welcome.

@rhash
Copy link
Owner

rhash commented Apr 10, 2018

CppDoc2 was a good utility for generating JavaDoc-style documentation from sources. Regrettably its website cppdoc.com has expired in 2016. The last accessible version is https://web.archive.org/web/20151029190831/http://www.cppdoc.com/ .

We should drop cppdoc support, since it can't be downloaded now from a verified source.

@jrepp
Copy link
Contributor

jrepp commented Apr 17, 2018

I didn't see this PR and did a very minimalist pass for CMake just to support my own needs initially.

https://github.com/jrepp/RHash/tree/cmake-support

@JPeterMugaas A few changes I would propose to your much better pass on CMake support:

Improvements for embedding:

  • Scope all the variables RHASH_ (rhash as a submodule in another cmake project)
  • Allow the omitting of the executable (RHASH_LIBRARY_ONLY)

Consider using GLOB and file structures to cleanup the test/header-only/library use cases. Probably a bigger change and just listing the files is sufficient.

@rhash
Copy link
Owner

rhash commented Apr 19, 2018

@JPeterMugaas cmake build fails on Ubuntu:

$ cmake .
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libssl.so;/usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.0.2g")
-- Found Gettext: /usr/bin/msgmerge (found version "0.19.7")
-- Found Intl: /usr/include
-- RHash version: 1.3.6
-- OpenSSL Crypto Includes: /usr/include
-- OpenSSL Crypto Library: /usr/lib/x86_64-linux-gnu/libcrypto.so
-- Intl Includes: /usr/include
-- Intl Library: Intl_LIBRARY-NOTFOUND
-- CMAKE_EXECUTABLE_SUFFIX
-- SED /bin/sed
-- Polyglotman (rman) /usr/bin/rman
-- groff /usr/bin/groff
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
Intl_LIBRARY (ADVANCED)
linked by target "rhash_exe" in directory /home/aleksey/Documents/private/RHash.GIT/build
linked by target "rhash_lib" in directory /home/aleksey/Documents/private/RHash.GIT/build

-- Configuring incomplete, errors occurred!

While the old ./configure script works:

$ ./configure
Checking for target OS ... Linux
Checking for cc version ... 5.4.0
Checking for linker support for -static ... yes
Checking for linker support for dlopen ... yes
Checking for linker support for --version-script ... yes
Checking for gettext ... found
Checking for OpenSSL ... runtime
Checking for sources ... RHash 1.3.6
Writing config.mak
Writing librhash/config.mak
Writing dist/librhash.pc

The config.log shows how ./configure has found gettext:

============ Checking for gettext ============

----- source file: /tmp/rhash-configure-19883-15721/tmp.c -----
#include <libintl.h>
int main(void) { return 0; }
----- end of file: /tmp/rhash-configure-19883-15721/tmp.c -----
cc -O2 -pipe -DNDEBUG -fomit-frame-pointer -ffunction-sections -fdata-sections -Wall -W -Wstrict-prototypes -Wnested-externs -Winline -Wpointer-arith -Wbad-function-cast -Wmissing-prototypes -Wmissing-declarations  /tmp/rhash-configure-19883-15721/tmp.c    -o /tmp/rhash-
configure-19883-15721/tmp -c
Compilation result: 0


----- source file: /tmp/rhash-configure-19883-15721/tmp.c -----
#include <libintl.h>
int main(void) {
  gettext("");
  return 0;
}
----- end of file: /tmp/rhash-configure-19883-15721/tmp.c -----
cc -O2 -pipe -DNDEBUG -fomit-frame-pointer -ffunction-sections -fdata-sections -Wall -W -Wstrict-prototypes -Wnested-externs -Winline -Wpointer-arith -Wbad-function-cast -Wmissing-prototypes -Wmissing-declarations  /tmp/rhash-configure-19883-15721/tmp.c    -o /tmp/rhash-
configure-19883-15721/tmp
Compilation result: 0

Result is: found
=============================================

@JPeterMugaas
Copy link
Contributor Author

Sorry for my late reply but I wanted to do a lot more work on this to add more capabilities to the cmake-based system which I hope migh replace the configure script one of these days.

Alright, I did try to prefix most of the variables. The only ones I didn't prefix are for various syntax purposes or because of some things in CMake. I did try to provide some way to make a minimalist cmake for embedding in other projects but my main focus is on a giant distribution for developer package redistribution. I did try to provide some things for a NSIS installer and I wanted to work on some tests. There's still much to do in that regard to replace the ones based on the bash shell plus I'm still hoping to replace the .sed file with a cmake script so that this stuff can be more platform independent.

I also used Doxygen extensively for developer documentation in both HTML and man forms.

Now this having been said, I'm not sure what to think about the Intl issue on Linux but I hope look further at this later. Hopefully, retesting might help. I would have to probably update my Archlinux Virtual Machine to test that issue.

@JPeterMugaas
Copy link
Contributor Author

Alright, I did look at the documentation for the FindIntl module and this is what it said:

On some platforms, such as Linux with GNU libc, the gettext

functions are present in the C standard library and libintl

is not required. Intl_LIBRARIES will be empty in this

case.

This is something that I did NOT take into account and I was not thinking about it because on Windows, there is an additional library that we have to link to if we are to compile an .EXE that uses that functionality. On Ubuntu and probably several other things, you do NOT need to link to an additional library. I will check in a patch for this but I'm not sure how well it would work. But please test this and let me know.

@rhash
Copy link
Owner

rhash commented May 4, 2018

Hello, thank for fixing issues.
I'm very busy with RL now, but I plan to review the pull request in the next coming months.

… want to implement some tests with it. This is an idea to help get things started. Comments and testing on your system are appreciated.
1) Start adding tests for the .EXE and libraries.
2) Add support for Doxygen.  This does not use the Doxyfile from original GIT RHash because We need to fill in values.  This should hopefully replace cpp-doc because I can't get the source-code for that and it's disssappeared.
3) Add an application icon for building a NSIS installer with CMake.  This really should be in the RHash.exe in Windows but I want to get with you all about that.  The icon was stolen from a RHash website.
4) Add the original .PNG from the website we could use it in the Doxygen documentation.
5) Try to make the installer have options to support a minal lib as suggested.  I did by adding several other options since the CMakeLists.txt now supports quite a number of things.
6) There's probably some things I omitted.  Goodness knows I've spent on this which is why it delayed for so long.  But I think it's worth it.
Embed icon and version information to .EXE's and .DLL's.  This should work in Cygwin, MSYS, and MINGW if windres is available and supported by cmake.  Also make the installer point to the icon in the .EXE.  This should make things more intuitive in the Windows GUI as well as provide embedded copyright information in the .DLL and .EXE's.
1)  Hopefully fixed  Linux issue with the intl libraries.  It turns out that linking to an additional library might not be required and Intl_LIBRARIES will be empty.
2) Specified MSCGEN improperly.  It turns out that we need to specify tge dur wgere NSCGEB u=actyakkt us ub MSCGEN_PATH,
…se tests are roughly equivilant to the tests in the RHash/tests directory except that they are NOT based on bash.. The cmake source-code does pass these tests in Win32.
…tputting stuff to stderr even on sucesss. This was probably anticipated in the bash tests. This now works 100% on Archlinux.
Add more informative information about builds.
Dump CMAKE_INSTALL_FULL_xxx vars that I needed for debugging.
Handle USE_GETTEXT define for .EXE and add SYNCONF macro define.
RHASH_USE_GETTEXT menu otpion now works as expected.  This enables/disables intl and Gettext support (they both go hand in hand)
Fix RHASH_OPENSSL_RUNTIME menu option.
RHASH_TESTS_OPT_FULL - new menu option for enabling a certain test (test_all_hash_options.cmake).  This corresponds to something I saw in the bash script.
Only generate .rc files for SHARED_LIBS and BUILD_EXE options.
Fix for dot, graphviz, and mscgen handling with Doxygen.
@haubi
Copy link
Contributor

haubi commented May 24, 2019

Please do not switch to CMake as build system, as CMake does not properly work on some platforms that may be supported now.
One example is AIX, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89096#c9
Another example is Cygwin: Cygwin by itself does not want to have WIN32 defined, but CMake does define WIN32 by itself - which is just wrong.

@JPeterMugaas
Copy link
Contributor Author

I think that would depend upon what version of CMake. There was a change in cmake policies in that regard starting with cmake 2.83 (or something).

@madebr
Copy link

madebr commented Jan 25, 2020

This is a big improvement upon the current custom build system.
This enables me to build the librhash using Visual Studio.
I propose to work on this cmake solution, unless somebody comes forward and create a proper autotools alternative.

@wdlkmpx
Copy link

wdlkmpx commented Jun 14, 2023

There's something wrong with the PR, does it change line endings or something? Its like everything has been edited

Other than that, this should have been merged 2 years ago, but maybe people are willing to create a meson project for rhash now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants