Browse Source

Build improvements: symlink resources properly with Visual Studio
Convert dependencies into a CMake build script in the `deps` dir

Vojtech Kral 6 years ago
parent
commit
0b0e65636f
7 changed files with 459 additions and 19 deletions
  1. 1 14
      CMakeLists.txt
  2. 31 0
      deps/CMakeLists.txt
  3. 133 0
      deps/deps-unix-static.cmake
  4. 93 0
      deps/deps-windows.cmake
  5. 168 0
      deps/wxwidgets-pngprefix.h
  6. 33 0
      src/CMakeLists.txt
  7. 0 5
      xs/CMakeLists.txt

+ 1 - 14
CMakeLists.txt

@@ -215,7 +215,7 @@ if (NOT GLEW_FOUND)
 endif ()
 include_directories(${GLEW_INCLUDE_DIRS})
 
-# Resources and l10n
+# l10n
 set(L10N_DIR "${SLIC3R_RESOURCES_DIR}/localization")
 add_custom_target(pot
     # FIXME: file list stale
@@ -225,19 +225,6 @@ add_custom_target(pot
     WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
     COMMENT "Generate pot file from strings in the source tree"
 )
-if (MSVC)
-    file(TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/src/resources" WIN_RESOURCES_SYMLINK)
-    add_custom_target(resources_symlink ALL
-        COMMAND if not exist "${WIN_RESOURCES_SYMLINK}" ( mklink /J "${WIN_RESOURCES_SYMLINK}" "${SLIC3R_RESOURCES_DIR_WIN}" )
-        VERBATIM
-    )
-else ()
-    add_custom_target(resources_symlink ALL
-        COMMAND ln -sf "${SLIC3R_RESOURCES_DIR}" "${CMAKE_BINARY_DIR}/resources"
-        VERBATIM
-    )
-endif()
-
 
 # libslic3r, Slic3r GUI and the slic3r executable.
 add_subdirectory(src)

+ 31 - 0
deps/CMakeLists.txt

@@ -0,0 +1,31 @@
+project(Slic3r-deps)
+cmake_minimum_required(VERSION 3.2)
+
+include(ExternalProject)
+
+include(ProcessorCount)
+ProcessorCount(NPROC)
+if (NPROC EQUAL 0)
+    set(NPROC 1)
+endif ()
+
+if (MSVC)
+    set(DEPS_BITS 64)
+    set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir-64")
+    include("deps-windows.cmake")
+    set(DEPS_BITS 32)
+    set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir-32")
+    include("deps-windows.cmake")
+
+    add_custom_target(deps ALL
+        DEPENDS dep_boost_64 dep_tbb_64 dep_libcurl_64 dep_wxwidgets_64
+        #         dep_boost_32 dep_tbb_32 dep_libcurl_32 dep_wxwidgets_32
+    )
+else ()
+    set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir")
+    include("deps-unix-static.cmake")
+
+    add_custom_target(deps ALL
+        DEPENDS dep_boost dep_tbb dep_libcurl dep_wxwidgets
+    )
+endif()

+ 133 - 0
deps/deps-unix-static.cmake

@@ -0,0 +1,133 @@
+
+ExternalProject_Add(dep_boost
+    EXCLUDE_FROM_ALL 1
+    URL "https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz"
+    URL_HASH SHA256=bd0df411efd9a585e5a2212275f8762079fed8842264954675a4fddc46cfcf60
+    BUILD_IN_SOURCE 1
+    CONFIGURE_COMMAND ./bootstrap.sh
+        --with-libraries=system,filesystem,thread,log,locale,regex
+        "--prefix=${INSTALL_DIR}/usr/local"
+    BUILD_COMMAND ./b2
+        -j ${NPROC}
+        link=static
+        variant=release
+        threading=multi
+        boost.locale.icu=off
+        cxxflags=-fPIC cflags=-fPIC
+        install
+    INSTALL_COMMAND ""   # b2 does that already
+    LOG_CONFIGURE 1
+    LOG_BUILD 1
+)
+
+ExternalProject_Add(dep_tbb
+    EXCLUDE_FROM_ALL 1
+    URL "https://github.com/wjakob/tbb/archive/a0dc9bf76d0120f917b641ed095360448cabc85b.tar.gz"
+    URL_HASH SHA256=0545cb6033bd1873fcae3ea304def720a380a88292726943ae3b9b207f322efe
+    BUILD_IN_SOURCE 1
+    CMAKE_ARGS -DTBB_BUILD_SHARED=OFF
+        -DTBB_BUILD_TESTS=OFF
+        -DCMAKE_POSITION_INDEPENDENT_CODE=ON
+    INSTALL_COMMAND make install "DESTDIR=${INSTALL_DIR}"
+    LOG_CONFIGURE 1
+    LOG_BUILD 1
+    LOG_INSTALL 1
+)
+
+ExternalProject_Add(dep_libopenssl
+    EXCLUDE_FROM_ALL 1
+    URL "https://github.com/openssl/openssl/archive/OpenSSL_1_1_0g.tar.gz"
+    URL_HASH SHA256=8e9516b8635bb9113c51a7b5b27f9027692a56b104e75b709e588c3ffd6a0422
+    BUILD_IN_SOURCE 1
+    CONFIGURE_COMMAND ./config
+        "--prefix=${INSTALL_DIR}/usr/local"
+        no-shared
+        no-ssl3-method
+        no-dynamic-engine
+        -Wa,--noexecstack
+    BUILD_COMMAND make depend && make "-j${NPROC}"
+    INSTALL_COMMAND make install_sw
+    LOG_CONFIGURE 1
+    LOG_BUILD 1
+    LOG_INSTALL 1
+)
+
+ExternalProject_Add(dep_libcurl
+    EXCLUDE_FROM_ALL 1
+    DEPENDS dep_libopenssl
+    URL "https://curl.haxx.se/download/curl-7.58.0.tar.gz"
+    URL_HASH SHA256=cc245bf9a1a42a45df491501d97d5593392a03f7b4f07b952793518d97666115
+    BUILD_IN_SOURCE 1
+    CONFIGURE_COMMAND ./configure
+        --enable-static
+        --disable-shared
+        "--with-ssl=${DESTDIR}/usr/local"
+        --with-pic
+        --enable-ipv6
+        --enable-versioned-symbols
+        --enable-threaded-resolver
+        --with-random=/dev/urandom
+        --with-ca-bundle=/etc/ssl/certs/ca-certificates.crt
+        --disable-ldap
+        --disable-ldaps
+        --disable-manual
+        --disable-rtsp
+        --disable-dict
+        --disable-telnet
+        --disable-pop3
+        --disable-imap
+        --disable-smb
+        --disable-smtp
+        --disable-gopher
+        --disable-crypto-auth
+        --without-gssapi
+        --without-libpsl
+        --without-libidn2
+        --without-gnutls
+        --without-polarssl
+        --without-mbedtls
+        --without-cyassl
+        --without-nss
+        --without-axtls
+        --without-brotli
+        --without-libmetalink
+        --without-libssh
+        --without-libssh2
+        --without-librtmp
+        --without-nghttp2
+        --without-zsh-functions-dir
+    BUILD_COMMAND make "-j${NPROC}"
+    INSTALL_COMMAND make install "DESTDIR=${INSTALL_DIR}"
+    LOG_CONFIGURE 1
+    LOG_BUILD 1
+    LOG_INSTALL 1
+)
+
+ExternalProject_Add(dep_wxwidgets
+    EXCLUDE_FROM_ALL 1
+    URL "https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.1/wxWidgets-3.1.1.tar.bz2"
+    URL_HASH SHA256=c925dfe17e8f8b09eb7ea9bfdcfcc13696a3e14e92750effd839f5e10726159e
+    BUILD_IN_SOURCE 1
+    CONFIGURE_COMMAND ./configure
+        "--prefix=${INSTALL_DIR}/usr/local"
+        --disable-shared
+        --with-gtk=2
+        --with-opengl
+        --enable-unicode
+        --enable-graphics_ctx
+        --with-regex=builtin
+        --with-libpng=builtin
+        --with-libxpm=builtin
+        --with-libjpeg=builtin
+        --with-libtiff=builtin
+        --with-zlib=builtin
+        --with-expat=builtin
+        --disable-precomp-headers
+        --enable-debug_info
+        --enable-debug_gdb
+    BUILD_COMMAND make "-j${NPROC}" && make -C locale allmo
+    INSTALL_COMMAND make install
+    LOG_CONFIGURE 1
+    LOG_BUILD 1
+    LOG_INSTALL 1
+)

+ 93 - 0
deps/deps-windows.cmake

@@ -0,0 +1,93 @@
+
+# NB: I haven't enabled any of the LOG_xxx options because they tend to generate bogus build files,
+# especially with compound commands like `cd foo && bar`.
+
+ExternalProject_Add("dep_boost_${DEPS_BITS}"
+    EXCLUDE_FROM_ALL 1
+    URL "https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz"
+    URL_HASH SHA256=bd0df411efd9a585e5a2212275f8762079fed8842264954675a4fddc46cfcf60
+    BUILD_IN_SOURCE 1
+    CONFIGURE_COMMAND bootstrap.bat
+    BUILD_COMMAND b2.exe
+        -j "${NPROC}"
+        --with-system
+        --with-filesystem
+        --with-thread
+        --with-log
+        --with-locale
+        --with-regex
+        "--prefix=${DESTDIR}/usr/local"
+        "address-model=${DEPS_BITS}"
+        toolset=msvc-12.0
+        link=static
+        variant=release
+        threading=multi
+        boost.locale.icu=off
+        install
+    INSTALL_COMMAND ""   # b2 does that already
+)
+
+
+if ($DEPS_BITS EQUAL 32)
+    set(DEP_TBB_GEN "Visual Studio 12")
+else ()
+    set(DEP_TBB_GEN "Visual Studio 12 Win64")
+endif ()
+
+ExternalProject_Add("dep_tbb_${DEPS_BITS}"
+    EXCLUDE_FROM_ALL 1
+    URL "https://github.com/wjakob/tbb/archive/a0dc9bf76d0120f917b641ed095360448cabc85b.tar.gz"
+    URL_HASH SHA256=0545cb6033bd1873fcae3ea304def720a380a88292726943ae3b9b207f322efe
+    CMAKE_GENERATOR "${DEP_TBB_GEN}"
+    CMAKE_ARGS
+        -DCMAKE_CONFIGURATION_TYPES=Release
+        -DTBB_BUILD_SHARED=OFF
+        -DTBB_BUILD_TESTS=OFF
+        "-DCMAKE_INSTALL_PREFIX:PATH=${DESTDIR}\\usr\\local"
+    BUILD_COMMAND msbuild /P:Configuration=Release INSTALL.vcxproj
+    INSTALL_COMMAND ""
+)
+
+
+if ($DEPS_BITS EQUAL 32)
+    set(DEP_LIBCURL_TARGET "x86")
+else ()
+    set(DEP_LIBCURL_TARGET "x64")
+endif ()
+
+ExternalProject_Add("dep_libcurl_${DEPS_BITS}"
+    EXCLUDE_FROM_ALL 1
+    URL "https://curl.haxx.se/download/curl-7.58.0.tar.gz"
+    URL_HASH SHA256=cc245bf9a1a42a45df491501d97d5593392a03f7b4f07b952793518d97666115
+    BUILD_IN_SOURCE 1
+    CONFIGURE_COMMAND ""
+    BUILD_COMMAND cd winbuild && nmake /f Makefile.vc mode=static VC=12 GEN_PDB=yes DEBUG=no "MACHINE=${DEP_LIBCURL_TARGET}"
+    INSTALL_COMMAND cd builds\\libcurl-*-winssl
+        && "${CMAKE_COMMAND}" -E copy_directory include "${DESTDIR}\\usr\\local\\include"
+        && "${CMAKE_COMMAND}" -E copy_directory lib "${DESTDIR}\\usr\\local\\lib"
+)
+
+if ($DEPS_BITS EQUAL 32)
+    set(DEP_WXWIDGETS_TARGET "")
+    set(DEP_WXWIDGETS_LIBDIR "vc_lib")
+else ()
+    set(DEP_WXWIDGETS_TARGET "TARGET_CPU=X64")
+    set(DEP_WXWIDGETS_LIBDIR "vc_x64_lib")
+endif ()
+
+ExternalProject_Add("dep_wxwidgets_${DEPS_BITS}"
+    EXCLUDE_FROM_ALL 1
+    URL "https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.1/wxWidgets-3.1.1.tar.bz2"
+    URL_HASH SHA256=c925dfe17e8f8b09eb7ea9bfdcfcc13696a3e14e92750effd839f5e10726159e
+    BUILD_IN_SOURCE 1
+    PATCH_COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_CURRENT_SOURCE_DIR}\\wxwidgets-pngprefix.h" src\\png\\pngprefix.h
+    CONFIGURE_COMMAND ""
+    BUILD_COMMAND cd build\\msw && nmake /f makefile.vc
+        BUILD=release
+        SHARED=0
+        UNICODE=1
+        USE_GUI=1
+        "${DEP_WXWIDGETS_TARGET}"
+    INSTALL_COMMAND "${CMAKE_COMMAND}" -E copy_directory include "${DESTDIR}\\usr\\local\\include"
+        && "${CMAKE_COMMAND}" -E copy_directory "lib\\${DEP_WXWIDGETS_LIBDIR}" "${DESTDIR}\\usr\\local\\lib\\${DEP_WXWIDGETS_LIBDIR}"
+)

+ 168 - 0
deps/wxwidgets-pngprefix.h

@@ -0,0 +1,168 @@
+// Patched in Slic3r: These two were missing:
+#define png_write_eXIf wx_png_write_eXIf
+#define png_handle_eXIf wx_png_handle_eXIf
+
+#define png_sRGB_table wx_png_sRGB_table
+#define png_sRGB_base wx_png_sRGB_base
+#define png_sRGB_delta wx_png_sRGB_delta
+#define png_zstream_error wx_png_zstream_error
+#define png_free_buffer_list wx_png_free_buffer_list
+#define png_fixed wx_png_fixed
+#define png_user_version_check wx_png_user_version_check
+#define png_malloc_base wx_png_malloc_base
+#define png_malloc_array wx_png_malloc_array
+#define png_realloc_array wx_png_realloc_array
+#define png_create_png_struct wx_png_create_png_struct
+#define png_destroy_png_struct wx_png_destroy_png_struct
+#define png_free_jmpbuf wx_png_free_jmpbuf
+#define png_zalloc wx_png_zalloc
+#define png_zfree wx_png_zfree
+#define png_default_read_data wx_png_default_read_data
+#define png_push_fill_buffer wx_png_push_fill_buffer
+#define png_default_write_data wx_png_default_write_data
+#define png_default_flush wx_png_default_flush
+#define png_reset_crc wx_png_reset_crc
+#define png_write_data wx_png_write_data
+#define png_read_sig wx_png_read_sig
+#define png_read_chunk_header wx_png_read_chunk_header
+#define png_read_data wx_png_read_data
+#define png_crc_read wx_png_crc_read
+#define png_crc_finish wx_png_crc_finish
+#define png_crc_error wx_png_crc_error
+#define png_calculate_crc wx_png_calculate_crc
+#define png_flush wx_png_flush
+#define png_write_IHDR wx_png_write_IHDR
+#define png_write_PLTE wx_png_write_PLTE
+#define png_compress_IDAT wx_png_compress_IDAT
+#define png_write_IEND wx_png_write_IEND
+#define png_write_gAMA_fixed wx_png_write_gAMA_fixed
+#define png_write_sBIT wx_png_write_sBIT
+#define png_write_cHRM_fixed wx_png_write_cHRM_fixed
+#define png_write_sRGB wx_png_write_sRGB
+#define png_write_iCCP wx_png_write_iCCP
+#define png_write_sPLT wx_png_write_sPLT
+#define png_write_tRNS wx_png_write_tRNS
+#define png_write_bKGD wx_png_write_bKGD
+#define png_write_hIST wx_png_write_hIST
+#define png_write_tEXt wx_png_write_tEXt
+#define png_write_zTXt wx_png_write_zTXt
+#define png_write_iTXt wx_png_write_iTXt
+#define png_set_text_2 wx_png_set_text_2
+#define png_write_oFFs wx_png_write_oFFs
+#define png_write_pCAL wx_png_write_pCAL
+#define png_write_pHYs wx_png_write_pHYs
+#define png_write_tIME wx_png_write_tIME
+#define png_write_sCAL_s wx_png_write_sCAL_s
+#define png_write_finish_row wx_png_write_finish_row
+#define png_write_start_row wx_png_write_start_row
+#define png_combine_row wx_png_combine_row
+#define png_do_read_interlace wx_png_do_read_interlace
+#define png_do_write_interlace wx_png_do_write_interlace
+#define png_read_filter_row wx_png_read_filter_row
+#define png_write_find_filter wx_png_write_find_filter
+#define png_read_IDAT_data wx_png_read_IDAT_data
+#define png_read_finish_IDAT wx_png_read_finish_IDAT
+#define png_read_finish_row wx_png_read_finish_row
+#define png_read_start_row wx_png_read_start_row
+#define png_zlib_inflate wx_png_zlib_inflate
+#define png_read_transform_info wx_png_read_transform_info
+#define png_do_strip_channel wx_png_do_strip_channel
+#define png_do_swap wx_png_do_swap
+#define png_do_packswap wx_png_do_packswap
+#define png_do_invert wx_png_do_invert
+#define png_do_bgr wx_png_do_bgr
+#define png_handle_IHDR wx_png_handle_IHDR
+#define png_handle_PLTE wx_png_handle_PLTE
+#define png_handle_IEND wx_png_handle_IEND
+#define png_handle_bKGD wx_png_handle_bKGD
+#define png_handle_cHRM wx_png_handle_cHRM
+#define png_handle_gAMA wx_png_handle_gAMA
+#define png_handle_hIST wx_png_handle_hIST
+#define png_handle_iCCP wx_png_handle_iCCP
+#define png_handle_iTXt wx_png_handle_iTXt
+#define png_handle_oFFs wx_png_handle_oFFs
+#define png_handle_pCAL wx_png_handle_pCAL
+#define png_handle_pHYs wx_png_handle_pHYs
+#define png_handle_sBIT wx_png_handle_sBIT
+#define png_handle_sCAL wx_png_handle_sCAL
+#define png_handle_sPLT wx_png_handle_sPLT
+#define png_handle_sRGB wx_png_handle_sRGB
+#define png_handle_tEXt wx_png_handle_tEXt
+#define png_handle_tIME wx_png_handle_tIME
+#define png_handle_tRNS wx_png_handle_tRNS
+#define png_handle_zTXt wx_png_handle_zTXt
+#define png_check_chunk_name wx_png_check_chunk_name
+#define png_check_chunk_length wx_png_check_chunk_length
+#define png_handle_unknown wx_png_handle_unknown
+#define png_chunk_unknown_handling wx_png_chunk_unknown_handling
+#define png_do_read_transformations wx_png_do_read_transformations
+#define png_do_write_transformations wx_png_do_write_transformations
+#define png_init_read_transformations wx_png_init_read_transformations
+#define png_push_read_chunk wx_png_push_read_chunk
+#define png_push_read_sig wx_png_push_read_sig
+#define png_push_check_crc wx_png_push_check_crc
+#define png_push_save_buffer wx_png_push_save_buffer
+#define png_push_restore_buffer wx_png_push_restore_buffer
+#define png_push_read_IDAT wx_png_push_read_IDAT
+#define png_process_IDAT_data wx_png_process_IDAT_data
+#define png_push_process_row wx_png_push_process_row
+#define png_push_handle_unknown wx_png_push_handle_unknown
+#define png_push_have_info wx_png_push_have_info
+#define png_push_have_end wx_png_push_have_end
+#define png_push_have_row wx_png_push_have_row
+#define png_push_read_end wx_png_push_read_end
+#define png_process_some_data wx_png_process_some_data
+#define png_read_push_finish_row wx_png_read_push_finish_row
+#define png_push_handle_tEXt wx_png_push_handle_tEXt
+#define png_push_read_tEXt wx_png_push_read_tEXt
+#define png_push_handle_zTXt wx_png_push_handle_zTXt
+#define png_push_read_zTXt wx_png_push_read_zTXt
+#define png_push_handle_iTXt wx_png_push_handle_iTXt
+#define png_push_read_iTXt wx_png_push_read_iTXt
+#define png_colorspace_set_gamma wx_png_colorspace_set_gamma
+#define png_colorspace_sync_info wx_png_colorspace_sync_info
+#define png_colorspace_sync wx_png_colorspace_sync
+#define png_colorspace_set_chromaticities wx_png_colorspace_set_chromaticities
+#define png_colorspace_set_endpoints wx_png_colorspace_set_endpoints
+#define png_colorspace_set_sRGB wx_png_colorspace_set_sRGB
+#define png_colorspace_set_ICC wx_png_colorspace_set_ICC
+#define png_icc_check_length wx_png_icc_check_length
+#define png_icc_check_header wx_png_icc_check_header
+#define png_icc_check_tag_table wx_png_icc_check_tag_table
+#define png_icc_set_sRGB wx_png_icc_set_sRGB
+#define png_colorspace_set_rgb_coefficients wx_png_colorspace_set_rgb_coefficients
+#define png_check_IHDR wx_png_check_IHDR
+#define png_do_check_palette_indexes wx_png_do_check_palette_indexes
+#define png_fixed_error wx_png_fixed_error
+#define png_safecat wx_png_safecat
+#define png_format_number wx_png_format_number
+#define png_warning_parameter wx_png_warning_parameter
+#define png_warning_parameter_unsigned wx_png_warning_parameter_unsigned
+#define png_warning_parameter_signed wx_png_warning_parameter_signed
+#define png_formatted_warning wx_png_formatted_warning
+#define png_app_warning wx_png_app_warning
+#define png_app_error wx_png_app_error
+#define png_chunk_report wx_png_chunk_report
+#define png_ascii_from_fp wx_png_ascii_from_fp
+#define png_ascii_from_fixed wx_png_ascii_from_fixed
+#define png_check_fp_number wx_png_check_fp_number
+#define png_check_fp_string wx_png_check_fp_string
+#define png_muldiv wx_png_muldiv
+#define png_muldiv_warn wx_png_muldiv_warn
+#define png_reciprocal wx_png_reciprocal
+#define png_reciprocal2 wx_png_reciprocal2
+#define png_gamma_significant wx_png_gamma_significant
+#define png_gamma_correct wx_png_gamma_correct
+#define png_gamma_16bit_correct wx_png_gamma_16bit_correct
+#define png_gamma_8bit_correct wx_png_gamma_8bit_correct
+#define png_destroy_gamma_table wx_png_destroy_gamma_table
+#define png_build_gamma_table wx_png_build_gamma_table
+#define png_safe_error wx_png_safe_error
+#define png_safe_warning wx_png_safe_warning
+#define png_safe_execute wx_png_safe_execute
+#define png_image_error wx_png_image_error
+#define png_check_keyword wx_png_check_keyword
+
+
+
+

+ 33 - 0
src/CMakeLists.txt

@@ -63,6 +63,7 @@ if(SLIC3R_GUI)
 else()
     set_target_properties(slic3r PROPERTIES OUTPUT_NAME "slic3r-console")
 endif()
+
 target_link_libraries(slic3r libslic3r)
 if (APPLE)
 #    add_compile_options(-stdlib=libc++)
@@ -111,3 +112,35 @@ if (SLIC3R_GUI)
         target_link_libraries(slic3r -ldl -lGL -lGLU)
     endif ()
 endif ()
+
+# Link the resources dir to where Slic3r GUI expects it
+if (MSVC)
+    if (CMAKE_CONFIGURATION_TYPES)
+        foreach (CONF ${CMAKE_CONFIGURATION_TYPES})
+            file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${CONF}" WIN_CONF_OUTPUT_DIR)
+            file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${CONF}/resources" WIN_RESOURCES_SYMLINK)
+            add_custom_target("resources_symlink_${CONF}" ALL
+                DEPENDS slic3r
+                COMMAND if exist "${WIN_CONF_OUTPUT_DIR}" "("
+                        if not exist "${WIN_RESOURCES_SYMLINK}" "(" 
+                            mklink /J "${WIN_RESOURCES_SYMLINK}" "${SLIC3R_RESOURCES_DIR_WIN}" 
+                        ")"
+                    ")"
+                VERBATIM
+            )
+        endforeach ()
+    else () 
+        file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}" OUTPUT_DIR)
+        add_custom_target(resources_symlink ALL
+            DEPENDS slic3r
+            COMMAND if not exist "${WIN_RESOURCES_SYMLINK}" "(" mklink /J "${WIN_RESOURCES_SYMLINK}" "${SLIC3R_RESOURCES_DIR_WIN}" ")"
+            VERBATIM
+        )
+    endif ()
+else ()
+    add_custom_target(resources_symlink ALL
+        DEPENDS slic3r
+        COMMAND ln -sf "${SLIC3R_RESOURCES_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/../resources"
+        VERBATIM
+    )
+endif()

+ 0 - 5
xs/CMakeLists.txt

@@ -207,11 +207,6 @@ install(FILES lib/Slic3r/XS.pm DESTINATION ${PERL_VENDORLIB}/Slic3r)
 enable_testing()
 get_filename_component(PERL_BIN_PATH "${PERL_EXECUTABLE}" DIRECTORY)
 if (MSVC)
-    # By default the startup project in MSVC is the 'ALL_BUILD' cmake-created project,
-    # but we want 'slic3r' as the startup one because debugging run command is associated with it.
-    # (Unfortunatelly it cannot be associated with ALL_BUILD using CMake.)
-    # Note: For some reason this needs to be set in the top-level CMakeLists.txt
-    set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT XS)
     set(PERL_PROVE "${PERL_BIN_PATH}/prove.bat")
 else ()
     set(PERL_PROVE "${PERL_BIN_PATH}/prove")