-
Notifications
You must be signed in to change notification settings - Fork 67
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
Extend CMake build #181
Extend CMake build #181
Conversation
As for the windows build.
* BUILD_SHARED_LIBS is a global cmake variable. If it is set to ON, add_library generates shared libraries if not explicitly set otherwise. * If BUILD_SHARED_LIBS is ON, mbedtls needs to be built as shared library as well. This can be done by setting the USE_STATIC_MBEDTLS_LIBRARY and USE_SHARED_MBEDTLS_LIBRARY CMake option from mbedtls as cache variable. * The iotivity-api interface library has to be linked pubicly so that its symbols are exported.
Setting the version causes a CMake Policy warning CMP0048 because mbedtls does not set the project version.
This makes its linking to iotivity-lite independent of the BUILD_SHARED_LIBS variable (handles the PIC compiler flag for shared libs build).
The library is statically linked into the dynamic library.
This allows to link mbedtls only when security is enabled.
These properties are propagated to the user of the library.
These BUILD_INTERFACE properties help with the compilation of the onboarding tool and the sample apps.
Unittests now pass even if OC_IPV4 is not set.
can we do these changes in stages? |
Good job, nice work! |
Yes, the diff on the main I tried to have a clean commit log to make it easier to understand.
The SWIG/Java build is not in this PR. I can create separate PRs from these commits if you prefer, but I'm not sure that it reduces the diff on the main |
Thanks, I'm glad you like it! |
This resolves the name conflict on Windows.
The Windows build doesn't find the header files in the port directory.
During testing of the library built with MSVC I came across a issue when trying to link against the DLL: Since the library doesn't export any symbols, it is missing the import library that is required by the MSVC toolchain to link against a DLL. It's the same issue as reported in issue #182. It works fine though when the library is built with the MinGW Toolchain. So until the symbols of the library are exported, I would suggest to disable the build of a DLL with the MSVC toolchain. Would you be OK with that for now? |
That's probably down to the fact that it behaves as |
Extend / refactor the CMake build to imitate the Makefile build:
port/*
folders need to be built separately for client and server object libraries, due to aOC_CLIENT
compilation switch in the source code.port/linux/*.pc.in
{client,server,client-server}-{static,shared}
as components in theiotivity-lite
namespace. This provides a modern use of the library in CMake, e.g:COMPONENTS
to allow future packaging with CPack.tests
directory with a customcheck
target that executes thetools/check.py
script.BUILD_EXAMPLE_APPLICATIONS
toOFF
). The example applications are currently not installed, because the use a relative path for the storage directory that requires them to be executed in a specific directory, which a installation might change.I have manually tested the CMake build on Ubuntu 18.04 with CMake 3.10.2.
TODO
apitest
,platformtest
andmessagingtest
fail ifOC_IPV4
is not set. Is this also the case with the Makefile build?--> No, with the Makefile build the unittests pass. There was a compile definition missing for mbedtls, Fixed in 633c82a
client_get_linux_test
hangs during execution. Is this also the case with the Makefile build?--> Yes, with the Makefile build the test hangs as well.