Skip to content

Commit

Permalink
[cmake] build translations as library
Browse files Browse the repository at this point in the history
Signed-off-by: R4SAS <r4sas@i2pmail.org>
  • Loading branch information
r4sas committed Jun 26, 2021
1 parent 377a50f commit 9fb8e8a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ netDb
/i2pd
/libi2pd.a
/libi2pdclient.a
/libi2pdlang.a
/libi2pd.so
/libi2pdclient.so
/libi2pdlang.so
*.exe


Expand Down
17 changes: 14 additions & 3 deletions build/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ if(WITH_LIBRARY)
endif()

FILE(GLOB LANG_SRC ${LANG_SRC_DIR}/*.cpp)
add_library(libi2pdlang ${LANG_SRC})
set_target_properties(libi2pdlang PROPERTIES PREFIX "")

if(WITH_LIBRARY)
install(TARGETS libi2pdlang
EXPORT libi2pdlang
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
COMPONENT Libraries)
endif()

set(DAEMON_SRC
"${DAEMON_SRC_DIR}/Daemon.cpp"
Expand Down Expand Up @@ -198,10 +208,11 @@ if(WITH_PCH)
)
target_compile_options(libi2pd PRIVATE -include libi2pd/stdafx.h)
target_compile_options(libi2pdclient PRIVATE -include libi2pd/stdafx.h)
target_compile_options(libi2pdlang PRIVATE -include libi2pd/stdafx.h)
target_link_libraries(libi2pd stdafx)
endif()

target_link_libraries(libi2pdclient libi2pd)
target_link_libraries(libi2pdclient libi2pd libi2pdlang)

find_package(Boost COMPONENTS system filesystem program_options date_time REQUIRED)
if(NOT DEFINED Boost_INCLUDE_DIRS)
Expand Down Expand Up @@ -265,7 +276,7 @@ message(STATUS "---------------------------------------")
include(GNUInstallDirs)

if(WITH_BINARY)
add_executable("${PROJECT_NAME}" ${LANG_SRC} ${DAEMON_SRC})
add_executable("${PROJECT_NAME}" ${DAEMON_SRC})

if(WITH_STATIC)
set_target_properties("${PROJECT_NAME}" PROPERTIES LINK_FLAGS "-static")
Expand Down Expand Up @@ -295,7 +306,7 @@ if(WITH_BINARY)
endif()

target_link_libraries(libi2pd ${Boost_LIBRARIES} ${ZLIB_LIBRARY})
target_link_libraries("${PROJECT_NAME}" libi2pd libi2pdclient ${DL_LIB} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${UPNP_LIB} ${ZLIB_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MINGW_EXTRA} ${DL_LIB} ${CMAKE_REQUIRED_LIBRARIES})
target_link_libraries("${PROJECT_NAME}" libi2pd libi2pdclient libi2pdlang ${DL_LIB} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${UPNP_LIB} ${ZLIB_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MINGW_EXTRA} ${DL_LIB} ${CMAKE_REQUIRED_LIBRARIES})

install(TARGETS "${PROJECT_NAME}" RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Runtime)
set(APPS "\${CMAKE_INSTALL_PREFIX}/bin/${PROJECT_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
Expand Down

0 comments on commit 9fb8e8a

Please sign in to comment.