CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

[Semi-SOLVED] Building IDE-created project via Command Line
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
allenhuffman



Joined: 17 Jun 2019
Posts: 537
Location: Des Moines, Iowa, USA

View user's profile Send private message Visit poster's website

PostPosted: Wed Nov 27, 2019 8:08 am     Reply with quote

And now back to this... I am trying to automate my bootloader build, having one set of source files build for five different boards via a batch file. Since I started using "Common" source files (located outside of the source location), my build batch file won't work. I was initially using relative includes ("#include ..\Common\zaphod.h") but when my batch file moves the main source into a subfolder (to work around the broken out option), those no longer resolve.

I then tried to specify include paths in the project itself but I see it puts in hard coded C:\... paths in the project file, which is great for me, but not for anyone else who wants to run this on their PC ;-)

Updates later today when/if I figure this out.
_________________
Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Wed Nov 27, 2019 8:17 am     Reply with quote

Your relative path is going to select your parent, then a subdirectory called
'Common' off this.
Do relative paths, but keep the subdirectories 'off' the main folder, rather
than going up to the parent.

So just have your project folder, and then a subdirectory off this called
'Common', and your path can just become:

"#include .\Common\zaphod.h"

Which will then merrily resolve wherever the project is located, provided
it includes the Common directory with it.
allenhuffman



Joined: 17 Jun 2019
Posts: 537
Location: Des Moines, Iowa, USA

View user's profile Send private message Visit poster's website

PostPosted: Wed Nov 27, 2019 8:26 am     Reply with quote

Ttelmah wrote:
Your relative path is going to select your parent, then a subdirectory called
'Common' off this.
Do relative paths, but keep the subdirectories 'off' the main folder, rather
than going up to the parent.

So just have your project folder, and then a subdirectory off this called
'Common', and your path can just become:

"#include .\Common\zaphod.h"

Which will then merrily resolve wherever the project is located, provided
it includes the Common directory with it.


My ultimate goal is to have a Common directory used by a bunch of separate projects. I was envisioning something like:

PIC/Common
PIC/Bootloader
PIC/Board1
PIC/Board2
PIC/Board3
PIC/Board4
PIC/Board5
PIC/Board6

It sounds like if I put all the .ccspjt project files up in the (made up example) PIC folder, then I could get it to work. I'd have to see if I could get my teammates to go for that, rather than keeping the project with the files. (My efforts to make more Common code already mean things won't be in the same place.)
_________________
Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
allenhuffman



Joined: 17 Jun 2019
Posts: 537
Location: Des Moines, Iowa, USA

View user's profile Send private message Visit poster's website

PostPosted: Wed Nov 27, 2019 8:32 am     Reply with quote

(Actually, if I could just get the "out" option to work, I would be good. My issues come from me having to move the project files somewhere else.)

I temporarily "solved" my problem by having my build script move the source and project files to a directory at the same level. Instead of:

Code:

MKDIR TEMP
DEL /Q TEMP\*.*
COPY *.c TEMP
copy *.h TEMP
copy *.ccspjt TEMP
PUSHD TEMP


… I just make the temporary directory at the same level as the Project directory:

Code:
SET TEMPDIR=..\%PROJECT%-TEMP
MKDIR %TEMPDIR%
DEL /Q %TEMPDIR%\*.*
COPY *.c %TEMPDIR%
copy *.h %TEMPDIR%
copy *.ccspjt %TEMPDIR%
PUSHD %TEMPDIR%


That clutters up that directory, but I can make it clean up after its done (and it's not in source control so no one else would see it anyway).
_________________
Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?


Last edited by allenhuffman on Wed Nov 27, 2019 8:36 am; edited 1 time in total
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Wed Nov 27, 2019 8:34 am     Reply with quote

Consider putting your project into the Windows AppData directory.
This is then accessible using the %appdata% shortcut.
So you can have everything as subdirectories off this.
allenhuffman



Joined: 17 Jun 2019
Posts: 537
Location: Des Moines, Iowa, USA

View user's profile Send private message Visit poster's website

PostPosted: Wed Nov 27, 2019 9:01 am     Reply with quote

That's a good idea! Unfortunately, we have a version control system so the files all have to live where they are.

I do find a command-line option to pass in the include directory, so that might work for getting access to non-project relative includes.

I have one batch file now that quickly builds five different bootloaders, which is good, but I sure with the "out" option worked properly. It only puts the .err file (even when it's "Success") in the specified folder, while .hex and all intermediate files are generated where the project is located.
_________________
Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group