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 @@ -144,3 +144,12 @@ endif()
144144if (XCODE OR VS)
145145 cocos_mark_code_files("cocos2d" )
146146endif ()
147+
148+ if (WIN32 )
149+ # precompiled header. Compilation time speedup ~4x.
150+ target_sources (cocos2d PUBLIC "${CMAKE_CURRENT_SOURCE_DIR} /precheader.cpp" )
151+ set_target_properties (cocos2d PROPERTIES COMPILE_FLAGS "/Yuprecheader.h /FIprecheader.h" )
152+ set_source_files_properties ("${CMAKE_CURRENT_SOURCE_DIR} /precheader.cpp" PROPERTIES COMPILE_FLAGS "/Ycprecheader.h" )
153+ # compile c as c++. needed for precompiled header
154+ set_source_files_properties (${COCOS_SPINE_SRC} base/ccFPSImages.c PROPERTIES LANGUAGE CXX)
155+ 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 @@ -481,3 +481,10 @@ endif()
481481if (LINUX OR WINDOWS)
482482 cocos_copy_res(COPY_TO ${APP_RES_DIR} FOLDERS ${GAME_RES_FOLDER} )
483483endif ()
484+
485+ if (WIN32 )
486+ # precompiled header. Compilation time speedup ~4x.
487+ target_sources (${APP_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR} /Classes/precheader.cpp" )
488+ set_target_properties (${APP_NAME} PROPERTIES COMPILE_FLAGS "/Yuprecheader.h /FIprecheader.h" )
489+ set_source_files_properties ("${CMAKE_CURRENT_SOURCE_DIR} /Classes/precheader.cpp" PROPERTIES COMPILE_FLAGS "/Ycprecheader.h" )
490+ endif ()
You can’t perform that action at this time.
0 commit comments