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

Add cmake build tool #15

Open
aleksey-nikolaev opened this issue Jul 30, 2018 · 6 comments
Open

Add cmake build tool #15

aleksey-nikolaev opened this issue Jul 30, 2018 · 6 comments

Comments

@aleksey-nikolaev
Copy link

Migrating to CMake could help to build and install libjpeg on MSVC 15.x as simple as on gcc and you could remove any MSVS solution files (and autotools also)

@vbaderks
Copy link

vbaderks commented Feb 3, 2021

I would be able help in providing the initial CMakeLists.txt files.

@thorfdbg
Copy link
Owner

thorfdbg commented Feb 3, 2021

I suggest to integrate it into your repository and then make a merge request. Would that work?

@vbaderks
Copy link

vbaderks commented Feb 3, 2021

Sure. I can fork your repository, develop there the CMakeLists.txt files and then create a merge request.
I am assuming that the 3 common C++ compilers: gcc, clang and msvc needs to be supported.

What would be the minimum supported C++ standard?

@thorfdbg
Copy link
Owner

Sorry for the slow reply. C++11 would be more than sufficient for it. Likely even below, i.e. C++03 would likely go.

The most important targets are, as you say, g++ und msvc.

Thanks for looking into this.

@vbaderks
Copy link

I have created pull request #50 as initial starting point. It was tested with:

  • MSVC 19.28 (Visual Studio 2019 16.8.5 on Windows 10)
  • Clang 10.0.0 (Ubuntu 20.04)
  • GNU 9.3.0 (Ubuntu 20.04)

The main library is called "jpeg", the cmd-line application is called "jpeg-tool" as names need to be unique in CMake. I didn't
add an option to change the output name of the cmd-line tool, but this is possible. CMake will, by default, prepend the name of a library with "lib".

Note 1: Generating Ninja build files is the easiest way to analyze if all the compiler options are as intended.
Note 2: Clang 10.0.0 will generate some "no case matching constant switch condition '2' " warnings, I could not find a good switch to disable this warning, adding "default" to the switch will probably help, but I explicitly didn't want make any source code changes.
Note 3: BUILD_LIB will be defined when build a shared library. On Linux some changes are needed to config.h to ensure that JPG_EXPORT has the correct value. This needs to be done and an update to the CMakeLists.txt to change the default visibility.

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

No branches or pull requests

4 participants
@thorfdbg @vbaderks @aleksey-nikolaev and others