From be42cd54dff5c5e02450f9aebca2ea52426896fc Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 5 Sep 2013 16:22:07 +0000 Subject: Ghost test application could be compiled again Was an IRC request to have Ghost application up and running for investigation purposes. --- intern/ghost/test/CMakeLists.txt | 62 +++++++++++++++++++++++++++++++++++-- intern/ghost/test/multitest/stubs.c | 36 +++++++++++++++++++++ 2 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 intern/ghost/test/multitest/stubs.c (limited to 'intern/ghost/test') diff --git a/intern/ghost/test/CMakeLists.txt b/intern/ghost/test/CMakeLists.txt index 98d0f290350..455fff74a5c 100644 --- a/intern/ghost/test/CMakeLists.txt +++ b/intern/ghost/test/CMakeLists.txt @@ -4,6 +4,10 @@ cmake_policy(SET CMP0005 NEW) cmake_minimum_required(VERSION 2.8) +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../../..//build_files/cmake/Modules") + +set(WITH_GUARDEDALLOC ON) + # ----------------------------------------------------------------------------- # Macros @@ -33,6 +37,21 @@ macro(suffix_relpaths unset(_file) endmacro() +macro(data_to_c + file_from file_to + list_to_add) + + list(APPEND ${list_to_add} ${file_to}) + + get_filename_component(_file_to_path ${file_to} PATH) + + add_custom_command( + OUTPUT ${file_to} + COMMAND ${CMAKE_COMMAND} -E make_directory ${_file_to_path} + COMMAND ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/datatoc ${file_from} ${file_to} + DEPENDS ${file_from} datatoc) + unset(_file_to_path) +endmacro() # ----------------------------------------------------------------------------- # Defines @@ -52,7 +71,6 @@ else() unset(_SYSTEM_BIG_ENDIAN) endif() - # ----------------------------------------------------------------------------- # Libraries @@ -84,23 +102,36 @@ suffix_relpaths(SRC_NEW "${SRC}" "../../../source/blender/blenfont/") include_directories(${INC_NEW}) add_library(blenfont_lib ${SRC_NEW}) +# wcwidth +include(${CMAKE_SOURCE_DIR}/../../../extern/wcwidth/CMakeLists.txt) +suffix_relpaths(INC_NEW "${INC}" "../../../extern/wcwidth/") +suffix_relpaths(SRC_NEW "${SRC}" "../../../extern/wcwidth/") +include_directories(${INC_NEW}) +add_library(wcwidth_lib ${SRC_NEW}) + # grr, blenfont needs BLI include_directories( "../../../source/blender/blenlib" ) add_library(bli_lib "../../../source/blender/blenlib/intern/fileops.c" + "../../../source/blender/blenlib/intern/gsqueue.c" "../../../source/blender/blenlib/intern/rct.c" "../../../source/blender/blenlib/intern/string.c" "../../../source/blender/blenlib/intern/string_utf8.c" "../../../source/blender/blenlib/intern/listbase.c" + "../../../source/blender/blenlib/intern/math_color.c" "../../../source/blender/blenlib/intern/storage.c" + "../../../source/blender/blenlib/intern/threads.c" + "../../../source/blender/blenlib/intern/time.c" "../../../source/blender/blenlib/intern/path_util.c" "../../../source/blender/blenlib/intern/BLI_dynstr.c" "../../../source/blender/blenlib/intern/BLI_linklist.c" "../../../source/blender/blenlib/intern/BLI_memarena.c" + "../../../source/blender/blenlib/intern/BLI_mempool.c" ) +set(PLATFORM_CGLAGS) find_package(OpenGL REQUIRED) @@ -113,18 +144,38 @@ include_directories(${OPENGL_INCLUDE_DIR}) include_directories(${FREETYPE_INCLUDE_DIRS}) include_directories(${CMAKE_SOURCE_DIR}/../../../source/blender/blenfont) +if(CMAKE_COMPILER_IS_GNUCC) + set(PLATFORM_CFLAGS "-funsigned-char") +endif() + if(UNIX AND NOT APPLE) find_package(X11 REQUIRED) + find_package(GLEW) + + if(NOT GLEW_FOUND) + message(FATAL_ERROR "GLEW is required to build blender, install it or disable WITH_SYSTEM_GLEW") + endif() set(PLATFORM_LINKLIBS ${X11_X11_LIB} ${X11_Xinput_LIB} + ${GLEW_LIBRARY} + -lpthread ) +else() + # set(GLEW_LIBRARY "") # unused + set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew/include") endif() +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS}") + # ----------------------------------------------------------------------------- # Executables +# DataToC +add_executable(datatoc + ${CMAKE_SOURCE_DIR}/../../../source/blender/datatoc/datatoc.c) # Gears (C) add_executable(gears_c @@ -153,22 +204,29 @@ target_link_libraries(gears_cpp # MultiTest (C) +set(data_to_c_files) +data_to_c(${CMAKE_SOURCE_DIR}/../../../release/datafiles/bfont.ttf + ${CMAKE_CURRENT_BINARY_DIR}/bfont.ttf.c data_to_c_files) + add_executable(multitest_c - ${CMAKE_SOURCE_DIR}/../../../source/blender/editors/datafiles/bfont.ttf.c ${CMAKE_SOURCE_DIR}/multitest/Basic.c ${CMAKE_SOURCE_DIR}/multitest/EventToBuf.c ${CMAKE_SOURCE_DIR}/multitest/MultiTest.c ${CMAKE_SOURCE_DIR}/multitest/ScrollBar.c ${CMAKE_SOURCE_DIR}/multitest/Util.c ${CMAKE_SOURCE_DIR}/multitest/WindowData.c + ${CMAKE_SOURCE_DIR}/multitest/stubs.c + ${data_to_c_files} ) + target_link_libraries(multitest_c blenfont_lib bli_lib ghost_lib string_lib guardedalloc_lib + wcwidth_lib ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${FREETYPE_LIBRARY} diff --git a/intern/ghost/test/multitest/stubs.c b/intern/ghost/test/multitest/stubs.c new file mode 100644 index 00000000000..2cb17675fd6 --- /dev/null +++ b/intern/ghost/test/multitest/stubs.c @@ -0,0 +1,36 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2013 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include + +#include "BLI_utildefines.h" +#include "IMB_imbuf.h" + +struct ImBuf; + +void IMB_freeImBuf(struct ImBuf *UNUSED(ibuf)) {} +void IMB_colormanagement_display_to_scene_linear_v3(float UNUSED(pixel[3]), struct ColorManagedDisplay *UNUSED(display)) {} -- cgit v1.2.3