Sample apps (worker, wrapper, vboxwrapper):

change Linux Makefile to add version# / platform to executable name

NOTE: all files that will get sent to a BOINC client
should have a version number in the filename;
if they're executable code they should also have
a platform name in the filename.

It would be nice to centralize these version numbers (like in version.h).
For now they're scattered around project files and Makefiles
This commit is contained in:
David Anderson 2023-12-11 18:11:44 -08:00
parent 76d33461cc
commit e15bbb64e0
5 changed files with 52 additions and 31 deletions

View File

@ -1,5 +1,7 @@
# This should work on Linux. Modify as needed for other platforms.
VBOXWRAPPER_RELEASE = 26207_x86_64-pc-linux-gnu
# Change the following to match your installation
BOINC_DIR = ../..
BOINC_SOURCE_API_DIR = $(BOINC_DIR)/api
@ -31,7 +33,7 @@ CXXFLAGS += -g \
-L$(BOINC_LIB_DIR) \
-L.
PROGS = vboxwrapper
PROGS = vboxwrapper_$(VBOXWRAPPER_RELEASE)
HEADERS = vbox_common.h vboxjob.h vbox_vboxmanage.h vboxwrapper.h
@ -66,5 +68,5 @@ vboxlogging.o: vboxlogging.cpp $(HEADERS)
vboxwrapper.o: vboxwrapper.cpp $(HEADERS)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c vboxwrapper.cpp
vboxwrapper: vboxwrapper.o vbox_common.o vbox_vboxmanage.o vboxcheckpoint.o vboxjob.o vboxlogging.o floppyio.o $(MAKEFILE_STDLIB) $(BOINC_LIB_DIR)/libboinc.a $(BOINC_API_DIR)/libboinc_api.a
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o vboxwrapper vboxwrapper.o vbox_common.o vbox_vboxmanage.o vboxcheckpoint.o vboxjob.o vboxlogging.o floppyio.o $(MAKEFILE_LDFLAGS) -lboinc_api -lboinc $(STDCPPTC)
vboxwrapper_$(VBOXWRAPPER_RELEASE): vboxwrapper.o vbox_common.o vbox_vboxmanage.o vboxcheckpoint.o vboxjob.o vboxlogging.o floppyio.o $(MAKEFILE_STDLIB) $(BOINC_LIB_DIR)/libboinc.a $(BOINC_API_DIR)/libboinc_api.a
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o vboxwrapper_$(VBOXWRAPPER_RELEASE) vboxwrapper.o vbox_common.o vbox_vboxmanage.o vboxcheckpoint.o vboxjob.o vboxlogging.o floppyio.o $(MAKEFILE_LDFLAGS) -lboinc_api -lboinc $(STDCPPTC)

View File

@ -1,7 +1,9 @@
CXXFLAGS += -g
CXX ?= g++
PROGS = worker
WORKER_RELEASE = 1_x86_64-pc-linux-gnu
PROGS = worker_$(WORKER_RELEASE)
all: $(PROGS)
@ -10,8 +12,8 @@ clean: distclean
distclean:
rm -f $(PROGS) $(addsuffix .exe, $(PROGS)) *.o
worker: worker.o
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o worker worker.o
worker_$(WORKER_RELEASE): worker.o
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o worker_$(WORKER_RELEASE) worker.o
install: all

View File

@ -16,20 +16,22 @@
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
// worker - application without BOINC runtime system;
// used for testing wrapper.
// used for testing wrappers.
//
// worker [--std_copy] [--file_copy] nsecs
// worker [--std] [--file] nsecs
//
// --std_copy: copy one line of stdin to stdout
// --file_copy: copy one line of "in" to "out"
// --std: stdin to stdout
// --file_copy: "in" to "out"
// In both cases, convert to uppercase
// nsecs: use this much CPU time (default 10 sec)
//
// THIS PROGRAM SHOULDN'T USE ANY BOINC CODE. That's the whole point.
// THIS PROGRAM CAN'T USE ANY BOINC CODE. That's the whole point.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <ctype.h>
// do a billion floating-point ops
// (note: I needed to add an arg to this;
@ -46,25 +48,34 @@ static double do_a_giga_flop(int foo) {
return x;
}
void copy_uc(FILE* fin, FILE* fout) {
int c;
while (1) {
c = fgetc(fin);
if (c == EOF) break;
fputc(toupper(c), fout);
}
}
int main(int argc, char** argv) {
char buf[256];
FILE* in, *out;
int i, nsec = 10;
bool std_copy = false, file_copy = false;
bool std = false, file = false;
char c;
for (i=1; i<argc; i++) {
if (!strcmp(argv[i], "--std_copy")) {
std_copy = true;
if (!strcmp(argv[i], "--std")) {
std = true;
}
if (!strcmp(argv[i], "--file_copy")) {
file_copy = true;
if (!strcmp(argv[i], "--file")) {
file = true;
}
nsec = atoi(argv[i]);
}
fprintf(stderr, "worker starting\n");
fprintf(stderr, "worker: starting\n");
if (file_copy) {
if (file) {
in = fopen("in", "r");
if (!in) {
fprintf(stderr, "missing input file\n");
@ -75,13 +86,11 @@ int main(int argc, char** argv) {
fprintf(stderr, "can't open output file\n");
exit(1);
}
fgets(buf, 256, in);
fputs(buf, out);
copy_uc(in, out);
}
if (std_copy) {
fgets(buf, 256, stdin);
fputs(buf, stdout);
if (std) {
copy_uc(stdin, stdout);
}
int start = (int)time(0);
@ -91,7 +100,7 @@ int main(int argc, char** argv) {
do_a_giga_flop(i++);
}
fputs("done!\n", stdout);
fprintf(stderr, "worker: done\n");
return 0;
}

View File

@ -1,5 +1,7 @@
# This should work on Linux. Modify as needed for other platforms.
WRAPPER_RELEASE = 26018_x86_64-pc-linux-gnu
# Change the following to match your installation
BOINC_DIR = ../..
BOINC_SOURCE_API_DIR = $(BOINC_DIR)/api
@ -33,7 +35,7 @@ CXXFLAGS += -g -O0 \
-L$(BOINC_ZIP_DIR) \
-L.
PROGS = wrapper
PROGS = wrapper_$(WRAPPER_RELEASE)
all: $(PROGS)
@ -56,5 +58,5 @@ REGEXP_OBJS = \
regexp_memory.o \
regexp_report.o
wrapper: wrapper.o $(MAKEFILE_STDLIB) $(BOINC_LIB_DIR)/libboinc.a $(BOINC_API_DIR)/libboinc_api.a $(REGEXP_OBJS)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(MINGW_WRAPPER_FLAGS) -o wrapper wrapper.o $(REGEXP_OBJS) $(MAKEFILE_LDFLAGS) $(MINGW_ZIP_FIX) -lboinc_api -lboinc -lboinc_zip $(MINGW_LIBS) $(STDCPPTC)
wrapper_$(WRAPPER_RELEASE): wrapper.o $(MAKEFILE_STDLIB) $(BOINC_LIB_DIR)/libboinc.a $(BOINC_API_DIR)/libboinc_api.a $(REGEXP_OBJS)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(MINGW_WRAPPER_FLAGS) -o wrapper_$(WRAPPER_RELEASE) wrapper.o $(REGEXP_OBJS) $(MAKEFILE_LDFLAGS) $(MINGW_ZIP_FIX) -lboinc_api -lboinc -lboinc_zip $(MINGW_LIBS) $(STDCPPTC)

View File

@ -12,11 +12,17 @@
/* Release part of BOINC version number */
#define BOINC_RELEASE 0
/* Release part of wrapper version number */
// Release part of wrapper version number; must match
// samples/wrapper/Makefile
// win_build/wrapper.vcxproj
// mac?
#define WRAPPER_RELEASE 26018
/* Release part of vboxwrapper version number */
#define VBOXWRAPPER_RELEASE 26206
// Release part of vboxwrapper version number; must match
// samples/vboxwrapper/Makefile
// win_build/vboxwrapper.vcxproj
// mac?
#define VBOXWRAPPER_RELEASE 26207
/* String representation of BOINC version number */
#define BOINC_VERSION_STRING "7.25.0"