From 55a531cea25916928ff8ffc409b7c393af6ade00 Mon Sep 17 00:00:00 2001 From: Francesco Bigoni Date: Thu, 22 Jun 2023 12:28:08 +0200 Subject: [PATCH 1/2] set CXX standard for Windows in cmake list, set linker attribute for Pd external (solves issue #53) --- README.md | 2 +- src/frontend/maxmsp/nn_tilde/CMakeLists.txt | 1 + src/frontend/puredata/nn_tilde/nn_tilde.cpp | 6 +++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 19ad94c..5890c38 100644 --- a/README.md +++ b/README.md @@ -189,7 +189,7 @@ git clone https://github.com/acids-ircam/nn_tilde --recurse-submodules cd nn_tilde mkdir build cd build -cmake ..\src -A x64 -DCMAKE_PREFIX_PATH="" +cmake ..\src -A x64 -DCMAKE_PREFIX_PATH="" -DPUREDATA_INCLUDE_DIR="" -DPUREDATA_BIN_DIR="" cmake --build . --config Release ``` diff --git a/src/frontend/maxmsp/nn_tilde/CMakeLists.txt b/src/frontend/maxmsp/nn_tilde/CMakeLists.txt index 8e58bda..27fcf89 100755 --- a/src/frontend/maxmsp/nn_tilde/CMakeLists.txt +++ b/src/frontend/maxmsp/nn_tilde/CMakeLists.txt @@ -71,6 +71,7 @@ endif() endif() if (MSVC) # COPY TORCH DLL IN THE LOADER FOLDER +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 20) add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory "${TORCH_INSTALL_PREFIX}/lib/" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/ ) diff --git a/src/frontend/puredata/nn_tilde/nn_tilde.cpp b/src/frontend/puredata/nn_tilde/nn_tilde.cpp index dc3fe0c..e1be2ad 100644 --- a/src/frontend/puredata/nn_tilde/nn_tilde.cpp +++ b/src/frontend/puredata/nn_tilde/nn_tilde.cpp @@ -273,7 +273,11 @@ void startup_message() { } extern "C" { +#ifdef _WIN32 +void __declspec(dllexport) nn_tilde_setup(void) { +#else void nn_tilde_setup(void) { +#endif startup_message(); nn_tilde_class = class_new(gensym("nn~"), (t_newmethod)nn_tilde_new, 0, sizeof(t_nn_tilde), CLASS_DEFAULT, A_GIMME, 0); @@ -288,4 +292,4 @@ void nn_tilde_setup(void) { A_GIMME, A_NULL); CLASS_MAINSIGNALIN(nn_tilde_class, t_nn_tilde, f); } -} \ No newline at end of file +} From 3c3c095cd8cbd3970326f61f127e21f84b3e39ee Mon Sep 17 00:00:00 2001 From: Antoine Date: Thu, 22 Jun 2023 19:00:36 +0200 Subject: [PATCH 2/2] remove extra CXX standard definition --- src/frontend/maxmsp/nn_tilde/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/frontend/maxmsp/nn_tilde/CMakeLists.txt b/src/frontend/maxmsp/nn_tilde/CMakeLists.txt index b9cf8ef..f197b6c 100755 --- a/src/frontend/maxmsp/nn_tilde/CMakeLists.txt +++ b/src/frontend/maxmsp/nn_tilde/CMakeLists.txt @@ -71,7 +71,6 @@ endif() endif() if (MSVC) # COPY TORCH DLL IN THE LOADER FOLDER -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 20) add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory "${TORCH_INSTALL_PREFIX}/lib/" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/ )