CMake file to build ghost tests again.
authorCampbell Barton <ideasman42@gmail.com>
Sun, 3 Jul 2011 16:17:38 +0000 (16:17 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 3 Jul 2011 16:17:38 +0000 (16:17 +0000)
intern/ghost/test/CMakeLists.txt [new file with mode: 0644]
intern/ghost/test/gears/GHOST_C-Test.c
intern/ghost/test/gears/GHOST_Test.cpp

diff --git a/intern/ghost/test/CMakeLists.txt b/intern/ghost/test/CMakeLists.txt
new file mode 100644 (file)
index 0000000..b863042
--- /dev/null
@@ -0,0 +1,123 @@
+
+cmake_policy(SET CMP0003 NEW)
+cmake_policy(SET CMP0005 NEW)
+
+cmake_minimum_required(VERSION 2.8)
+
+# -----------------------------------------------------------------------------
+# Macros
+
+
+# stub macro, does nothing
+macro(blender_add_lib
+       name
+       sources
+       includes
+       includes_sys
+       )
+
+endmacro()
+
+# suffix relative paths so we can use external cmake files
+macro(suffix_relpaths
+       new_files files prefix)
+
+       set(${new_files})
+       foreach(_file ${files})
+               if(IS_ABSOLUTE _file)
+                       list(APPEND ${new_files} ${_file})
+               else()
+                       list(APPEND ${new_files} "${prefix}${_file}")
+               endif()
+       endforeach()
+       unset(_file)
+endmacro()
+
+
+# -----------------------------------------------------------------------------
+# Libraries
+
+# ghost
+include(${CMAKE_SOURCE_DIR}/../CMakeLists.txt)
+suffix_relpaths(INC_NEW "${INC}" "../")
+suffix_relpaths(SRC_NEW "${SRC}" "../")
+include_directories(${INC_NEW})
+add_library(ghost_lib ${SRC_NEW})
+
+# string
+include(${CMAKE_SOURCE_DIR}/../../string/CMakeLists.txt)
+suffix_relpaths(INC_NEW "${INC}" "../../string/")
+suffix_relpaths(SRC_NEW "${SRC}" "../../string/")
+include_directories(${INC_NEW})
+add_library(string_lib ${SRC_NEW})
+
+# guardedalloc
+include(${CMAKE_SOURCE_DIR}/../../guardedalloc/CMakeLists.txt)
+suffix_relpaths(INC_NEW "${INC}" "../../guardedalloc/")
+suffix_relpaths(SRC_NEW "${SRC}" "../../guardedalloc/")
+include_directories(${INC_NEW})
+add_library(guardedalloc_lib ${SRC_NEW})
+
+
+find_package(OpenGL REQUIRED)
+
+include_directories(${CMAKE_SOURCE_DIR}/../)
+include_directories(${OPENGL_INCLUDE_DIR})
+
+if(UNIX AND NOT APPLE)
+       find_package(X11 REQUIRED)
+
+       set(PLATFORM_LINKLIBS
+               ${X11_X11_LIB}
+               ${X11_Xinput_LIB}
+       )
+endif()
+
+# -----------------------------------------------------------------------------
+# Executables
+
+
+# Gears (C)
+add_executable(gears_c
+               ${CMAKE_SOURCE_DIR}/gears/GHOST_C-Test.c)
+
+target_link_libraries(gears_c
+               ghost_lib
+               string_lib
+               ${OPENGL_gl_LIBRARY}
+               ${OPENGL_glu_LIBRARY}
+               ${PLATFORM_LINKLIBS}
+               )
+
+
+# Gears (C++)
+add_executable(gears_cpp
+               ${CMAKE_SOURCE_DIR}/gears/GHOST_Test.cpp)
+
+target_link_libraries(gears_cpp
+               ghost_lib
+               string_lib
+               ${OPENGL_gl_LIBRARY}
+               ${OPENGL_glu_LIBRARY}
+               ${PLATFORM_LINKLIBS}
+               )
+
+
+# MultiTest (C)
+add_executable(multitest_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
+)
+
+target_link_libraries(multitest_c
+               ghost_lib
+               string_lib
+               guardedalloc_lib
+               ${OPENGL_gl_LIBRARY}
+               ${OPENGL_glu_LIBRARY}
+               ${PLATFORM_LINKLIBS}
+               )
index b34a37132b60a0c6cb2c762f3a0299739d6473da..c582d205258adc07df22075d8bb1b05963dabd5c 100644 (file)
@@ -474,6 +474,7 @@ int main(int argc, char** argv)
                        200,
                        GHOST_kWindowStateNormal,
                        GHOST_kDrawingContextTypeOpenGL,
+                       FALSE,
                        FALSE);
                if (!sMainWindow)
                {
@@ -490,6 +491,7 @@ int main(int argc, char** argv)
                        200,
                        GHOST_kWindowStateNormal,
                        GHOST_kDrawingContextTypeOpenGL,
+                       FALSE,
                        FALSE);
                if (!sSecondaryWindow)
                {
index 6e269e1cede7b81dd614d7d1358d1772637c4ffe..930faf463b618296a3a103927cbfec95e9817458 100644 (file)
@@ -428,7 +428,7 @@ Application::Application(GHOST_ISystem* system)
        // Create the main window
        STR_String title1 ("gears - main window");
        m_mainWindow = system->createWindow(title1, 10, 64, 320, 200, GHOST_kWindowStateNormal,
-               GHOST_kDrawingContextTypeOpenGL, true /* stereo flag */);
+               GHOST_kDrawingContextTypeOpenGL, false, false);
 
     if (!m_mainWindow) {
                std::cout << "could not create main window\n";
@@ -438,7 +438,7 @@ Application::Application(GHOST_ISystem* system)
        // Create a secondary window
        STR_String title2 ("gears - secondary window");
        m_secondaryWindow = system->createWindow(title2, 340, 64, 320, 200, GHOST_kWindowStateNormal,
-               GHOST_kDrawingContextTypeOpenGL, false /* stereo flag */);
+               GHOST_kDrawingContextTypeOpenGL, false, false);
        if (!m_secondaryWindow) {
                cout << "could not create secondary window\n";
                exit(-1);