File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -161,3 +161,12 @@ endif()
161161if (XCODE OR VS)
162162 cocos_mark_code_files("cocos2d" )
163163endif ()
164+
165+ if (WIN32 )
166+ # precompiled header. Compilation time speedup ~4x.
167+ target_sources (cocos2d PUBLIC "${CMAKE_CURRENT_SOURCE_DIR} /precheader.cpp" )
168+ set_target_properties (cocos2d PROPERTIES COMPILE_FLAGS "/Yuprecheader.h /FIprecheader.h" )
169+ set_source_files_properties ("${CMAKE_CURRENT_SOURCE_DIR} /precheader.cpp" PROPERTIES COMPILE_FLAGS "/Ycprecheader.h" )
170+ # compile c as c++. needed for precompiled header
171+ set_source_files_properties (${COCOS_SPINE_SRC} base/ccFPSImages.c PROPERTIES LANGUAGE CXX)
172+ endif ()
Original file line number Diff line number Diff line change @@ -178,4 +178,11 @@ set_target_properties(jscocos2d
178178
179179if (XCODE OR VS)
180180 cocos_mark_code_files("jscocos2d" )
181- endif ()
181+ endif ()
182+
183+ if (WIN32 )
184+ # precompiled header
185+ target_sources (jscocos2d PUBLIC "${CMAKE_CURRENT_SOURCE_DIR} /precheader.cpp" )
186+ set_target_properties (jscocos2d PROPERTIES COMPILE_FLAGS "/Yuprecheader.h /FIprecheader.h" )
187+ set_source_files_properties ("${CMAKE_CURRENT_SOURCE_DIR} /precheader.cpp" PROPERTIES COMPILE_FLAGS "/Ycprecheader.h" )
188+ endif ()
Original file line number Diff line number Diff line change @@ -483,3 +483,10 @@ endif()
483483if (LINUX OR WINDOWS)
484484 cocos_copy_res(COPY_TO ${APP_RES_DIR} FOLDERS ${GAME_RES_FOLDER} )
485485endif ()
486+
487+ if (WIN32 )
488+ # precompiled header. Compilation time speedup ~4x.
489+ target_sources (${APP_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR} /Classes/precheader.cpp" )
490+ set_target_properties (${APP_NAME} PROPERTIES COMPILE_FLAGS "/Yuprecheader.h /FIprecheader.h" )
491+ set_source_files_properties ("${CMAKE_CURRENT_SOURCE_DIR} /Classes/precheader.cpp" PROPERTIES COMPILE_FLAGS "/Ycprecheader.h" )
492+ endif ()
You can’t perform that action at this time.
0 commit comments