Skip to content

Commit

Permalink
further changes for MSVC build to get static linking working
Browse files Browse the repository at this point in the history
  • Loading branch information
kunstmusik committed Dec 7, 2017
1 parent ffbcf82 commit d91edd4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
14 changes: 3 additions & 11 deletions interfaces/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ if(BUILD_CXX_INTERFACE)
add_library(libcsnd6 SHARED ${libcsnd6_SRCS})
set(libcsnd6_LIBS ${LIBSNDFILE_LIBRARY} )

if(WIN32 AND NOT MSVC)
if(WIN32)
list(APPEND libcsnd6_LIBS "${LIBSNDFILE_SUPPORT_LIBS}")
# mingw64 needs this to create a valid .pyd.
if(CMAKE_SIZEOF_VOID_P EQUAL 8)

if(NOT MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 8)
target_compile_definitions(libcsnd6 PRIVATE -DMS_WIN64)
endif()
endif()
Expand Down Expand Up @@ -97,11 +98,7 @@ if(BUILD_PYTHON_INTERFACE OR BUILD_JAVA_INTERFACE OR BUILD_LUA_INTERFACE)
set(CMAKE_SWIG_OUTDIR ${BUILD_LIB_DIR})
if(BUILD_PYTHON_INTERFACE)
if(WIN32)
if(NOT MSVC)
set(swigpython_LIBS ${CSOUNDLIB} ${LIBSNDFILE_LIBRARY} ${LIBSNDFILE_SUPPORT_LIBS} ${PYTHON_LIBRARY} libcsnd6)
else()
set(swigpython_LIBS ${CSOUNDLIB} ${LIBSNDFILE_LIBRARY} ${PYTHON_LIBRARY} libcsnd6)
endif()
else()
# Note: Do not link to PYTHON_LIBRARY so that it can be loaded in any python
set(swigpython_LIBS ${CSOUNDLIB} ${LIBSNDFILE_LIBRARY} libcsnd6)
Expand Down Expand Up @@ -141,13 +138,8 @@ if(BUILD_PYTHON_INTERFACE OR BUILD_JAVA_INTERFACE OR BUILD_LUA_INTERFACE)
message(STATUS "JNI INCLUDE set to ${JNI_INCLUDE_DIRS}.")

if(WIN32)
if(NOT MSVC)
set(swigjava_LIBS ${JNI_LIBRARIES} ${CSOUNDLIB}
${LIBSNDFILE_LIBRARY} ${LIBSNDFILE_SUPPORT_LIBS} libcsnd6)
else()
set(swigjava_LIBS ${JNI_LIBRARIES} ${CSOUNDLIB}
${LIBSNDFILE_LIBRARY} libcsnd6)
endif()
elseif(APPLE)
set(swigjava_LIBS ${JAVA_VM_LIBRARY} ${CSOUNDLIB}
${LIBSNDFILE_LIBRARY} libcsnd6)
Expand Down
2 changes: 1 addition & 1 deletion util/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set(stdutil_SRCS

if(MSVC)
make_plugin(stdutil "${stdutil_SRCS}" )
target_link_libraries(stdutil ${LIBSNDFILE_LIBRARY})
target_link_libraries(stdutil ${LIBSNDFILE_LIBRARY} ${LIBSNDFILE_SUPPORT_LIBS})
elseif(WIN32)
make_plugin(stdutil "${stdutil_SRCS}" m
${LIBSNDFILE_LIBRARY} ${LIBSNDFILE_SUPPORT_LIBS})
Expand Down

0 comments on commit d91edd4

Please sign in to comment.