-
-
Notifications
You must be signed in to change notification settings - Fork 151
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
Statically link our code #99
Changes from 4 commits
2e30687
514836b
669743b
6eab89d
6af3667
e0fe8ad
4878f72
a9f14b0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,10 +69,6 @@ set(ANTIMICROX_MAJOR_VERSION 3) | |
set(ANTIMICROX_MINOR_VERSION 1) | ||
set(ANTIMICROX_PATCH_VERSION 3) | ||
|
||
# antilib soname version | ||
set(ANTILIB_MAJOR_VERSION 1) | ||
set(ANTILIB_VERSION "${ANTILIB_MAJOR_VERSION}") | ||
|
||
option(WITH_TESTS "Allow tests for classes" OFF) | ||
|
||
if(WITH_TESTS) | ||
|
@@ -84,7 +80,6 @@ if(UNIX) | |
option(WITH_UINPUT "Compile with support for uinput. uinput will be usable to simulate events." ON) | ||
option(WITH_XTEST "Compile with support for XTest. XTest will be usable to simulate events." ON) | ||
option(APPDATA "Build project with AppData file support." ON) | ||
option(ANTILIB_PATH "Set your own path for antilib" OFF) | ||
endif(UNIX) | ||
|
||
option(UPDATE_TRANSLATIONS "Call lupdate to update translation files from source." OFF) | ||
|
@@ -465,6 +460,8 @@ if(UNIX) | |
if(WITH_X11) | ||
LIST(APPEND LIBS ${X11_X11_LIB}) | ||
LIST(APPEND LIBS ${X11_Xi_LIB}) | ||
LIST(APPEND LIBS X11::xcb) | ||
LIST(APPEND LIBS Qt5::X11Extras) | ||
endif(WITH_X11) | ||
|
||
if(WITH_XTEST) | ||
|
@@ -489,57 +486,24 @@ if(UNIX) | |
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") | ||
endif(UNIX) | ||
|
||
if(UNIX) | ||
|
||
if(ANTILIB_PATH) | ||
ADD_DEFINITIONS(-DANTILIB_PATH="${ANTILIB_PATH}") | ||
|
||
# Generally package manager takes care of this while installing the new library, but not always | ||
# especially with cmake | ||
ADD_DEFINITIONS(-DLD_LIBRARY_PATH="${ANTILIB_PATH}:${LD_LIBRARY_PATH}") | ||
|
||
# those instructions have to be before add_executable() or add_library() is called, otherwise it has no effect | ||
set(CMAKE_INSTALL_RPATH "${ANTILIB_PATH}") | ||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) | ||
endif() | ||
|
||
add_library( antilib | ||
SHARED | ||
${antimicrox_HEADERS_MOC} | ||
${antimicrox_SOURCES} | ||
${antimicrox_FORMS_HEADERS} | ||
${antimicrox_RESOURCES_RCC} | ||
) | ||
|
||
set_target_properties(antilib PROPERTIES | ||
SOVERSION ${ANTILIB_VERSION} | ||
) | ||
|
||
|
||
#target_link_libraries (antilib Qt5::Widgets Qt5::Core Qt5::Test Qt5::Gui Qt5::Network Qt5::Concurrent ${SDL_LIBRARY} ${LIBS}) | ||
target_link_libraries (antilib Qt5::Widgets Qt5::Core Qt5::Gui Qt5::Network Qt5::Concurrent ${SDL_LIBRARY} ${LIBS}) | ||
|
||
if (WITH_X11) | ||
target_link_libraries(antilib Qt5::X11Extras) | ||
endif() | ||
if(UNIX) | ||
add_executable(antimicrox | ||
AriaMoradi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
${antimicrox_MAIN} | ||
${antimicrox_HEADERS_MOC} | ||
${antimicrox_SOURCES} | ||
${antimicrox_FORMS_HEADERS} | ||
${antimicrox_RESOURCES_RCC} | ||
) | ||
|
||
|
||
add_executable(antimicrox ${antimicrox_MAIN}) | ||
target_link_libraries (antimicrox antilib Qt5::Widgets Qt5::Core Qt5::Gui Qt5::Network Qt5::Concurrent) | ||
target_link_libraries(antimicrox Qt5::Widgets Qt5::Core Qt5::Gui Qt5::Network Qt5::Concurrent ${LIBS}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where's There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
this is a oddity in the ways we find libraries. So i think in a previous version we used anyways, I could refactor further and bring back ref: https://cmake.org/cmake/help/latest/module/FindSDL.html There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and before my changes it was empty(not set) so removing it wont change anything. |
||
|
||
endif(UNIX) | ||
endif(UNIX) | ||
|
||
|
||
# Specify out directory for final executable. | ||
if(UNIX) | ||
install(TARGETS antimicrox RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") | ||
|
||
if(ANTILIB_PATH) | ||
install(TARGETS antilib DESTINATION "${ANTILIB_PATH}") | ||
else() | ||
install(TARGETS antilib DESTINATION "${CMAKE_INSTALL_LIBDIR}") | ||
endif() | ||
|
||
install(FILES ${antimicrox_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/antimicrox") | ||
endif(UNIX) | ||
|
||
|
@@ -646,9 +610,6 @@ It is a new fork of discontinued AntiMicro.") | |
add_custom_command(TARGET antimicrox POST_BUILD | ||
COMMAND strip --strip-unneeded --remove-section=.comment --remove-section=.note "${CMAKE_CURRENT_BINARY_DIR}/bin/antimicrox" VERBATIM) | ||
|
||
add_custom_command(TARGET antimicrox POST_BUILD | ||
COMMAND strip --strip-unneeded --remove-section=.comment --remove-section=.note "${CMAKE_CURRENT_BINARY_DIR}/libantilib.so.1" VERBATIM) | ||
|
||
endif() | ||
|
||
set(CPACK_PACKAGE_EXECUTABLES "antimicrox" "antimicrox") | ||
|
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.
I have a suspicion that
xcb
linking was not needed because this used to be compiled as a shared library, it was only linked dynamically, andxcb
is a requirement forqt
so it's available at runtime. @pktiuk is this a wild guess?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.
We directly need xcb because some functions fro xcb/xcb.h where used.
And these are not a part of qt in any ways possible..