473,406 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Using same source for different apps

I have a question...obviously

I am developing an application, or two applications using c++ and
openGL. They involve a basic structure where approximately 70 percent
of the framework applies to both projects, and each different project
has its own special funtionality. They are both very similar and exist
together, where the irrelevent menu items for example are greyed in one
and not the other. Each needs a different icon and title depending on
the application.

My problem is that there exists only one source. When I build the
release versions, I would like to be able to make these subtle changes
in both, whereby keeping the original source structure and not have to
edit parts for one and then go back and change them for the other.

I am sure, or hoping that there is some sort of build version system,
similar to CVS or something that will allow me to do this. I have
looked around but havent really found anything.

If anyone knows of anything or has any ideas that will help me out, can
you please let me know...

Thanks for your help, appreciate it.

J

Nov 8 '06 #1
3 1247
je***********@gmail.com wrote:
I have a question...obviously

I am developing an application, or two applications using c++ and
openGL. They involve a basic structure where approximately 70 percent
of the framework applies to both projects, and each different project
has its own special funtionality. They are both very similar and exist
together, where the irrelevent menu items for example are greyed in one
and not the other. Each needs a different icon and title depending on
the application.

My problem is that there exists only one source. When I build the
release versions, I would like to be able to make these subtle changes
in both, whereby keeping the original source structure and not have to
edit parts for one and then go back and change them for the other.
I rather do hope that you have created some inheritance hierarchy with a
lot of base classes that can be used by both projects. Furthermore, each
of these base classes should have its own header and implementation
file, so that you can make changes in these base classes without
changing any details that are specific to project-specific derived
classes. If your code isn't organized this way, you'll have the most
wonderful time re-organizing it. In the end your source tree should look
like this:

src
|_ common
| |_ BaseClass1
| |_ BaseClass2
| |...
|_ Project1
| |_ DerivedClass1_1 (with details that are specific to
| | project 1)
| |_ DerivedClass1_2
| |...
|_ Project2
| |_ DerivedClass2_1
| |...

Regards,
Stuart
Nov 8 '06 #2
je***********@gmail.com wrote:
[snips]
I am sure, or hoping that there is some sort of build version system,
similar to CVS or something that will allow me to do this. I have
looked around but havent really found anything.

If anyone knows of anything or has any ideas that will help me out, can
you please let me know...
Sure there are build utils. But they are off topic in this news group.
You need to go to a platform specific news group for those. You
could start with a news group that talks about development in
your particular OS, or to do with your particular compiler. Google
up the news group or groups that have relevant stuff.

As far as organizing your code, there are plenty hints and tips
available if you are interested. The most simple of notions is
to use macro compile flags of some kind. When you compile
for one project, you have some extra include file, or your build
util sets flags for you, or some such. And this sets all the stuff
so that the first project gets what it needs. Then for the other
project you have a second include file, or a second make file,
or whatever your build util needs.

Another thing to look at is making a library for the common
features. Again, the details of how to make a library are
off topic here. For two projects, a library may, or may not,
be appropriate. There are plenty books on writing libraries.
The basic rule is: a feature probably belongs in the library if
nearly every client of the library will use it, at least now
and then. If only one client wants it, then it is unlikely to
belong in the library.
Socks

Nov 8 '06 #3
On Wed, 08 Nov 2006 07:03:58 -0800, jeremy.todter wrote:
I have a question...obviously

I am developing an application, or two applications using c++ and openGL.
They involve a basic structure where approximately 70 percent of the
framework applies to both projects, and each different project has its own
special funtionality. They are both very similar and exist together,
where the irrelevent menu items for example are greyed in one and not the
other. Each needs a different icon and title depending on the application.

My problem is that there exists only one source. When I build the release
versions, I would like to be able to make these subtle changes in both,
whereby keeping the original source structure and not have to edit parts
for one and then go back and change them for the other.
I can't tell you how similar they need to be for this strategy to work in
you apps, but you could consider conditional compilation. Maybe consider
something like
c++ -DAPP1 source.cc
in the source.cc file

#ifdef APP1
cout << "app 1\n";
#else
cout << "other app\n";
#endif

When compiling with the APP1 symbol defined, the first clause will be
compiled, otherwise the second will. This is the best way for me to
include hardware level functions that work on one platform but are
different on the other.

But in keeping with the OO paradigm it is best to encapsulate the
application specific stuff in different classes and then only use
conditional compilation to instantiate the correct class. The optimizing
compiler shouldn't then include machine code for other than its intended
target.

class x8086_port_access; // x86 port access class
class arm_port_access; // arm port access class
#ifdef ARM
arm_port_access ports;
#else
x8086_port_access ports;
#endif
ports.set(ports::IRQ_CLEAR_REGISTER, ports::IRQ_ACK);

Assuming that the API for the classes are the same then the program will
only use the one for its target platform.

The above is only a hypothetical example so we need not discuss the
issues of class overhead when dealing with direct hardware access in
latency sensitive applications.
Nov 9 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Kenneth McDonald | last post by:
If this is not an appropriate newsgroup for this type of posting, please let me know and (if possible) suggest an alternative. I've done a fair bit of research on the net, but information is...
0
by: Jari Kujansuu | last post by:
I am trying to learn to use jing through JARV interface and I have read JARV User's Guide (http://iso-relax.sourceforge.net/JARV/JARV.html). I have downloaded jingjarv-examples.zip from JARV...
121
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode...
41
by: Matt Alanzo | last post by:
Our SOHO 2 person compay sells furniture (not programmers). In '98 we paid $,$$$ for a VBA -Access '97 accounting application, including VBA source code .... an huge investment for us then (and...
12
by: bj7lewis | last post by:
I am working on a project I want to add a few files as resource to access(copy them to FS and use) at runtime. So far in VS.NET IDE, I Add Files to the project and set its Build Action to...
5
by: Rich | last post by:
I loaded visual studio.Net 2003 on a windows XP workstation, and I was able to run aspx applications. Later I loaded JBuilder 2005 (Enterprise Java builder 2005) which runs the Tomcat 5.0 web...
42
by: (PeteCresswell) | last post by:
I skimmed the MS spiel at http://msdn.microsoft.com/sql/express, and noted the part about "all inside the Visual Studio 2005 environment". Do the older SQL server tools for security and stored...
53
by: Hexman | last post by:
Hello All, I'd like your comments on the code below. The sub does exactly what I want it to do but I don't feel that it is solid as all. It seems like I'm using some VB6 code, .Net2003 code,...
7
by: sami | last post by:
Hi I am trying to write a facebook application in python - I have been programming simple desktop applications till now and am not really familiar with web apps Pyfacebook is the wrapper for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.