diff --git a/CMOD/src/Libraries.h b/CMOD/src/Libraries.h index e2b6d72e..bb9f5f21 100644 --- a/CMOD/src/Libraries.h +++ b/CMOD/src/Libraries.h @@ -52,9 +52,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include -//Pseudo-standard, but widely used headers -#include - //The LASS library for additive sound synthesis #include "LASS.h" #include "Score.h" diff --git a/CMOD/src/Piece-experimental.cpp b/CMOD/src/Piece-experimental.cpp index bb9525e1..2b613180 100644 --- a/CMOD/src/Piece-experimental.cpp +++ b/CMOD/src/Piece-experimental.cpp @@ -37,6 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include +#include #include #ifdef _WIN32 @@ -45,17 +46,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //----------------------------------------------------------------------------// int PieceHelper::getDirectoryList(string dir, vector &files) { - DIR *dp; - struct dirent *dirp; - if((dp = opendir(dir.c_str())) == NULL) { - cout << "Error(" << errno << ") opening " << dir << endl; - return errno; + error_code error; + filesystem::directory_iterator entries(dir, error); + if(error) { + cout << "Error(" << error.value() << ") opening " << dir << endl; + return error.value(); } - while ((dirp = readdir(dp)) != NULL) { - files.push_back(string(dirp->d_name)); + for(const filesystem::directory_entry& entry : entries) { + files.push_back(entry.path().filename().string()); } - closedir(dp); return 0; } diff --git a/cmake-modules/FindSndFile.cmake b/cmake-modules/FindSndFile.cmake index 689c930a..716d6963 100644 --- a/cmake-modules/FindSndFile.cmake +++ b/cmake-modules/FindSndFile.cmake @@ -48,8 +48,17 @@ function(_dissco_sndfile_extract_from_target) return() endif() get_target_property(_inc SndFile::sndfile INTERFACE_INCLUDE_DIRECTORIES) - # IMPORTED_LOCATION_ is the actual file; LOCATION may be a - # generator expression. Try a few common configs. + # On Windows, a shared imported target has both an import library (used by + # the linker) and a runtime DLL. Prefer IMPORTED_IMPLIB_ for the + # former; other platforms link IMPORTED_LOCATION_ directly. + foreach(_cfg IMPORTED_IMPLIB_RELEASE IMPORTED_IMPLIB_RELWITHDEBINFO + IMPORTED_IMPLIB_MINSIZEREL IMPORTED_IMPLIB_DEBUG + IMPORTED_IMPLIB) + get_target_property(_implib SndFile::sndfile ${_cfg}) + if(_implib AND NOT _implib STREQUAL "_implib-NOTFOUND") + break() + endif() + endforeach() foreach(_cfg IMPORTED_LOCATION_RELEASE IMPORTED_LOCATION_RELWITHDEBINFO IMPORTED_LOCATION_MINSIZEREL IMPORTED_LOCATION_DEBUG IMPORTED_LOCATION) @@ -58,9 +67,19 @@ function(_dissco_sndfile_extract_from_target) break() endif() endforeach() - if(_inc AND _loc) + if(WIN32 AND _implib) + set(_link_file "${_implib}") + else() + set(_link_file "${_loc}") + endif() + if(_inc AND _link_file) set(SNDFILE_INCLUDE_DIR "${_inc}" PARENT_SCOPE) - set(SNDFILE_LIBRARY "${_loc}" PARENT_SCOPE) + set(SNDFILE_LIBRARY "${_link_file}" PARENT_SCOPE) + if(WIN32 AND _loc MATCHES "\\.dll$") + set(SNDFILE_DLL "${_loc}" CACHE FILEPATH + "Path to the libsndfile runtime DLL." FORCE) + set(SNDFILE_DLL "${_loc}" PARENT_SCOPE) + endif() set(SNDFILE_FOUND TRUE PARENT_SCOPE) endif() endfunction() diff --git a/external-libs/muParser/CMakeLists.txt b/external-libs/muParser/CMakeLists.txt index dfd0b7a1..1e31abc5 100644 --- a/external-libs/muParser/CMakeLists.txt +++ b/external-libs/muParser/CMakeLists.txt @@ -10,7 +10,8 @@ file(GLOB_RECURSE MUPARSER_SRC ### in the future, we'll let this be shared if there's a viable muparser lib install add_library(MUPARSER STATIC ${MUPARSER_SRC}) +target_compile_definitions(MUPARSER PUBLIC MUPARSER_STATIC) target_include_directories(MUPARSER PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) -message(STATUS "DONE!") \ No newline at end of file +message(STATUS "DONE!")