-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Build sdk as a dynamic library with -fPIC and release flags #37
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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.
if(UNIX) | ||
if(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") | ||
endif() | ||
endif() | ||
|
There was a problem hiding this comment.
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:
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() | ||
|
There was a problem hiding this comment.
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
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This above suggestions
SHARED |
No description provided.