Author Topic: Proposed Rules and suggestions for using PCH properly under Windows  (Read 19716 times)

Online stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Link to my Git copy of the rules/suggestions I am working on

Edit: New Location for rules https://github.com/stahta01/cb_misc/blob/master/Notes/Rules%20and%20suggestions%20for%20using%20PCH%20properly%20under%20Windows.txt

Note: This section needs additions because I have tested the compiler option "-include sdk.h" and it works better for at least some CB plugins.
Quote
Required rules for using PCH properly under Windows
   1. This sdk_common.h file should only be included by sdk.h and sdk_precomp.h
   2. Use sdk.h instead of sdk_precomp.h in CB Plugins
   3. Do NOT include sdk.h from inside header files (unless that header is making a PCH).
   4. Do NOT include wx.h or wxprec.h inside header files (unless that header is making a PCH).
   5. Do NOT include a header file before include sdk.h.
   6. Do NOT do a pragma before include sdk.h.
   7. Should have "-Winvalid-pch" warning set.
   8. Must have the folder containing sdk.k and sdk.h.gch in the search path!
      NOTE: The folder containing sdk.h.gch must before the sdk.k folder.

I really would like feedback on the first rule.
Quote
Required rules for using PCH properly under Windows
   1. This sdk_common.h file should only be included by sdk.h and sdk_precomp.h

If it is acceptable, I will attach a patch that fixes the problem.
Link to this patch https://github.com/stahta01/codeblocks/blob/PCH/Patches/svn/cb_src_remove_sdk_common_h_new.patch
Note: I plan to remove the "_new" from the end of my patches in the future.

Tim S.
« Last Edit: June 04, 2014, 09:37:32 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Why don't you just fork my repo and apply patches directly, then ask for  a pull?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Online stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Why don't you just fork my repo and apply patches directly, then ask for  a pull?

I will have to learn how to do this; would this result in the patches making it to Code::Blocks once you OK them?

Because I am a Git newbie, I have little experience on using Git correctly; I am willing to do it if you think it is the correct way to get the patches into the CB svn trunk. Might be a while before I learn how to do it right.

Any good URL links on how to use Git correctly you can give me?

Please give me the link to use in forking your repo?
Found it. https://github.com/obfuscated/codeblocks_sf

Tim S.



« Last Edit: May 06, 2014, 08:00:29 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Hm, you can look around the help of github. There are plenty of examples.

The steps should be something like:
1. Clone the repo
2. checkout master
3. create new branch
4. make some commits
5. push the branch to your own repo
6. post here with the link to the branch

For me this way it is easier to look at patches and then try them.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Online stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Hm, you can look around the help of github. There are plenty of examples.

The steps should be something like:
1. Clone the repo
2. checkout master
3. create new branch
4. make some commits
5. push the branch to your own repo
6. post here with the link to the branch

For me this way it is easier to look at patches and then try them.

Link to the repo of the stuff I think ready to commit upstream.
https://github.com/stahta01/codeblocks_sf/tree/win_build_speedup
Right now, it is only the patch to remove the includes of "sdk_common.h".

Edit: Decided to delete my fork and re-create it with a minor name change.
Did too many things wrong in it.

Tim S.
« Last Edit: May 16, 2014, 05:56:29 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
As you probably know this one is in svn now.
When  you have something ready for commit, please say so.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Online stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
As you probably know this one is in svn now.
When  you have something ready for commit, please say so.

Thank you for committing it; I am still testing the changes that adds back PCH to wx30 windows 32 bit bit.
Edit: The changes was enough for wx30 windows 32 bit; but, 64 bit did NOT work with it.
Edit: Decided to try to get 64 bit working before submitting 32 bit changes.
Edit: I also deleted and re-forking your git repo before doing more commints.
Edit: I also decided I needed to re-create the wxSmith code generation before patching the source file.
Edit: New URL  https://github.com/stahta01/codeblocks_sf_tims/tree/win_build_speedup
I still need to add changes to that fork.

Tim S.
« Last Edit: May 16, 2014, 06:43:51 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Please post new message and don't edit old message, because people (like me) using the "show unread posts since last visit" won't see them!
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Online stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Please post new message and don't edit old message, because people (like me) using the "show unread posts since last visit" won't see them!

OK.

I have decided that I need a Linux or BSD like box to test most of my changes on github.com/stahta01/codeblocks_sf_tims/tree/win_build_speedup
https://github.com/stahta01/codeblocks_sf_tims/tree/win_build_speedup

But, till then I will work on all my patches to the CB scriptedwizard here github.com/stahta01/codeblocks_sf_tims/tree/scriptedwizard .
https://github.com/stahta01/codeblocks_sf_tims/tree/scriptedwizard

I will post again after I finish the 4 to 6 sets of changes to the CB scriptedwizard.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
What are you trying to do with the scripted wizzard?

Online stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Proposed Rules and suggestions for using PCH properly under Windows
« Reply #10 on: May 31, 2014, 03:01:30 pm »
What are you trying to do with the scripted wizzard?

Trying to get it to make good PCH compatible code.
Edit: This means moving and reordering includes of headers, adding forward declares, and adding include of sdk.h

1. Fix Plugin code using PCH correctly by adding use of sdk.h in cpp files of ScripedWizard.
2. rebuild wxCode generated by (wxSmith) Edit: This step resulted in no changes to the code.
3. rebuild wxCode using PCH headers (InternalHeadersPCH and HeadersPCH)
4. Fix wxWidget code templates
5. Fix CB Plugin code templates
6. Fix CB Plugin wizard creation of CB Project (add sdk.h.gch search folder)

Not part of planned fixes in this branch at this time.
7. Rewrite CB Plugin wizard script to add non-pch target


Tim S.
« Last Edit: May 31, 2014, 05:41:51 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Online stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Proposed Rules and suggestions for using PCH properly under Windows
« Reply #11 on: May 31, 2014, 08:21:44 pm »

Not part of planned fixes in this branch at this time.
7. Rewrite CB Plugin wizard script to add non-pch target
7A. Fix building of two target of debug and release when using local PCH File.
7A1. Make location of local PCH file in object folder.


Tim S.

« Last Edit: May 31, 2014, 08:23:20 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Online stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Proposed Rules and suggestions for using PCH properly under Windows
« Reply #12 on: June 01, 2014, 04:05:08 am »
To oBFusCATed: These two changes needs to tested for build issues on a Linux box.

I have push out my local changes to my https://github.com/stahta01/codeblocks_sf_tims/tree/scriptedwizard

These items 1 and 3 should NOT cause any functional change in the plugin; but, might cause compile errors because of missing include.
I have tested on windows 7 32 bit using wxWidgets 2.8.12 and found no build problems.
Note: I used the wxSmith from CB version 13.12 to generated the wxSmith code.

Quote
1. Fix Plugin code using PCH correctly by adding use of sdk.h in cpp files of ScripedWizard.
2. rebuild wxCode generated by (wxSmith) Edit: This step resulted in no changes to the code.
3. rebuild wxCode using PCH headers (InternalHeadersPCH and HeadersPCH)

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Proposed Rules and suggestions for using PCH properly under Windows
« Reply #13 on: June 01, 2014, 10:45:56 am »
I'm testing this, then. Should I commit it to trunk if it doesn't fail?

btw: Don't use git merge operations, but only git rebase, because git's merge commits are incompatible with svn's.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Online stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Proposed Rules and suggestions for using PCH properly under Windows
« Reply #14 on: June 01, 2014, 02:12:18 pm »
I'm testing this, then. Should I commit it to trunk if it doesn't fail?

btw: Don't use git merge operations, but only git rebase, because git's merge commits are incompatible with svn's.

Yes, please commit to svn trunk if it compiles on Linux using CB Project and configure/make.

Edit: Found out what rebase means http://git-scm.com/book/en/Git-Branching-Rebasing and http://git-scm.com/docs/git-rebase.html
Will try to do it that way in the future. I am using TortoiseGit; so, I really not sure how to use all of Git.
But, it shows a rebase command.

Tim S.
« Last Edit: June 01, 2014, 02:27:14 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org