openssl / perftools

Performance testing tools
Apache License 2.0
4 stars 4 forks source link

Let's give a cmake try to build per tools #2

Closed Sashan closed 2 months ago

Sashan commented 4 months ago
The change also removes usused variables I've found occasionally.

To build performance tools on windows we must add missing pieces:
    - getopt()
    - basename()
    - strcasecmp()
all thos implementations are homebrewed

Let cmake to determine openssl version we use to build tools.

In order to tell CMake which OpenSSL version to use we use
env. variabe OPENSSL_ROOT_DIR which points to OpenSSL installation
prefix with desired version.

We build evp_fetch and providerdoall test tools for OpenSSL 3.*.
We don't build those for 1.1.1.

CMake seems to work fine on windows and OpenBSD.

The OpenBSD binaries produced by build process use RPATH. There is no
such thing on Windows. On windows you need to add your OPENSSL_ROOT_DIR\bin
to your PATH. Otherwise the .exe file produced by build process won't work.
nhorman commented 4 months ago

the changes look reasonable, but you have a fixup as your first commit, not sure that will autosquash properly

Sashan commented 4 months ago

I've just force pushed repository with squashed changes.

bonus: it builds on MacOS too. Gave a try 1.1.1, 3.0 3.3 and 3.4-dev everything worked fine.

levitte commented 4 months ago

I did a bit of hacking, and a much bigger instruction comment in source/CMakeLists.txt. Mind of I simply push a fixup commit into this PR?

levitte commented 4 months ago

This got me to test the OpenSSLConfig.cmake we produce for using an OpenSSL build without installing it, and oh boy, I found a bug (fixed in openssl/openssl#24918)

Sashan commented 4 months ago

I did a bit of hacking, and a much bigger instruction comment in source/CMakeLists.txt. Mind of I simply push a fixup commit into this PR?

please, go ahead and push your changes in.

levitte commented 4 months ago

Done. Don't forget to pull...

levitte commented 4 months ago

BTW, if you want to see what's actually happening when building:

$ cmake --build ./build --verbose
Sashan commented 3 months ago

update CMakeList.txt so it can build evp_setpeer which has just landed to repository. I'm also doing a minor tweak to evp_setpeer.c to fix build on windows.

Sashan commented 2 months ago

@levitte it would be nice to have those changes in so everyone can build tools on windows. thanks.

levitte commented 2 months ago

@levitte it would be nice to have those changes in so everyone can build tools on windows. thanks.

I agree. Might I encourage you to nudge others to review them?

t8m commented 2 months ago

ping @openssl/committers for second review

levitte commented 2 months ago

I pushed a fixup just now, changing CMakeLists.txt a little bit.

This moves all the dependencies on OpenSSL to the perf library, and also declares its public include directory.

With that, all executables only need to depend on the perf library, and the magic of CMake will take care of the rest.

Sashan commented 2 months ago

please hold your new approvals/merging the cmake does not work on windows yet. this is the error I get when I try to build it

C:\Users\OpenSSL\work.openssl\perftools\source>cmake --build build-master-one
ninja: error: build.ninja:54: bad $-escape (literal $ must be written as $$)
  INCLUDES = -IC:\Users\OpenSSL\work.openssl\perftools\source\$(PROJECT_...
                                                              ^ near here

not sure if it is glitch in cmake or ninja on windows, this is triggered by addition of target_sources() I'm still investigating the issue. will continue on Sunday evening.

Sashan commented 2 months ago

The basename() is reworked so both separators ('/' and '\') are recognized on windows. Also function behavior got closer to behavior found on unix/linux

tom-cosgrove-arm commented 2 months ago

@Sashan Err, looks like you committed basename.o

t8m commented 2 months ago

Commits to be squashed when merging.

Sashan commented 2 months ago

Commits to be squashed when merging.

I can squash commits and do a force push when I'll be doing s/posix/POSIX, would that be OK?

tom-cosgrove-arm commented 2 months ago

I can squash commits and do a force push when I'll be doing s/posix/POSIX, would that be OK?

I don't know about others, but when reviewing, I personally find it easier if commits are only added, with the squashing done on merge

tom-cosgrove-arm commented 2 months ago

Approved and labels updated

t8m commented 2 months ago

Merged. Thank you.