Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Fixed issues with Dockerfile when compiling the new code structure wi…
Browse files Browse the repository at this point in the history
…th the library.
  • Loading branch information
MintoDA1 authored and MintoDA1 committed Aug 4, 2023
1 parent 8e74566 commit 023c420
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ SET(MOD ${CMAKE_SOURCE_DIR}/include)
#SET(TEST ${CMAKE_SOURCE_DIR}/test)
SET(PY ${CMAKE_SOURCE_DIR}/python/swiftest)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIB})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIB})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${BIN})


FUNCTION(REPLACE_VERSION IN_FILE LANGUAGE)
# Make list of strings from file
FILE(STRINGS ${IN_FILE} LINES)
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ ENV LIBS="-lhdf5_hl -lhdf5 -lz"
COPY ./cmake/ /swiftest/cmake/
COPY ./src/ /swiftest/src/
COPY ./CMakeLists.txt /swiftest/
COPY ./python/ /swiftest/python/
COPY ./version.txt /swiftest/
RUN cd swiftest && \
cmake -S . -B build -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-DMACHINE_CODE_VALUE=${MACHINE_CODE_VALUE} \
Expand Down Expand Up @@ -137,6 +139,7 @@ ENV PATH="/opt/conda/bin:${PATH}"
ENV LD_LIBRARY_PATH="/usr/local/lib"

COPY --from=build_driver /usr/local/bin/swiftest_driver /opt/conda/bin/swiftest_driver
COPY --from=build_driver /usr/local/lib/libswiftest.a /opt/conda/lib/libswiftest.a
COPY ./python/. /opt/conda/pkgs/
COPY environment.yml .

Expand Down
13 changes: 7 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ ENDIF ()
SET_SOURCE_FILES_PROPERTIES(${SWIFTEST_src} ${DRIVER_src} PROPERTIES Fortran_PREPROCESS ON)

# Create a library from the source files, except the driver
ADD_LIBRARY(swiftest ${SWIFTEST_src})
SET(SWIFTEST_LIBRARY swiftest)
ADD_LIBRARY(${SWIFTEST_LIBRARY} ${SWIFTEST_src})

# Define the executable name
SET(SWIFTEST_DRIVER swiftest_driver)
Expand Down Expand Up @@ -174,11 +175,11 @@ IF(WIN32)
ELSE()
SET(CMAKE_INSTALL_PREFIX /usr/local)
ENDIF(WIN32)
INSTALL(TARGETS swiftest ${SWIFTEST_DRIVER}
LIBRARY DESTINATION ${LIB}
ARCHIVE DESTINATION ${LIB}
RUNTIME DESTINATION ${BIN}
)
INSTALL(TARGETS ${SWIFTEST_DRIVER} ${SWIFTEST_LIBRARY}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)



0 comments on commit 023c420

Please sign in to comment.