Skip to content

Commit

Permalink
refined model path and install artefacts structure
Browse files Browse the repository at this point in the history
  • Loading branch information
faressc committed Mar 29, 2024
1 parent 7a03d1b commit df72816
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,15 @@ jobs:
run: |
mkdir -p ${{ env.PACKAGE_DIR }}
rm -r ${{ env.BUILD_DIR }}/${{ env.TARGET_NAME }}-${{ env.NNIT_VERSION }}/lib/cmake
mv ${{ env.BUILD_DIR }}/${{ env.TARGET_NAME }}-${{ env.NNIT_VERSION }}/bin/* ${{ env.PACKAGE_DIR }};
# Add the libs
if [ "${{ matrix.name }}" == "Linux-x86_64" ]; then
mv ${{ env.BUILD_DIR }}/${{ env.TARGET_NAME }}-${{ env.NNIT_VERSION }}/bin ${{ env.PACKAGE_DIR }};
mv "${{ env.BUILD_DIR }}/${{ env.TARGET_NAME }}_artefacts/${{ env.BUILD_TYPE }}/VST3/${{ env.RELEASE_NAME }}.vst3" ${{ env.PACKAGE_DIR }};
mv "${{ env.BUILD_DIR }}/${{ env.TARGET_NAME }}-${{ env.NNIT_VERSION }}/lib/${{ env.RELEASE_NAME }}.so" "${{ env.PACKAGE_DIR }}/${{ env.RELEASE_NAME }}.vst3/Contents/x86_64-linux/"
mv ${{ env.BUILD_DIR }}/${{ env.TARGET_NAME }}-${{ env.NNIT_VERSION }}/lib ${{ env.PACKAGE_DIR }}
cp -r ${{ env.PACKAGE_DIR }}/lib "${{ env.PACKAGE_DIR }}/${{ env.RELEASE_NAME }}.vst3/Contents/"
elif [ "${{ matrix.os }}" == "macOS-latest" ]; then
elif [ "${{ matrix.os }}" == "macOS-latest" ]; then
mv ${{ env.BUILD_DIR }}/${{ env.TARGET_NAME }}-${{ env.NNIT_VERSION }}/bin/* ${{ env.PACKAGE_DIR }};
mv "${{ env.BUILD_DIR }}/${{ env.TARGET_NAME }}-${{ env.NNIT_VERSION }}/lib/${{ env.RELEASE_NAME }}.vst3" ${{ env.PACKAGE_DIR }}/
mv "${{ env.BUILD_DIR }}/${{ env.TARGET_NAME }}-${{ env.NNIT_VERSION }}/lib/${{ env.RELEASE_NAME }}.component" ${{ env.PACKAGE_DIR }}/
# for macOS the libs are added after codesigning
Expand Down
11 changes: 3 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,9 @@ PRODUCT_NAME ${PRODUCT_NAME} # The name of the final executable, w

juce_generate_juce_header(${TARGET_NAME})

if(NOT NNITEMPLATE_WITH_INSTALL)
# Set the model path as compile definition for the build interface
set(GUITARLSTM_MODELS_PATH_TENSORFLOW "${CMAKE_CURRENT_LIST_DIR}/modules/GuitarLSTM/tensorflow-version/models/")
set(GUITARLSTM_MODELS_PATH_PYTORCH "${CMAKE_CURRENT_LIST_DIR}/modules/GuitarLSTM/pytorch-version/models/")
else()
set(GUITARLSTM_MODELS_PATH_TENSORFLOW "/usr/local/share/GuitarLSTM/tensorflow-version/models/")
set(GUITARLSTM_MODELS_PATH_PYTORCH "/usr/local/share/GuitarLSTM/pytorch-version/models/")
endif()
# Set the model path as compile definition for the build interface
set(GUITARLSTM_MODELS_PATH_TENSORFLOW "${CMAKE_CURRENT_LIST_DIR}/modules/GuitarLSTM/tensorflow-version/models/")
set(GUITARLSTM_MODELS_PATH_PYTORCH "${CMAKE_CURRENT_LIST_DIR}/modules/GuitarLSTM/pytorch-version/models/")

target_compile_definitions(${TARGET_NAME}
PUBLIC
Expand Down
13 changes: 12 additions & 1 deletion cmake/install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,25 @@ include(GNUInstallDirs)
# define the dircetory where the library will be installed CMAKE_INSTALL_PREFIX
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}-${PROJECT_VERSION}" CACHE PATH "Where the library will be installed to" FORCE)

# ==============================================================================
# Install specific compile definition
# ==============================================================================

if(NNITEMPLATE_WITH_INSTALL)
target_compile_definitions(${TARGET_NAME}
PUBLIC
INSTALL_VERSION
)
endif()

# at install the rpath is cleared by default so we have to set it again for the installed shared library to find the other libraries
# in this case we set the rpath to the directories where the other libraries are installed
# $ORIGIN in Linux is a special token that gets replaced by the directory of the library at runtime from that point we could navigate to the other libraries
# The same token for macOS is @loader_path
if(LINUX)
set_target_properties(${TARGET_NAME}_Standalone
PROPERTIES
INSTALL_RPATH "$ORIGIN/lib"
INSTALL_RPATH "$ORIGIN/../lib"
)
set_target_properties(${TARGET_NAME}_VST3
PROPERTIES
Expand Down

0 comments on commit df72816

Please sign in to comment.