Fix compilation issues on Windows
ClosedPublic

Authored by sdepiets on Oct 8 2018, 9:13 AM.

Details

Summary

The linkage doesn't work currently on Windows because lib/test and backend/python libraries are using the same export flag than the lib/.

I have replaced the cantor_export.h flat file by calls to generate_export_header (via CMake) and put differentiated CANTOR_EXPORT/CANTOR_PYTHONBACKEND_EXPORT precompiler directives depending on the library being built.

Diff Detail

Repository
R55 Cantor
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 3662
Build 3680: arc lint + arc unit
sdepiets created this revision.Oct 8 2018, 9:13 AM
Restricted Application added a project: KDE Edu. · View Herald TranscriptOct 8 2018, 9:13 AM
Restricted Application added a subscriber: kde-edu. · View Herald Transcript
sdepiets requested review of this revision.Oct 8 2018, 9:13 AM
sdepiets updated this revision to Diff 43114.Oct 8 2018, 9:16 AM

Do not copy the export header

sdepiets edited the summary of this revision. (Show Details)Oct 8 2018, 9:34 AM
sdepiets added a reviewer: Cantor.

Thanks for this work.

src/backends/maxima/CMakeLists.txt
19–20

I think, you could remove this if(NOT WIN32), becouse we don't use KPtyProcess with maxima.
Also, need to remove preprocessor's statement in maximasession.h:31

pino requested changes to this revision.Oct 8 2018, 5:48 PM
pino added a subscriber: pino.

please remove all the <repository.h> changes from this patch, since they are nothing to do with the actual export fixes

src/backends/python/pythonbackend.h
25

this ought to be <...>, because it's a generated header in a directory different than the same source directory of this file

src/backends/python/pythonsession.h
26

ditto

src/lib/test/backendtest.h
28

ditto

This revision now requires changes to proceed.Oct 8 2018, 5:48 PM
sdepiets updated this revision to Diff 43179.Oct 9 2018, 1:05 AM

Requested changes

sdepiets marked 3 inline comments as done.Oct 9 2018, 1:06 AM
pino requested changes to this revision.Oct 9 2018, 4:57 AM

please amend the commit message to not mention the <repository.h> changes

src/backends/maxima/maximasession.h
31–36

while this change is OK, it is unrelated to this patch

This revision now requires changes to proceed.Oct 9 2018, 4:57 AM
sdepiets edited the summary of this revision. (Show Details)Oct 9 2018, 5:08 AM
sdepiets added inline comments.Oct 9 2018, 3:54 PM
src/backends/maxima/maximasession.h
31–36

Do you want me to change this in a separate commit ?

asemke added a subscriber: asemke.EditedOct 9 2018, 4:14 PM

@sdepiets for the sake of completeness, can you please tell what the issue were with compiling (or rather linking?) on windows?

Furthermore, GenerateExportHeader seems to be depricated:
https://cmake.org/cmake/help/v3.0/module/GenerateExportHeader.html

sirgienko added inline comments.Oct 9 2018, 4:46 PM
src/backends/python/pythonbackend.h
27

Is this export necesary?
Other backends don't hasen't used cantor_export.h, so maybe this backend shouldn't do it too?

@sdepiets for the sake of completeness, can you please tell what the issue were with compiling (or rather linking?) on windows?

The problem was with lib/test and python/backend libraries sharing the same export flag than lib.

Furthermore, GenerateExportHeader seems to be depricated:
https://cmake.org/cmake/help/v3.0/module/GenerateExportHeader.html

That's just for ADD_COMPILER_EXPORT_FLAGS no ?

pino added a comment.Oct 10 2018, 5:01 AM

@sdepiets for the sake of completeness, can you please tell what the issue were with compiling (or rather linking?) on windows?

The problem was with lib/test and python/backend libraries sharing the same export flag than lib.

This is a good thing to mention in the commit message, instead of a generic "a couple of issues".

src/backends/maxima/maximasession.h
31–36

Yes, which does not need a review (just commit it directly) IMHO.

src/backends/python/pythonbackend.h
27

Other backends do not have a shared library, like cantor_pythonbackend. Since both cantor_python2backend and cantor_python3backend are implemented using cantor_pythonbackend, then its symbols are needed.

sdepiets updated this revision to Diff 43264.Oct 10 2018, 6:15 AM

Unused forward declarations will be removed separately

sdepiets edited the summary of this revision. (Show Details)Oct 10 2018, 6:17 AM
pino accepted this revision.Oct 10 2018, 6:24 AM

Seems OK for me -- wait a bit in case the other reviewers have concerns.

This revision is now accepted and ready to land.Oct 10 2018, 6:24 AM
asemke accepted this revision as: asemke.Oct 10 2018, 7:05 AM

@sdepiets for the sake of completeness, can you please tell what the issue were with compiling (or rather linking?) on windows?

The problem was with lib/test and python/backend libraries sharing the same export flag than lib.

Ok.

Furthermore, GenerateExportHeader seems to be depricated:
https://cmake.org/cmake/help/v3.0/module/GenerateExportHeader.html

That's just for ADD_COMPILER_EXPORT_FLAGS no ?

You're right. Thanks.

sirgienko accepted this revision.Oct 10 2018, 7:06 AM
This revision was automatically updated to reflect the committed changes.