set main() argv functions to be const char *

also set minimum cmake version to 2.8
This commit is contained in:
Campbell Barton 2011-02-19 12:05:20 +00:00
parent 48f232df73
commit 9ee1b3930f
10 changed files with 55 additions and 56 deletions

@ -28,8 +28,7 @@
#-----------------------------------------------------------------------------
# We don't allow in-source builds. This causes no end of troubles because
# all out-of-source builds will use the CMakeCache.txt file there and even
# build the libs and objects in it. It will also conflict with the current
# Makefile system for Blender
# build the libs and objects in it.
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "CMake generation for blender is not allowed within the source directory!
@ -39,11 +38,11 @@ Remove the CMakeCache.txt file and try again from another folder, e.g.:
cd ..
mkdir cmake-make
cd cmake-make
cmake -G \"Unix Makefiles\" ../blender
cmake ../blender
")
endif()
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 2.8)
# quiet output for Makefiles, 'make -s' helps too
# set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)

@ -49,7 +49,7 @@ void sound_init(struct Main *main);
void sound_exit(void);
void sound_force_device(int device);
int sound_define_from_str(char *str);
int sound_define_from_str(const char *str);
struct bSound* sound_new_file(struct Main *main, const char *filename);

@ -55,7 +55,7 @@ static void sound_sync_callback(void* data, int mode, float time)
}
#endif
int sound_define_from_str(char *str)
int sound_define_from_str(const char *str)
{
if (BLI_strcaseeq(str, "NULL"))
return AUD_NULL_DEVICE;

@ -39,9 +39,9 @@ struct bArgs;
typedef struct bArgs bArgs;
/* returns the number of extra arguments consumed by the function. 0 is normal value, -1 stops parsing arguments, other negative indicates skip */
typedef int (*BA_ArgCallback)(int argc, char **argv, void *data);
typedef int (*BA_ArgCallback)(int argc, const char **argv, void *data);
struct bArgs *BLI_argsInit(int argc, char **argv);
struct bArgs *BLI_argsInit(int argc, const char **argv);
void BLI_argsFree(struct bArgs *ba);
/* pass starts at 1, -1 means valid all the time
@ -57,6 +57,6 @@ void BLI_argsPrintArgDoc(struct bArgs *ba, const char *arg);
void BLI_argsPrintOtherDoc(struct bArgs *ba);
void BLI_argsPrint(struct bArgs *ba);
char **BLI_argsArgv(struct bArgs *ba);
const char **BLI_argsArgv(struct bArgs *ba);
#endif

@ -67,7 +67,7 @@ struct bArgs {
ListBase docs;
GHash *items;
int argc;
char **argv;
const char **argv;
int *passes;
};
@ -113,7 +113,7 @@ static bArgument *lookUp(struct bArgs *ba, const char *arg, int pass, int case_s
return BLI_ghash_lookup(ba->items, &key);
}
bArgs *BLI_argsInit(int argc, char **argv)
bArgs *BLI_argsInit(int argc, const char **argv)
{
bArgs *ba = MEM_callocN(sizeof(bArgs), "bArgs");
ba->passes = MEM_callocN(sizeof(int) * argc, "bArgs passes");
@ -146,7 +146,7 @@ void BLI_argsPrint(struct bArgs *ba)
}
}
char **BLI_argsArgv(struct bArgs *ba)
const char **BLI_argsArgv(struct bArgs *ba)
{
return ba->argv;
}

@ -60,7 +60,7 @@ void BPY_pyconstraint_update(struct Object *owner, struct bConstraint *con);
int BPY_is_pyconstraint(struct Text *text);
// void BPY_free_pyconstraint_links(struct Text *text);
//
void BPY_python_start( int argc, char **argv );
void BPY_python_start(int argc, const char **argv);
void BPY_python_end( void );
// void init_syspath( int first_time );
// void syspath_append( char *dir );

@ -217,7 +217,7 @@ static struct _inittab bpy_internal_modules[]= {
};
/* call BPY_context_set first */
void BPY_python_start( int argc, char **argv )
void BPY_python_start(int argc, const char **argv)
{
PyThreadState *py_tstate = NULL;

@ -70,7 +70,7 @@ void WM_setprefsize (int stax, int stay, int sizx, int sizy);
void WM_setinitialstate_fullscreen(void);
void WM_setinitialstate_normal(void);
void WM_init (struct bContext *C, int argc, char **argv);
void WM_init (struct bContext *C, int argc, const char **argv);
void WM_exit (struct bContext *C);
void WM_main (struct bContext *C);

@ -112,7 +112,7 @@ static void wm_free_reports(bContext *C)
/* only called once, for startup */
void WM_init(bContext *C, int argc, char **argv)
void WM_init(bContext *C, int argc, const char **argv)
{
if (!G.background) {

@ -131,8 +131,8 @@ extern char build_system[];
#endif
/* Local Function prototypes */
static int print_help(int argc, char **argv, void *data);
static int print_version(int argc, char **argv, void *data);
static int print_help(int argc, const char **argv, void *data);
static int print_version(int argc, const char **argv, void *data);
/* for the callbacks: */
@ -185,7 +185,7 @@ static void strip_quotes(char *str)
}
#endif
static int print_version(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data))
static int print_version(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
{
printf (BLEND_VERSION_STRING_FMT);
#ifdef BUILD_DATE
@ -204,7 +204,7 @@ static int print_version(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(dat
return 0;
}
static int print_help(int UNUSED(argc), char **UNUSED(argv), void *data)
static int print_help(int UNUSED(argc), const char **UNUSED(argv), void *data)
{
bArgs *ba = (bArgs*)data;
@ -338,30 +338,30 @@ double PIL_check_seconds_timer(void);
}
}*/
static int end_arguments(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data))
static int end_arguments(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
{
return -1;
}
static int enable_python(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data))
static int enable_python(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
{
G.f |= G_SCRIPT_AUTOEXEC;
return 0;
}
static int disable_python(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data))
static int disable_python(int UNUSED(argc), const const char **UNUSED(argv), void *UNUSED(data))
{
G.f &= ~G_SCRIPT_AUTOEXEC;
return 0;
}
static int background_mode(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data))
static int background_mode(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
{
G.background = 1;
return 0;
}
static int debug_mode(int UNUSED(argc), char **UNUSED(argv), void *data)
static int debug_mode(int UNUSED(argc), const char **UNUSED(argv), void *data)
{
G.f |= G_DEBUG; /* std output printf's */
printf(BLEND_VERSION_STRING_FMT);
@ -375,7 +375,7 @@ static int debug_mode(int UNUSED(argc), char **UNUSED(argv), void *data)
return 0;
}
static int set_fpe(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data))
static int set_fpe(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
{
#if defined(__sgi) || defined(__linux__) || defined(_WIN32) || OSX_SSE_FPE
/* zealous but makes float issues a heck of a lot easier to find!
@ -400,19 +400,19 @@ static int set_fpe(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data))
return 0;
}
static int set_factory_startup(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data))
static int set_factory_startup(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
{
G.factory_startup= 1;
return 0;
}
static int set_env(int argc, char **argv, void *UNUSED(data))
static int set_env(int argc, const char **argv, void *UNUSED(data))
{
/* "--env-system-scripts" --> "BLENDER_SYSTEM_SCRIPTS" */
char env[64]= "BLENDER";
char *ch_dst= env + 7; /* skip BLENDER */
char *ch_src= argv[0] + 5; /* skip --env */
const char *ch_src= argv[0] + 5; /* skip --env */
if (argc < 2) {
printf("%s requires one argument\n", argv[0]);
@ -428,7 +428,7 @@ static int set_env(int argc, char **argv, void *UNUSED(data))
return 1;
}
static int playback_mode(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data))
static int playback_mode(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
{
/* not if -b was given first */
if (G.background == 0) {
@ -440,7 +440,7 @@ static int playback_mode(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(dat
return -2;
}
static int prefsize(int argc, char **argv, void *UNUSED(data))
static int prefsize(int argc, const char **argv, void *UNUSED(data))
{
int stax, stay, sizx, sizy;
@ -459,19 +459,19 @@ static int prefsize(int argc, char **argv, void *UNUSED(data))
return 4;
}
static int with_borders(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data))
static int with_borders(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
{
WM_setinitialstate_normal();
return 0;
}
static int without_borders(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data))
static int without_borders(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
{
WM_setinitialstate_fullscreen();
return 0;
}
static int register_extension(int UNUSED(argc), char **UNUSED(argv), void *data)
static int register_extension(int UNUSED(argc), const char **UNUSED(argv), void *data)
{
#ifdef WIN32
char *path = BLI_argsArgv(data)[0];
@ -483,7 +483,7 @@ static int register_extension(int UNUSED(argc), char **UNUSED(argv), void *data)
return 0;
}
static int no_joystick(int UNUSED(argc), char **UNUSED(argv), void *data)
static int no_joystick(int UNUSED(argc), const char **UNUSED(argv), void *data)
{
#ifndef WITH_GAMEENGINE
(void)data;
@ -501,19 +501,19 @@ static int no_joystick(int UNUSED(argc), char **UNUSED(argv), void *data)
return 0;
}
static int no_glsl(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data))
static int no_glsl(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
{
GPU_extensions_disable();
return 0;
}
static int no_audio(int UNUSED(argc), char **UNUSED(argv), void *UNUSED(data))
static int no_audio(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
{
sound_force_device(0);
return 0;
}
static int set_audio(int argc, char **argv, void *UNUSED(data))
static int set_audio(int argc, const char **argv, void *UNUSED(data))
{
if (argc < 1) {
printf("-setaudio require one argument\n");
@ -524,7 +524,7 @@ static int set_audio(int argc, char **argv, void *UNUSED(data))
return 1;
}
static int set_output(int argc, char **argv, void *data)
static int set_output(int argc, const char **argv, void *data)
{
bContext *C = data;
if (argc >= 1){
@ -541,7 +541,7 @@ static int set_output(int argc, char **argv, void *data)
}
}
static int set_engine(int argc, char **argv, void *data)
static int set_engine(int argc, const char **argv, void *data)
{
bContext *C = data;
if (argc >= 1)
@ -587,11 +587,11 @@ static int set_engine(int argc, char **argv, void *data)
}
}
static int set_image_type(int argc, char **argv, void *data)
static int set_image_type(int argc, const char **argv, void *data)
{
bContext *C = data;
if (argc >= 1){
char *imtype = argv[1];
const char *imtype = argv[1];
if (CTX_data_scene(C)==NULL) {
printf("\nError: no blend loaded. order the arguments so '-F / --render-format' is after the blend is loaded.\n");
} else {
@ -638,7 +638,7 @@ static int set_image_type(int argc, char **argv, void *data)
}
}
static int set_threads(int argc, char **argv, void *UNUSED(data))
static int set_threads(int argc, const char **argv, void *UNUSED(data))
{
if (argc >= 1) {
if(G.background) {
@ -653,7 +653,7 @@ static int set_threads(int argc, char **argv, void *UNUSED(data))
}
}
static int set_extension(int argc, char **argv, void *data)
static int set_extension(int argc, const char **argv, void *data)
{
bContext *C = data;
if (argc >= 1) {
@ -676,7 +676,7 @@ static int set_extension(int argc, char **argv, void *data)
}
}
static int set_ge_parameters(int argc, char **argv, void *data)
static int set_ge_parameters(int argc, const char **argv, void *data)
{
int a = 0;
#ifdef WITH_GAMEENGINE
@ -696,7 +696,7 @@ example:
if(argc >= 1)
{
char* paramname = argv[a];
const char *paramname = argv[a];
/* check for single value versus assignment */
if (a+1 < argc && (*(argv[a+1]) == '='))
{
@ -737,7 +737,7 @@ example:
return a;
}
static int render_frame(int argc, char **argv, void *data)
static int render_frame(int argc, const char **argv, void *data)
{
bContext *C = data;
if (CTX_data_scene(C)) {
@ -777,7 +777,7 @@ static int render_frame(int argc, char **argv, void *data)
}
}
static int render_animation(int UNUSED(argc), char **UNUSED(argv), void *data)
static int render_animation(int UNUSED(argc), const char **UNUSED(argv), void *data)
{
bContext *C = data;
if (CTX_data_scene(C)) {
@ -793,7 +793,7 @@ static int render_animation(int UNUSED(argc), char **UNUSED(argv), void *data)
return 0;
}
static int set_scene(int argc, char **argv, void *data)
static int set_scene(int argc, const char **argv, void *data)
{
if(argc > 1) {
bContext *C= data;
@ -808,7 +808,7 @@ static int set_scene(int argc, char **argv, void *data)
}
}
static int set_start_frame(int argc, char **argv, void *data)
static int set_start_frame(int argc, const char **argv, void *data)
{
bContext *C = data;
if (CTX_data_scene(C)) {
@ -827,7 +827,7 @@ static int set_start_frame(int argc, char **argv, void *data)
}
}
static int set_end_frame(int argc, char **argv, void *data)
static int set_end_frame(int argc, const char **argv, void *data)
{
bContext *C = data;
if (CTX_data_scene(C)) {
@ -846,7 +846,7 @@ static int set_end_frame(int argc, char **argv, void *data)
}
}
static int set_skip_frame(int argc, char **argv, void *data)
static int set_skip_frame(int argc, const char **argv, void *data)
{
bContext *C = data;
if (CTX_data_scene(C)) {
@ -886,7 +886,7 @@ static int set_skip_frame(int argc, char **argv, void *data)
#endif /* WITH_PYTHON */
static int run_python(int argc, char **argv, void *data)
static int run_python(int argc, const char **argv, void *data)
{
#ifdef WITH_PYTHON
bContext *C = data;
@ -912,7 +912,7 @@ static int run_python(int argc, char **argv, void *data)
#endif /* WITH_PYTHON */
}
static int run_python_console(int UNUSED(argc), char **argv, void *data)
static int run_python_console(int UNUSED(argc), const char **argv, void *data)
{
#ifdef WITH_PYTHON
bContext *C = data;
@ -927,7 +927,7 @@ static int run_python_console(int UNUSED(argc), char **argv, void *data)
#endif /* WITH_PYTHON */
}
static int set_addons(int argc, char **argv, void *data)
static int set_addons(int argc, const char **argv, void *data)
{
/* workaround for scripts not getting a bpy.context.scene, causes internal errors elsewhere */
if (argc > 1) {
@ -950,7 +950,7 @@ static int set_addons(int argc, char **argv, void *data)
}
static int load_file(int UNUSED(argc), char **argv, void *data)
static int load_file(int UNUSED(argc), const char **argv, void *data)
{
bContext *C = data;