From 023c4208d3dcf570897fb95a7187cf915d33f16e Mon Sep 17 00:00:00 2001 From: MintoDA1 <51412913+MintoDA1@users.noreply.github.com> Date: Fri, 4 Aug 2023 16:54:41 -0400 Subject: [PATCH] Fixed issues with Dockerfile when compiling the new code structure with the library. --- CMakeLists.txt | 5 +++++ Dockerfile | 3 +++ src/CMakeLists.txt | 13 +++++++------ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e646a706..83f1d7357 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/Dockerfile b/Dockerfile index 2c2b280ad..92218b80c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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} \ @@ -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 . diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c2d95aaad..29313b2ba 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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) @@ -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 +)