diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f49e47459..bbf434699 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,7 +10,14 @@ option(PROFILE "Build with gprof profiling output." OFF) option(COVERAGE "Build with gcov code coverage profiling." OFF) # only on newer GCCs: -ftemplate-backtrace-limit=0 -add_compile_options(-DNO_PERL -Wall -DM_PI=3.14159265358979323846 -D_GLIBCXX_USE_C99 -DHAS_BOOL -DNOGDI -DBOOST_ASIO_DISABLE_KQUEUE) +add_compile_options(-DNO_PERL -DM_PI=3.14159265358979323846 -D_GLIBCXX_USE_C99 -DHAS_BOOL -DNOGDI -DBOOST_ASIO_DISABLE_KQUEUE) + +if (MSVC) + add_compile_options(-W4) + add_compile_options(-bigobj) +else() + add_compile_options(-Wall) +endif() if(DEFINED ENV{SLIC3R_VAR_REL}) add_compile_options(-DVAR_REL=$ENV{SLIC3R_VAR_REL}) @@ -41,13 +48,21 @@ if($ENV{TRAVIS}) endif() execute_process(COMMAND git rev-parse --short HEAD OUTPUT_VARIABLE GIT_VERSION ERROR_QUIET) - -if (CMAKE_BUILD_TYPE MATCHES Debug) - add_compile_options(-g -O0) -elseif (CMAKE_BUILD_TYPE MATCHES Release) - add_compile_options(-O3) -elseif (CMAKE_BUILD_TYPE MATCHES RelWithDebInfo) - add_compile_options(-g -O3) +if (MSVC) + if (CMAKE_BUILD_TYPE MATCHES Debug) + add_compile_options(-DEBUG -Od) + elseif (CMAKE_BUILD_TYPE MATCHES Release) + elseif (CMAKE_BUILD_TYPE MATCHES RelWithDebInfo) + add_compile_options(-DEBUG -O2) + endif() +else() + if (CMAKE_BUILD_TYPE MATCHES Debug) + add_compile_options(-g -O0) + elseif (CMAKE_BUILD_TYPE MATCHES Release) + add_compile_options(-O3) + elseif (CMAKE_BUILD_TYPE MATCHES RelWithDebInfo) + add_compile_options(-g -O3) + endif() endif() if(PROFILE) @@ -380,6 +395,9 @@ IF(wxWidgets_FOUND AND Enable_GUI) add_test(NAME TestGUI COMMAND gui_test) target_link_libraries(gui_test PUBLIC libslic3r slic3r_gui Catch ${wxWidgets_LIBRARIES} ${LIBSLIC3R_DEPENDS} ${OPENGL_LIBRARIES}) endif() + if (WIN32) + target_link_libraries(slic3r uxtheme) + endif() ELSE(wxWidgets_FOUND AND Enable_GUI) # For convenience. When we cannot continue, inform the user if (Enable_GUI)