diff options
Diffstat (limited to 'source/creator')
-rw-r--r-- | source/creator/CMakeLists.txt | 82 | ||||
-rw-r--r-- | source/creator/creator.c | 69 |
2 files changed, 85 insertions, 66 deletions
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index eef21bd480d..c1ba7ebbb67 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -125,7 +125,7 @@ if(WIN32 AND NOT UNIX) -DBLEN_VER_RC_4=0 ) endif() - + list(APPEND SRC ../icons/winblender.rc @@ -198,16 +198,16 @@ if(WITH_PYTHON_MODULE) LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin # only needed on windows ) - + if(WIN32) # python modules use this set_target_properties( blender PROPERTIES SUFFIX ".pyd" - ) + ) endif() - + else() add_executable(blender ${EXETYPE} ${SRC}) endif() @@ -351,11 +351,6 @@ if(UNIX AND NOT APPLE) if(WITH_INTERNATIONAL) install( - FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages - DESTINATION ${TARGETDIR_VER} - ) - - install( DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale ${CMAKE_SOURCE_DIR}/release/bin/.blender/fonts @@ -428,10 +423,6 @@ elseif(WIN32) if(WITH_INTERNATIONAL) # same as linux!, deduplicate install( - FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages - DESTINATION ${TARGETDIR_VER} - ) - install( DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale ${CMAKE_SOURCE_DIR}/release/bin/.blender/fonts @@ -591,12 +582,12 @@ elseif(WIN32) FILES ${LIBDIR}/thumbhandler/lib/BlendThumb.dll DESTINATION ${TARGETDIR} ) - else() - install( - FILES ${LIBDIR}/thumbhandler/lib/BlendThumb64.dll - DESTINATION ${TARGETDIR} - ) endif() + + install( # x86 builds can run on x64 Windows, so this is required at all times + FILES ${LIBDIR}/thumbhandler/lib/BlendThumb64.dll + DESTINATION ${TARGETDIR} + ) if(WITH_OPENIMAGEIO) install( @@ -672,11 +663,6 @@ elseif(APPLE) # localization if(WITH_INTERNATIONAL) install( - FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages - DESTINATION ${TARGETDIR_VER}/datafiles - ) - - install( DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/fonts ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale @@ -695,14 +681,14 @@ elseif(APPLE) DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/python) set(PYTHON_ZIP "python_${CMAKE_OSX_ARCHITECTURES}.zip") - + add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/python COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/python/ COMMAND mkdir ${CMAKE_CURRENT_BINARY_DIR}/python/ COMMAND unzip -q ${LIBDIR}/release/${PYTHON_ZIP} -d ${CMAKE_CURRENT_BINARY_DIR}/python/ DEPENDS ${LIBDIR}/release/${PYTHON_ZIP}) - + add_dependencies(blender extractpyzip) # copy extracted python files @@ -717,6 +703,48 @@ elseif(APPLE) \${TARGETDIR_VER} ) endif() + + # install blenderplayer bundle - copy of blender.app above. re-using macros et al + # note we are using OSX Bundle as base and copying Blender dummy bundle on top of it + if(WITH_GAMEENGINE AND WITH_PLAYER) + set(PLAYER_SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blenderplayer.app) + set(PLAYER_SOURCEINFO ${PLAYER_SOURCEDIR}/Contents/Info.plist) + set(PLAYER_TARGETDIR_VER ${TARGETDIR}/blenderplayer.app/Contents/MacOS/${BLENDER_VERSION}) + + + # important to make a clean install each time else old scripts get loaded. + install( + CODE + "file(REMOVE_RECURSE ${PLAYER_TARGETDIR_VER})" + ) + + install( + FILES ${PLAYER_SOURCEDIR}/Contents/PkgInfo + DESTINATION ${TARGETDIR}/blenderplayer.app/Contents + ) + + install_dir( + ${PLAYER_SOURCEDIR}/Contents/Resources + \${TARGETDIR}/blenderplayer.app/Contents/ + ) + + # python + if(WITH_PYTHON) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/python + COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/python/ + COMMAND mkdir ${CMAKE_CURRENT_BINARY_DIR}/python/ + COMMAND unzip -q ${LIBDIR}/release/${PYTHON_ZIP} -d ${CMAKE_CURRENT_BINARY_DIR}/python/ + DEPENDS ${LIBDIR}/release/${PYTHON_ZIP}) + + # copy extracted python files + install_dir( + ${CMAKE_CURRENT_BINARY_DIR}/python + \${PLAYER_TARGETDIR_VER} + ) + endif() + + endif() endif() # install more files XXX pass target dir @@ -905,12 +933,12 @@ endif() message(STATUS "Blender Skipping: (${REM_MSG})") endif() target_link_libraries(blender ${BLENDER_SORTED_LIBS}) - + unset(SEARCHLIB) unset(SORTLIB) unset(REMLIB) unset(REM_MSG) - + #else() # target_link_libraries(blender ${BLENDER_LINK_LIBS}) #endif() diff --git a/source/creator/creator.c b/source/creator/creator.c index abb993e4cb1..64f8cf463da 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -46,12 +46,6 @@ #include <stddef.h> #include <string.h> -/* for setuid / getuid */ -#ifdef __sgi -#include <sys/types.h> -#include <unistd.h> -#endif - /* This little block needed for linking to Blender... */ #include "MEM_guardedalloc.h" @@ -157,7 +151,7 @@ char btempdir[FILE_MAX]; static void setCallbacks(void); /* set breakpoints here when running in debug mode, useful to catch floating point errors */ -#if defined(__sgi) || defined(__linux__) || defined(_WIN32) || defined(OSX_SSE_FPE) +#if defined(__linux__) || defined(_WIN32) || defined(OSX_SSE_FPE) static void fpe_handler(int UNUSED(sig)) { // printf("SIGFPE trapped\n"); @@ -366,7 +360,7 @@ static int debug_mode(int UNUSED(argc), const char **UNUSED(argv), void *data) static int set_fpe(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data)) { -#if defined(__sgi) || defined(__linux__) || defined(_WIN32) || defined(OSX_SSE_FPE) +#if defined(__linux__) || defined(_WIN32) || defined(OSX_SSE_FPE) /* zealous but makes float issues a heck of a lot easier to find! * set breakpoints on fpe_handler */ signal(SIGFPE, fpe_handler); @@ -490,7 +484,7 @@ static int no_joystick(int UNUSED(argc), const char **UNUSED(argv), void *data) SYS_SystemHandle *syshandle = data; /** - don't initialize joysticks if user doesn't want to use joysticks + don't initialize joysticks if user doesn't want to use joysticks failed joystick initialization delays over 5 seconds, before game engine start */ SYS_WriteCommandLineInt(*syshandle, "nojoystick",1); @@ -527,8 +521,8 @@ static int set_output(int argc, const char **argv, void *data) { bContext *C = data; if (argc >= 1){ - if (CTX_data_scene(C)) { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { BLI_strncpy(scene->r.pic, argv[1], sizeof(scene->r.pic)); } else { printf("\nError: no blend loaded. cannot use '-o / --render-output'.\n"); @@ -553,17 +547,17 @@ static int set_engine(int argc, const char **argv, void *data) exit(0); } else { - if (CTX_data_scene(C)==NULL) { - printf("\nError: no blend loaded. order the arguments so '-E / --engine ' is after a blend is loaded.\n"); - } - else { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { RenderData *rd = &scene->r; if(BLI_findstring(&R_engines, argv[1], offsetof(RenderEngineType, idname))) { BLI_strncpy_utf8(rd->engine, argv[1], sizeof(rd->engine)); } } + else { + printf("\nError: no blend loaded. order the arguments so '-E / --engine ' is after a blend is loaded.\n"); + } } return 1; @@ -580,10 +574,8 @@ static int set_image_type(int argc, const char **argv, void *data) bContext *C = data; if (argc >= 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 { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { if (!strcmp(imtype,"TGA")) scene->r.imtype = R_TARGA; else if (!strcmp(imtype,"IRIS")) scene->r.imtype = R_IRIS; #ifdef WITH_DDS @@ -619,6 +611,9 @@ static int set_image_type(int argc, const char **argv, void *data) #endif else printf("\nError: Format from '-F / --render-format' not known or not compiled in this release.\n"); } + else { + printf("\nError: no blend loaded. order the arguments so '-F / --render-format' is after the blend is loaded.\n"); + } return 1; } else { printf("\nError: you must specify a format after '-F / --render-foramt'.\n"); @@ -645,8 +640,8 @@ static int set_extension(int argc, const char **argv, void *data) { bContext *C = data; if (argc >= 1) { - if (CTX_data_scene(C)) { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { if (argv[1][0] == '0') { scene->r.scemode &= ~R_EXTENSION; } else if (argv[1][0] == '1') { @@ -728,9 +723,9 @@ example: static int render_frame(int argc, const char **argv, void *data) { bContext *C = data; - if (CTX_data_scene(C)) { + Scene *scene= CTX_data_scene(C); + if (scene) { Main *bmain= CTX_data_main(C); - Scene *scene= CTX_data_scene(C); if (argc > 1) { Render *re = RE_NewRender(scene->id.name); @@ -770,9 +765,9 @@ static int render_frame(int argc, const char **argv, void *data) static int render_animation(int UNUSED(argc), const char **UNUSED(argv), void *data) { bContext *C = data; - if (CTX_data_scene(C)) { + Scene *scene= CTX_data_scene(C); + if (scene) { Main *bmain= CTX_data_main(C); - Scene *scene= CTX_data_scene(C); Render *re= RE_NewRender(scene->id.name); ReportList reports; BKE_reports_init(&reports, RPT_PRINT); @@ -789,9 +784,9 @@ static int set_scene(int argc, const char **argv, void *data) { if(argc > 1) { bContext *C= data; - Scene *sce= set_scene_name(CTX_data_main(C), argv[1]); - if(sce) { - CTX_data_scene_set(C, sce); + Scene *scene= set_scene_name(CTX_data_main(C), argv[1]); + if(scene) { + CTX_data_scene_set(C, scene); } return 1; } else { @@ -803,8 +798,8 @@ static int set_scene(int argc, const char **argv, void *data) static int set_start_frame(int argc, const char **argv, void *data) { bContext *C = data; - if (CTX_data_scene(C)) { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { if (argc > 1) { int frame = atoi(argv[1]); (scene->r.sfra) = CLAMPIS(frame, MINFRAME, MAXFRAME); @@ -822,8 +817,8 @@ static int set_start_frame(int argc, const char **argv, void *data) static int set_end_frame(int argc, const char **argv, void *data) { bContext *C = data; - if (CTX_data_scene(C)) { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { if (argc > 1) { int frame = atoi(argv[1]); (scene->r.efra) = CLAMPIS(frame, MINFRAME, MAXFRAME); @@ -841,8 +836,8 @@ static int set_end_frame(int argc, const char **argv, void *data) static int set_skip_frame(int argc, const char **argv, void *data) { bContext *C = data; - if (CTX_data_scene(C)) { - Scene *scene= CTX_data_scene(C); + Scene *scene= CTX_data_scene(C); + if (scene) { if (argc > 1) { int frame = atoi(argv[1]); (scene->r.frame_step) = CLAMPIS(frame, 1, MAXFRAME); @@ -1194,10 +1189,6 @@ int main(int argc, const char **argv) BLI_argsParse(ba, 1, NULL, NULL); -#ifdef __sgi - setuid(getuid()); /* end superuser */ -#endif - #if defined(WITH_PYTHON_MODULE) || defined(WITH_HEADLESS) G.background= 1; /* python module mode ALWAYS runs in background mode (for now) */ #else |