-
Notifications
You must be signed in to change notification settings - Fork 7.1k
modern cmake, improve cmake_compiler_flags #19145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -166,19 +166,6 @@ endfunction() | |
| if(MSVC) | ||
| target_compile_options(${target} | ||
| PUBLIC /MP | ||
| PUBLIC /Z7 | ||
| PUBLIC /MD$<$<CONFIG:Debug>:d> | ||
| ) | ||
| else() | ||
| target_compile_options(${target} | ||
| PUBLIC -Wall | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In modern cmake flags should not be set inside library. Please see for example: We may add this to root folder but it should not be set here (and definitely not as PUBLIC). |
||
| PUBLIC $<$<CONFIG:Debug>:-g> | ||
| ) | ||
| if(LINUX) | ||
| target_compile_options(${target} PUBLIC -pthread) | ||
| endif() | ||
| endif() | ||
| if(ANDROID) | ||
| target_compile_options(${target} PUBLIC -fsigned-char) | ||
| endif() | ||
| endfunction() | ||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -284,7 +284,7 @@ LOCAL_WHOLE_STATIC_LIBRARIES += cpufeatures | |||
|
|
||||
| # define the macro to compile through support/zip_support/ioapi.c | ||||
| LOCAL_CFLAGS := -DUSE_FILE32API | ||||
| LOCAL_CFLAGS += -fexceptions | ||||
| LOCAL_CFLAGS += -fexceptions -fsigned-char | ||||
|
||||
| APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char -Wno-extern-c-compat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank I will remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the reason to add
/Z7istoo large PDB fileoccurs to me when compilecpp-testsprojectThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/Z7 it is old debug format.
All CI tests passed
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this has been discussed where compiling would fail without
/Z7, but it may not necessary for VS2017+ due to the improvements in the debugging database system(s). I'm not sure the best course of action here though, but maybe if you can add that option only to cpp-tests then that would be good enough since others can choose to modify their own project target options?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stevetranby idea of this change is that common cmake configuration does not force settings on user. If user really want to change something it possible from his code without changing cocos code. It is bad cmake practice to set compiler flags https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1#get-your-hands-off-cmake_cxx_flags
About visual studio debug database (pdb files): from my experience it does not matter with or without /Z7 pdb become broken from time to time ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Makes sense to give control to user.
Maybe best to just document in cpp-tests that one can try no debug (??option??) or light debug (/Z7) if they have issues building.
I am not sure if the new templated CCActions helped or hurt in that regard, but I remember the "PDB too large" issue for me was related to the large amount of code and derived classes for all the actions.
(It would be great to see the action system refactored into a "few lines of code" generic approach by passing in easing function instead of having the large hierarchy of derived classes - even if now templated).
I digress :-]