Skip to content

Commit

Permalink
rocks: unable to install with tarantoolctl rocks on Linux
Browse files Browse the repository at this point in the history
On any platforms many targets from subdirectories are included into make
command by default. They are not necessary to build driver.{so|dylib}.
EXCLUDE_FROM_ALL option disables all targets at the beginning and only targets
which are explicitly added to mqtt dependencies will be built.

Static build option for libmosquitto set by default in rocks. That means there
is no more need to install libmosquitto manually for successful build from rocks.
But there is still an opportunity to add some other build options in CMake,
if it is needed.

WITH_PIC added as an option. This is related to the CMP0077 policy.
https://cmake.org/cmake/help/latest/policy/CMP0077.html. Without this
change the behaviour is the following. If the module builds statically,
WITH_PIC is firstly set on, but the effect of this will be discarded by
option(WITH_PIC <...> OFF) in third_party/mosquitto/lib/CMakeLists.txt.
This way the build fails.

Fixes #39
  • Loading branch information
vr009 authored and Totktonada committed Jan 25, 2022
1 parent 794dc18 commit db28374
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mqtt-scm-1.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ build = {
CMAKE_BUILD_TYPE="RelWithDebInfo";
TARANTOOL_INSTALL_LIBDIR="$(LIBDIR)";
TARANTOOL_INSTALL_LUADIR="$(LUADIR)";
STATIC_BUILD="$(STATIC_BUILD)";
STATIC_BUILD="ON";
};
platforms = {
macosx = {
Expand Down
3 changes: 2 additions & 1 deletion mqtt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
option(DOCUMENTATION "Build documentation?" OFF)

option(WITH_STATIC_LIBRARIES "Build static versions of the libmosquitto/pp libraries?" OFF)
option(WITH_PIC "Build the static library with PIC (Position Independent Code) enabled archives?" OFF)

if( STATIC_BUILD )
set(WITH_STATIC_LIBRARIES ON)
Expand All @@ -20,7 +21,7 @@ add_library(driver SHARED driver.c)

if( DEFINED STATIC_BUILD )
set(CMAKE_C_FLAGS "-ldl -lpthread")
add_subdirectory(../third_party/mosquitto ../third_party/mosquitto/build)
add_subdirectory(../third_party/mosquitto ../third_party/mosquitto/build EXCLUDE_FROM_ALL)
include_directories(../third_party/mosquitto/lib)
if( STATIC_BUILD )
target_link_libraries(driver libmosquitto_static ${LDFLAGS_EX})
Expand Down

0 comments on commit db28374

Please sign in to comment.