Skip to content
This repository has been archived by the owner on Dec 1, 2020. It is now read-only.

Commit

Permalink
Add TUV_CREATE_SHARED_LIB option in makefile (#111)
Browse files Browse the repository at this point in the history
libtuv-DCO-1.0-Signed-off-by: Hosung Kim [email protected]
  • Loading branch information
hs0225 authored and yichoi committed Jun 4, 2018
1 parent 1cd6395 commit 713596b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ unset(BUILDTESTER CACHE)
unset(BUILDAPIEMULTESTER CACHE)
unset(BUILD_TEST_LIB CACHE)
unset(BUILD_HOST_HELPER CACHE)
unset(CREATE_SHARED_LIB CACHE)
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ TUV_SYSTEMROOT ?= default
TUV_BUILDTESTER ?= yes
TUV_BUILDAPIEMULTESTER ?= no
TUV_BUILDHOSTHELPER ?= no
TUV_CREATE_SHARED_LIB ?= no

OUTPUT_ROOT := build
BUILD_FOLDER := ./$(OUTPUT_ROOT)/$(TUV_PLATFORM)/$(TUV_BUILD_TYPE)
Expand All @@ -38,7 +39,8 @@ CMAKE_DEFINES := \
-DCMAKE_BUILD_TYPE=$(TUV_BUILD_TYPE) \
-DTARGET_PLATFORM=$(TUV_PLATFORM) \
-DBUILDTESTER=${TUV_BUILDTESTER} \
-DBUILD_HOST_HELPER=${TUV_BUILDHOSTHELPER}
-DBUILD_HOST_HELPER=${TUV_BUILDHOSTHELPER} \
-DCREATE_SHARED_LIB=${TUV_CREATE_SHARED_LIB}

ifneq ($(TUV_BOARD),unknown)
CMAKE_DEFINES += -DTARGET_BOARD=${TUV_BOARD}
Expand Down
18 changes: 10 additions & 8 deletions cmake/libtuv.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,16 @@ set_target_properties(${TARGETLIBNAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${BIN_OUT}")

# build tuv shared library
set(TARGETSHAREDLIBNAME tuv_shared)
add_library(${TARGETSHAREDLIBNAME} SHARED ${LIB_TUV_SRCFILES})
target_include_directories(${TARGETSHAREDLIBNAME} SYSTEM PRIVATE ${TARGET_INC})
target_include_directories(${TARGETSHAREDLIBNAME} PUBLIC ${LIB_TUV_INCDIRS})
set_target_properties(${TARGETSHAREDLIBNAME} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${LIB_OUT}"
COMPILE_FLAGS -fPIC
OUTPUT_NAME tuv)
if (DEFINED CREATE_SHARED_LIB AND CREATE_SHARED_LIB STREQUAL "yes")
set(TARGETSHAREDLIBNAME tuv_shared)
add_library(${TARGETSHAREDLIBNAME} SHARED ${LIB_TUV_SRCFILES})
target_include_directories(${TARGETSHAREDLIBNAME} SYSTEM PRIVATE ${TARGET_INC})
target_include_directories(${TARGETSHAREDLIBNAME} PUBLIC ${LIB_TUV_INCDIRS})
set_target_properties(${TARGETSHAREDLIBNAME} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${LIB_OUT}"
COMPILE_FLAGS -fPIC
OUTPUT_NAME tuv)
endif()

if(DEFINED COPY_TARGET_LIB)
add_custom_command(TARGET ${TARGETLIBNAME} POST_BUILD
Expand Down

0 comments on commit 713596b

Please sign in to comment.