diff --git a/CMakeLists.txt b/CMakeLists.txt index bf3a1923b..3080caa67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,12 @@ cmake_minimum_required(VERSION 3.16) project(SixtyFPS LANGUAGES CXX) include(CTest) +# Place all compiled examples into the same bin directory +# on Windows, where we'll also put the dll +if (WIN32) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +endif() + add_subdirectory(api/sixtyfps-cpp/) add_subdirectory(examples/printerdemo/cpp/) add_subdirectory(examples/printerdemo/cpp_interpreted/) diff --git a/api/sixtyfps-cpp/CMakeLists.txt b/api/sixtyfps-cpp/CMakeLists.txt index 57bef0609..4fffad101 100644 --- a/api/sixtyfps-cpp/CMakeLists.txt +++ b/api/sixtyfps-cpp/CMakeLists.txt @@ -104,6 +104,12 @@ include(GNUInstallDirs) install(FILES $ TYPE LIB) if(WIN32) install(FILES $ TYPE LIB) + # Copy the dll to the top-level bin directory, where the examples will + # will also be located, so that they can find the dll. + add_custom_target(SixtyFPS_dll_convenience ALL DEPENDS sixtyfps-cpp-shared + COMMAND ${CMAKE_COMMAND} -E copy_if_different + $ + ${CMAKE_BINARY_DIR}/bin/$) endif() install(PROGRAMS $ TYPE BIN)