diff --git a/openscad.pro b/openscad.pro index 35f65ab3..89fa738a 100644 --- a/openscad.pro +++ b/openscad.pro @@ -8,6 +8,10 @@ } } +win32 { + QMAKE_LFLAGS += -VERBOSE +} + win32 { isEmpty(VERSION) VERSION = $$system(date /t) } else { diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d102f6bc..0a2a7642 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -8,6 +8,24 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Debug) endif() +set(WIN32_STATIC_BUILD "True") + +if(WIN32_STATIC_BUILD) + if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") + set(EMSG "\nTo build Win32 STATIC OpenSCAD you must run cmake .. -DCMAKE_BUILD_TYPE=Release") + set(EMSG "${EMSG} \nand replace /MD with /MT in CMakeCache.txt") + set(EMSG "${EMSG} \ni.e. sed -i s/\\/MD/\\/MT/ CMakeCache.txt") + message(FATAL_ERROR ${EMSG}) + endif() +endif() + +# Win32 linker debugging +# If you uncomment this, use nmake -F Makefile > log.txt +# (the link log can be several megabytes long) +if(WIN32) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -VERBOSE") +endif() + # Disable some warnings in Windows if(WIN32) # too long decorated names @@ -16,6 +34,8 @@ if(WIN32) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800") # unreferenced parameters in CGAL set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4100") + # fopen_s advertisement + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_DEPRECATE") endif() # @@ -72,9 +92,14 @@ include_directories(${OPENCSG_INCLUDE_DIR}) if () set(GLEW_DIR "$ENV{MACOSX_DEPLOY_DIR}") endif() + find_package(GLEW REQUIRED) include_directories(${GLEW_INCLUDE_PATH}) +if(WIN32_STATIC_BUILD) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGLEW_STATIC") +endif() + # Flex/Bison find_package(BISON) find_package(FLEX) diff --git a/tests/FindGLEW.cmake b/tests/FindGLEW.cmake index c2dc6a25..ffbdcc6e 100644 --- a/tests/FindGLEW.cmake +++ b/tests/FindGLEW.cmake @@ -16,7 +16,13 @@ IF (WIN32) ${PROJECT_SOURCE_DIR}/src/nvgl/glew/include DOC "The directory where GL/glew.h resides") FIND_LIBRARY( GLEW_LIBRARY - NAMES glew GLEW glew32 glew32s + + # Static linked Release (non-Debug) version + NAMES glew32s.lib + + # Dynamic linked Release (non-Debug) version + # NAMES glew32.lib + PATHS $ENV{PROGRAMFILES}/GLEW/lib ${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin diff --git a/tests/csgtermtest.cc b/tests/csgtermtest.cc index 7688fc76..80b9b9c0 100644 --- a/tests/csgtermtest.cc +++ b/tests/csgtermtest.cc @@ -41,7 +41,9 @@ #include #include #include +#ifndef _MSC_VER #include +#endif #include #include #include diff --git a/tests/csgtexttest.cc b/tests/csgtexttest.cc index 3c4451d6..6badcfb0 100644 --- a/tests/csgtexttest.cc +++ b/tests/csgtexttest.cc @@ -39,7 +39,9 @@ #include #include #include +#ifndef _MSC_VER #include +#endif #include #include #include diff --git a/tests/dumptest.cc b/tests/dumptest.cc index 65424b3b..e9536893 100644 --- a/tests/dumptest.cc +++ b/tests/dumptest.cc @@ -39,7 +39,9 @@ #include #include #include +#ifndef _MSC_VER #include +#endif #include #include #include