Skip to content

Build sdk as a dynamic library with -fPIC and release flags#37

Closed
fspindle wants to merge 1 commit intoqualisys:masterfrom
lagadic:feat_irisa
Closed

Build sdk as a dynamic library with -fPIC and release flags#37
fspindle wants to merge 1 commit intoqualisys:masterfrom
lagadic:feat_irisa

Conversation

@fspindle
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@MaximilienNaveau MaximilienNaveau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,
I made some suggestion to you PR to improve it.

Comment on lines +9 to +14
if(UNIX)
if(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()
endif()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CMake equivalent of adding -fPIC is CMAKE_POSITION_INDEPENDENT_CODE
So it should be more like this:

Suggested change
if(UNIX)
if(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()
endif()
if(SUFFIX_SO_VERSION)
option(CMAKE_POSITION_INDEPENDENT_CODE "Use position independent code" ON)
endif()

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding and forcing the compilation of the shared library you can simply add

Suggested change
option(SUFFIX_SO_VERSION "Suffix library name with its version" ON)

See suggestion below for the deletion of the SHARED parameter.

option(BUILD_EXAMPLES "Build examples" OFF)

add_library(${PROJECT_NAME}
SHARED
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This above suggestions

Suggested change
SHARED

@OliverGlandberger
Copy link
Copy Markdown
Contributor

This has now been fixed in PR #113. Thanks for the feedback! :)

Feel free to check it out and let us know if we missed something. Closing this.

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.

3 participants