Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-06-26 21:18:37 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-06-26 21:18:37 +0400
commit4b1cceddbde5a9c887928c6234aee21f4c62d4ce (patch)
tree516a44280e0bbc261a83ae6d33a3b6594441219e
parent31f0b6639ac4f7f9748baea1844abefeeec64d7c (diff)
fix for building with msvc/cmake take 2 (think its correct this time)
also sync build flags with scons.
-rw-r--r--CMakeLists.txt12
-rw-r--r--build_files/cmake/macros.cmake35
2 files changed, 31 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a92041c00a4..d65e62d88fc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -544,13 +544,13 @@ elseif(WIN32)
if(MSVC)
if(CMAKE_CL_64)
- set(LLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid )
+ set(LLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid)
else()
- set(LLIBS kernel32 user32 gdi32 comdlg32 advapi32 shell32 ole32 oleaut32 uuid ws2_32 vfw32 winmm)
+ set(LLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid)
endif()
- set(CMAKE_CXX_FLAGS "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /we4013 /wd4018 /wd4800 /wd4244 /wd4305 /wd4065 /wd4267" CACHE STRING "MSVC MT C++ flags " FORCE)
- set(CMAKE_C_FLAGS "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /we4013 /wd4018 /wd4800 /wd4244 /wd4305 /wd4065 /wd4267" CACHE STRING "MSVC MT C++ flags " FORCE)
+ set(CMAKE_CXX_FLAGS "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_CONSOLE /D_LIB /nologo /Ob1 /J /W0 /Gd /wd4018 /wd4244 /wd4305 /wd4800 /wd4065 /wd4267 /we4013" CACHE STRING "MSVC MT C++ flags " FORCE)
+ set(CMAKE_C_FLAGS "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_CONSOLE /D_LIB /nologo /Ob1 /J /W0 /Gd /wd4018 /wd4244 /wd4305 /wd4800 /wd4065 /wd4267 /we4013 /EHsc" CACHE STRING "MSVC MT C++ flags " FORCE)
if(CMAKE_CL_64)
set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
@@ -695,9 +695,9 @@ elseif(WIN32)
# MSVC only, Mingw doesnt need
if(CMAKE_CL_64)
- set(PLATFORM_LINKFLAGS "/MACHINE:X64 /NODEFAULTLIB:libc.lib /STACK:2097152 ")
+ set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /MACHINE:X64 /STACK:2097152 /OPT:NOREF /INCREMENTAL:NO /NODEFAULTLIB:\"msvcrt.lib\" /NODEFAULTLIB:\"msvcmrt.lib\" /NODEFAULTLIB:\"msvcurt.lib\" /NODEFAULTLIB:\"msvcrtd.lib\" ")
else()
- set(PLATFORM_LINKFLAGS "/NODEFAULTLIB:libc.lib /STACK:2097152 ")
+ set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /MACHINE:IX86 /STACK:2097152 /INCREMENTAL:NO /LARGEADDRESSAWARE /NODEFAULTLIB:\"msvcrt.lib\" /NODEFAULTLIB:\"msvcmrt.lib\" /NODEFAULTLIB:\"msvcurt.lib\" /NODEFAULTLIB:\"msvcrtd.lib\" ")
endif()
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib;libc.lib ")
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 1800c4eb826..8ae73451e31 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -39,6 +39,21 @@ macro(file_list_suffix
endmacro()
+
+macro(target_link_libraries_optimized TARGET LIBS)
+ foreach(_LIB ${LIBS})
+ target_link_libraries(${TARGET} optimized "${_LIB}")
+ endforeach()
+ unset(_LIB)
+endmacro()
+
+macro(target_link_libraries_debug TARGET LIBS)
+ foreach(_LIB ${LIBS})
+ target_link_libraries(${TARGET} debug "${_LIB}")
+ endforeach()
+ unset(_LIB)
+endmacro()
+
# Nicer makefiles with -I/1/foo/ instead of -I/1/2/3/../../foo/
# use it instead of include_directories()
macro(blender_include_dirs
@@ -202,8 +217,8 @@ macro(setup_liblinks
if(WIN32 AND NOT UNIX)
file_list_suffix(PYTHON_LIBRARIES_DEBUG "${PYTHON_LIBRARIES}" "_d")
- target_link_libraries(${target} debug ${PYTHON_LIBRARIES_DEBUG})
- target_link_libraries(${target} optimized ${PYTHON_LIBRARIES})
+ target_link_libraries_debug(${target} "${PYTHON_LIBRARIES_DEBUG}")
+ target_link_libraries_optimized(${target} "${PYTHON_LIBRARIES}")
unset(PYTHON_LIBRARIES_DEBUG)
else()
target_link_libraries(${target} ${PYTHON_LIBRARIES})
@@ -256,8 +271,8 @@ macro(setup_liblinks
if(WITH_IMAGE_OPENEXR)
if(WIN32 AND NOT UNIX)
file_list_suffix(OPENEXR_LIBRARIES_DEBUG "${OPENEXR_LIBRARIES}" "_d")
- target_link_libraries(${target} debug ${OPENEXR_LIBRARIES_DEBUG})
- target_link_libraries(${target} optimized ${OPENEXR_LIBRARIES})
+ target_link_libraries_debug(${target} "${OPENEXR_LIBRARIES_DEBUG}")
+ target_link_libraries_optimized(${target} "${OPENEXR_LIBRARIES}")
unset(OPENEXR_LIBRARIES_DEBUG)
else()
target_link_libraries(${target} ${OPENEXR_LIBRARIES})
@@ -272,19 +287,19 @@ macro(setup_liblinks
if(WITH_OPENCOLLADA)
if(WIN32 AND NOT UNIX)
file_list_suffix(OPENCOLLADA_LIBRARIES_DEBUG "${OPENCOLLADA_LIBRARIES}" "_d")
- target_link_libraries(${target} debug ${OPENCOLLADA_LIBRARIES_DEBUG})
- target_link_libraries(${target} optimized ${OPENCOLLADA_LIBRARIES})
+ target_link_libraries_debug(${target} "${OPENCOLLADA_LIBRARIES_DEBUG}")
+ target_link_libraries_optimized(${target} "${OPENCOLLADA_LIBRARIES}")
unset(OPENCOLLADA_LIBRARIES_DEBUG)
file_list_suffix(PCRE_LIB_DEBUG "${PCRE_LIB}" "_d")
- target_link_libraries(${target} debug ${PCRE_LIB_DEBUG})
- target_link_libraries(${target} optimized ${PCRE_LIB})
+ target_link_libraries_debug(${target} "${PCRE_LIB_DEBUG}")
+ target_link_libraries_optimized(${target} "${PCRE_LIB}")
unset(PCRE_LIB_DEBUG)
if(EXPAT_LIB)
file_list_suffix(EXPAT_LIB_DEBUG "${EXPAT_LIB}" "_d")
- target_link_libraries(${target} debug ${EXPAT_LIB_DEBUG})
- target_link_libraries(${target} optimized ${EXPAT_LIB})
+ target_link_libraries_debug(${target} "${EXPAT_LIB_DEBUG}")
+ target_link_libraries_optimized(${target} "${EXPAT_LIB}")
unset(EXPAT_LIB_DEBUG)
endif()
else()