Skip to content
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

build libscr_base.so #454

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ LIST(APPEND cliscr_noMPI_srcs
scr_meta.c
scr_param.c
scr_util.c
scr_rebuild_xor.c
scr_rebuild_partner.c
scr_rebuild_rs.c
)

LIST(APPEND libscr_srcs
Expand Down Expand Up @@ -94,8 +91,22 @@ SET_TARGET_PROPERTIES(scr-static PROPERTIES OUTPUT_NAME scr CLEAN_DIRECT_OUTPUT
INSTALL(TARGETS scr-static DESTINATION ${CMAKE_INSTALL_LIBDIR})

# Non-MPI library for CLI
ADD_LIBRARY(scr_base STATIC $<TARGET_OBJECTS:scr_base_o>)
TARGET_LINK_LIBRARIES(scr_base ${SCR_EXTERNAL_SERIAL_LIBS})
IF(BUILD_SHARED_LIBS)
ADD_LIBRARY(scr_base SHARED $<TARGET_OBJECTS:scr_base_o>)
TARGET_LINK_LIBRARIES(scr_base ${SCR_EXTERNAL_SERIAL_LIBS})
SET_TARGET_PROPERTIES(scr_base PROPERTIES OUTPUT_NAME scr_base CLEAN_DIRECT_OUTPUT 1)
INSTALL(TARGETS scr_base DESTINATION ${CMAKE_INSTALL_LIBDIR})
ENDIF(BUILD_SHARED_LIBS)

ADD_LIBRARY(scr_base-static STATIC $<TARGET_OBJECTS:scr_base_o>)
IF(SCR_LINK_STATIC)
SET_TARGET_PROPERTIES(scr_base-static PROPERTIES LINK_SEARCH_START_STATIC 1)
SET_TARGET_PROPERTIES(scr_base-static PROPERTIES LINK_SEARCH_END_STATIC 1)
ENDIF(SCR_LINK_STATIC)
TARGET_LINK_LIBRARIES(scr_base-static ${SCR_EXTERNAL_SERIAL_LIBS})

SET_TARGET_PROPERTIES(scr_base-static PROPERTIES OUTPUT_NAME scr_base CLEAN_DIRECT_OUTPUT 1)
INSTALL(TARGETS scr_base-static DESTINATION ${CMAKE_INSTALL_LIBDIR})

# Fortran
IF(ENABLE_FORTRAN)
Expand Down Expand Up @@ -147,9 +158,13 @@ LIST(APPEND cliscr_c_bins

# Build and install C binaries
FOREACH(bin IN ITEMS ${cliscr_c_bins})
ADD_EXECUTABLE(${bin} ${bin}.c)
TARGET_LINK_LIBRARIES(${bin} scr_base)
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${bin} DESTINATION ${CMAKE_INSTALL_BINDIR})
ADD_EXECUTABLE(${bin} ${bin}.c)
IF(SCR_LINK_STATIC)
TARGET_LINK_LIBRARIES(${bin} scr_base-static)
ELSE(SCR_LINK_STATIC)
TARGET_LINK_LIBRARIES(${bin} scr_base)
ENDIF(SCR_LINK_STATIC)
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${bin} DESTINATION ${CMAKE_INSTALL_BINDIR})
ENDFOREACH(bin IN ITEMS ${cliscr_c_bins})

# Build and install CLI binaries that link full SCR library
Expand Down