-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make build info **actually** be build info
Before, instead of showing build computer's host name, it would show user's host name. Now fixed by adding some code that executes and generates a temporary header file with app title #defined: compile_time_code.c TL;DR gethostname() is now executed compile time so user knows who compiled their build (no longer just shows user's computer name).
- Loading branch information
Showing
3 changed files
with
49 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* Kind of like a makefile within a makefile, Currently used | ||
* to put build PC's hostname within app title as a constant... | ||
* before it would show the users hotname! not builder's. doh. */ | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
/* Host name */ | ||
#include <unistd.h> | ||
|
||
#include "gui_stuff/style_config.h" | ||
|
||
|
||
int main(int argc, char * argv[]) | ||
{ | ||
/* Generate App title with build info in a temporary .h file */ | ||
char * app_name = malloc(1024); | ||
char * host_name = malloc(1024); | ||
|
||
gethostname(host_name, 1023); | ||
|
||
snprintf(app_name, 1023, APP_NAME " (" __DATE__ " " __TIME__ " @%s)", host_name); | ||
|
||
printf("Initial app name: %s\n", app_name); | ||
|
||
FILE * app_name_header = fopen("app_window_title.h", "wb"); | ||
|
||
/* Here's our beautiful header file */ | ||
fprintf(app_name_header, "#ifndef _app_window_title_h_\n"); | ||
fprintf(app_name_header, "#define _app_window_title_h_\n\n"); | ||
fprintf(app_name_header, "#define APP_WINDOW_TITLE \"%s\"\n\n", app_name); | ||
fprintf(app_name_header, "%s\n", "#endif"); | ||
|
||
fclose(app_name_header); | ||
|
||
free(host_name); | ||
free(app_name); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters