diff --git a/CMakeLists.txt b/CMakeLists.txt index b5f7cdec2..2b860068b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,15 +50,16 @@ if(NOT DEFINED CMAKE_PREFIX_PATH) endif() endif() +add_subdirectory(xs) + 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.) - set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT slic3r) + # 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) endif () -add_subdirectory(xs) - enable_testing () get_filename_component(PERL_BIN_PATH "${PERL_EXECUTABLE}" DIRECTORY) add_test (NAME xs COMMAND "${PERL_EXECUTABLE}" ${PERL_BIN_PATH}/prove -I ${PROJECT_SOURCE_DIR}/local-lib/lib/perl5 WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/xs) diff --git a/cmake/msvc/slic3r.wperl64d.props b/cmake/msvc/slic3r.wperl64d.props deleted file mode 100644 index 68dac2085..000000000 --- a/cmake/msvc/slic3r.wperl64d.props +++ /dev/null @@ -1,9 +0,0 @@ - - - - C:\wperl64d\bin\perl.exe - slic3r.pl - WindowsLocalDebugger - ..\.. - - diff --git a/cmake/msvc/xs.wperl64d.props b/cmake/msvc/xs.wperl64d.props index 101923581..b604a56e2 100644 --- a/cmake/msvc/xs.wperl64d.props +++ b/cmake/msvc/xs.wperl64d.props @@ -8,4 +8,11 @@ + + + C:\wperl64d\bin\perl.exe + slic3r.pl + WindowsLocalDebugger + ..\.. + diff --git a/doc/How to build - Windows.md b/doc/How to build - Windows.md index 8209954bd..104720b34 100644 --- a/doc/How to build - Windows.md +++ b/doc/How to build - Windows.md @@ -50,7 +50,6 @@ and use these commands to build the Slic3r from the command line: cd build cmake .. -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release nmake - ctest --verbose # TODO: ??? cd .. perl slic3r.pl @@ -60,27 +59,34 @@ You may also build Slic3r PE with other build tools: ### Building with Visual Studio -To build, lanuch and/or debug Slic3r PE with Visual Studio (64 bits), replace the `cmake` command with: +To build and debug Slic3r PE with Visual Studio (64 bits), replace the `cmake` command with: - cmake .. -G "Visual Studio 12 Win64" -DCMAKE_CONFIGURATION_TYPES=Release;RelWithDebInfo || exit /b + cmake .. -G "Visual Studio 12 Win64" -DCMAKE_CONFIGURATION_TYPES=RelWithDebInfo For the 32-bit variant, use: - cmake .. -G "Visual Studio 12" -DCMAKE_CONFIGURATION_TYPES=Release;RelWithDebInfo || exit /b + cmake .. -G "Visual Studio 12" -DCMAKE_CONFIGURATION_TYPES=RelWithDebInfo -After `cmake` has finished, go to the `Slic3r\build` directory and open the `Slic3r.sln` solution file. -This should open Visual Studio and load all the Slic3r solution containing all the projects. +After `cmake` has finished, go to the build directory and open the `Slic3r.sln` solution file. +This should open Visual Studio and load the Slic3r solution containing all the projects. Make sure you use Visual Studio 2013 to open the solution. -You can then use the usual Visual Studio controls to build Slic3r. -If you want to run or debug Slic3r from within Visual Studio, make sure the `slic3r` project is activated. -There are multiple projects in the Slic3r solution, but only the `slic3r` project is configured with the right -commands to run Slic3r. +You can then use the usual Visual Studio controls to build Slic3r (Hit `F5` to build and run with debugger). +If you want to run or debug Slic3r from within Visual Studio, make sure the `XS` project is activated. +It should be set as the Startup project by CMake by default, but you might want to check anyway. +There are multiple projects in the Slic3r solution, but only the `XS` project is configured with the right +commands to run and debug Slic3r. +The above cmake commands generate Visual Studio project files with the `RelWithDebInfo` configuration only. +If you also want to use the `Release` configuration, you can generate Visual Studio projects with: + + -DCMAKE_CONFIGURATION_TYPES=Release;RelWithDebInfo + +(The `Debug` configuration is not supported as of now.) ### Building with ninja -To use [Ninja](TODO), replace the `cmake` and `nmake` commands with: +To use [Ninja](https://ninja-build.org/), replace the `cmake` and `nmake` commands with: cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release ninja diff --git a/xs/CMakeLists.txt b/xs/CMakeLists.txt index 590b5d24f..db7a3eead 100644 --- a/xs/CMakeLists.txt +++ b/xs/CMakeLists.txt @@ -626,14 +626,9 @@ elseif (NOT MSVC) endif () if (MSVC) - # Here we associate some additional properties with the MSVC projects to enable compilation and debugging out of the box. - # It seems a props file needs to be copied to the same dir as the proj file, otherwise MSVC doesn't load it up. - # For copying, the configure_file() function seems to work much better than the file() function. - configure_file("${PROJECT_SOURCE_DIR}/cmake/msvc/xs.wperl64d.props" ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) - set_target_properties(XS PROPERTIES VS_USER_PROPS "xs.wperl64d.props") - configure_file("${PROJECT_SOURCE_DIR}/cmake/msvc/slic3r.wperl64d.props" ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) - set_target_properties(slic3r PROPERTIES VS_USER_PROPS "slic3r.wperl64d.props") -endif () + # Here we associate some additional properties with the MSVC project to enable compilation and debugging out of the box. + set_target_properties(XS PROPERTIES VS_USER_PROPS "${PROJECT_SOURCE_DIR}/cmake/msvc/xs.wperl64d.props") +endif() # Installation