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

Improve CMake code for the case Win + CMake + Visual Studio #22

Merged
merged 7 commits into from Aug 11, 2017
Merged

Improve CMake code for the case Win + CMake + Visual Studio #22

merged 7 commits into from Aug 11, 2017

Conversation

piponazo
Copy link
Collaborator

After the previous changes related with the generation of the exv_conf.h file, I have spent some time on Windows and I have improving few things:

  • Now the exv_conf.h file is not generated inside the source_tree but in the CMAKE_BINARY_DIR. Then we use the cmake command include_directories to make that file visible for the full project.
  • Since we are requiring CMake 3.1 we could get rid of the ugly PRIVATE_VAR. Now we can freely chose if we want to use PRIVATE or PUBLIC for the definitions, directory inclusions and libraries.
  • Add XML_STATIC definition for the xmp library. It is necessary to use that definition when we link statically against EXPAT.
  • Use EXIV2_ENABLE_LIBXMP to toggle the compilation of some targets (xmp and geotags)

@clanmills
Copy link
Collaborator

clanmills commented Aug 10, 2017

This looks very good, Luis. I'm building/testing 9 different builds. Mostly good.

Xcode produces a warning about "stdc++lib is deprecated, use c++lib" (or something like that). I'm using CMake 3.5.1 on the Mac (3.9 on Windows). I will upgrade CMake tomorrow and build again on Xcode.

msvc/exiv2.sln fails on missing exv_conf file.

B = Builds F = Fails to build
T = Passes Test
x = Not done yet - = irrelevant
1,2 = Comment Below

| Platform | ./configure or  | <------   CMake    ------> |
|          | msvc/exiv2.sln  | Make/Visual Studio | Xcode |
| MSVC     | F2 x            | B  T               | -  -  |  
| MacOSX   | B  T            | B  T               | B1 -3 |  
| Linux    | B  T            | B  T               | -  -  |  
| Cygwin   | B  T            | B  T               | -  -  |  

1 = stdc++lib deprecated warning
2 = missing file exv_conf.h or something (to be investigated)
3 = I seldom run the test suite from Xcode

@clanmills
Copy link
Collaborator

The fix for "deprecated stdc++lib" warning is to build against MacOSX 10.9 sdk. Add this to CMakeLists.txt after include(config/findDepenencies.cmake)

if (APPLE)
    # install MacOSX10.9.sdk into $(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs
    # Obtain SDKs from https://github.com/phracker/MacOSX-SDKs/release
    set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9")
endif()

Caution:

We must put the information about MacOSX10.9.sdk into README-CMAKE. I may even report two bugs to KitWare. CMake should be using this when performing compiler tests. CMake should report MacOSX10.9.sdk as missing.

When MacOSX10.9.sdk is absent, Xcode generates hundreds of compilation errors in Exiv2 code such as src/version.cpp, exiv2.cpp. There is nothing in those messages to cause the user to realise that the target SDK is missing.

I think we should either:

  1. add code in CMakeLists.txt to test that MacOSX10.9.sdk is on the build computer (preferable)
  2. not set CMAKE_OSX_DEPLOYMENT_TARGET and put up with the warning messages (ugly, but harmless)

Comment:
I have encountered this issue when building the Adobe XMPsdk. The script xmpsdk/buildXMPsdk.sh does check for MacOSX10.9.sdk. However in Exiv2 v0.26.1, the user will only run xmpsdk/buildXMPsdk.sh if they want to use ADOBE_XMPSDK. By default, v0.26.1 will build and link the code in xmpsdk/src (as it has for about 10 years).

I am not submitting MacOSX10.9.sdk to our repos. It's 350mb (40mb compressed) and will make our repos FAT. The my strategy for dealing with fat files which are occasionally used (e.g. some test files) is to keep them in svn://dev.exiv2.org/svn/team and download on-demand.

@clanmills clanmills merged commit b00afb6 into Exiv2:master Aug 11, 2017
@clanmills
Copy link
Collaborator

I've restored the file include/exiv2/exv_msvc.h and modified msvc/libexiv2/libexiv2.vcproj to copy exv_msvc.h to exv_conf.h before building the library. This is a local change in the msvc tree (which I own) and will have no impact on the CMake and Autotools environments.

@clanmills
Copy link
Collaborator

Luis

I think there's a bug in the installation of exv_conf.h (into /usr/local/include/exiv2). If I've been building with the autotools, CMake doesn't overwrite that file. It reports it as "up-to-date".

@piponazo piponazo deleted the configFilesMsvc branch August 14, 2017 05:38
@piponazo
Copy link
Collaborator Author

True Robin, I forgot to take care of the installation of the file. I will take a look today, normally the installation of files with CMake is easy to handle.

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

2 participants