From 12deb466be00656b659300e21a5cfc1435771078 Mon Sep 17 00:00:00 2001 From: hikerstk Date: Thu, 25 Jul 2013 07:19:30 +0000 Subject: [PATCH] Fixed several problems when createing VS project files with cmake: 1) gcc flags were used, and -Wall for irrlicht caused 1000's of useless warning messages. 2) Force static build of irrlicht. 3) Remove unnecessary dist target (which is unix only). git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@13349 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- CMakeLists.txt | 10 ++++++++-- lib/irrlicht/CMakeLists.txt | 12 ++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 955a81a2f..831b690dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,6 +52,7 @@ if(MSVC) set(ENV{PATH} ${PROJECT_SOURCE_DIR}/dependencies/include) set(ENV{LIB} ${PROJECT_SOURCE_DIR}/dependencies/lib) set(ENV{OPENALDIR} ${PROJECT_SOURCE_DIR}/dependencies) + add_definitions(/D_IRR_STATIC_LIB_) endif() if(APPLE) @@ -242,7 +243,10 @@ add_subdirectory(tools/font_tool) # ==== Make dist target ==== -add_custom_target(dist +if(MSVC) + # Don't create a dist target for VS +else() + add_custom_target(dist COMMAND rm -rf ${CMAKE_BINARY_DIR}/SuperTuxKart-${PROJECT_VERSION} && rm -f ${CMAKE_BINARY_DIR}/SuperTuxKart-${PROJECT_VERSION}.tar.bz2 && echo "Exporting..." && svn export ${PROJECT_SOURCE_DIR} ${CMAKE_BINARY_DIR}/SuperTuxKart-${PROJECT_VERSION} @@ -251,7 +255,9 @@ add_custom_target(dist && tar -cjf ${CMAKE_BINARY_DIR}/SuperTuxKart-${PROJECT_VERSION}.tar.bz2 ./SuperTuxKart-${PROJECT_VERSION} && echo "Done, cleaning up" && rm -rf ${CMAKE_BINARY_DIR}/SuperTuxKart-${PROJECT_VERSION} - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + ) +endif() # ==== Install target ==== install(TARGETS supertuxkart RUNTIME DESTINATION ${STK_INSTALL_BINARY_DIR} BUNDLE DESTINATION .) diff --git a/lib/irrlicht/CMakeLists.txt b/lib/irrlicht/CMakeLists.txt index 8c3fe4f11..07d673ac0 100644 --- a/lib/irrlicht/CMakeLists.txt +++ b/lib/irrlicht/CMakeLists.txt @@ -12,10 +12,14 @@ if(APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch i386 -F/Library/Frameworks") endif() -add_definitions(-Wall -pipe -fexpensive-optimizations -I/usr/X11R6/include -DIRRLICHT_EXPORTS=1 -DNDEBUG=1) - -set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -O3 -fno-exceptions -fno-rtti -fstrict-aliasing") -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPNG_THREAD_UNSAFE_OK -DPNG_NO_MMX_CODE -DPNG_NO_MNG_FEATURES") +add_definitions(-DNDEBUG=1 -DIRRLICHT_EXPORTS=1 -DPNG_THREAD_UNSAFE_OK -DPNG_NO_MMX_CODE -DPNG_NO_MNG_FEATURES) +if(MSVC) + add_definitions(/D_IRR_STATIC_LIB_) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" /MTd) +else() + set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wall -pipe -O3 -fno-exceptions -fno-rtti -fstrict-aliasing -fexpensive-optimizations -I/usr/X11R6/include") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pipe -O3 -fno-exceptions -fno-rtti -fstrict-aliasing -fexpensive-optimizations -I/usr/X11R6/include") +endif() set(IRRLICHT_SOURCES source/Irrlicht/CTRStencilShadow.cpp