Changeset 518

Show
Ignore:
Timestamp:
04/06/08 06:15:01 (6 months ago)
Author:
krobillard
Message:

Thune-gl is now built separately with CMake.
Added UG_DT_COUNT & ug_datatypes to thune-gl header.

Location:
trunk/thune
Files:
9 modified

Legend:

Unmodified
Added
Removed
  • trunk/thune/CMakeLists.txt

    r517 r518  
    1616 
    1717 
     18# Why isn't this the default? 
     19# Having to repeat the conditional expression is retarded. 
     20set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) 
     21 
    1822set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/") 
    1923 
     
    2226        add_definitions(-std=c99 -pedantic -D_GNU_SOURCE) 
    2327    set(OS_FILE unix/os.c) 
    24 endif (UNIX) 
     28endif () 
    2529 
    2630if (WIN32) 
    2731        include_directories(. win32) 
    2832    set(OS_FILE win32/os.c) 
    29 endif (WIN32) 
     33endif () 
    3034 
    3135 
     
    5458set_target_properties(thune-lib PROPERTIES OUTPUT_NAME "thune") 
    5559 
     60if (APPLE) 
     61    target_link_libraries(thune-lib m bz2) 
     62endif () 
     63if (UNIX AND NOT APPLE) 
     64    target_link_libraries(thune-lib m bz2 pthread) 
     65endif () 
     66if (WIN32) 
     67    target_link_libraries(thune-lib ws2_32) 
     68endif () 
    5669 
    57 add_executable(thune 
    58         console.c 
    59 ) 
    6070 
    61 if (APPLE) 
    62     target_link_libraries(thune thune-lib m bz2) 
    63 endif (APPLE) 
     71add_executable(thune-bin console.c) 
     72set_target_properties(thune-bin PROPERTIES OUTPUT_NAME "thune") 
    6473 
    65 if (UNIX AND NOT APPLE) 
    66     target_link_libraries(thune thune-lib m bz2 pthread) 
    67 endif (UNIX AND NOT APPLE) 
     74# NOTE: This links the binary with the libraries thune-lib links against. 
     75# This creates unneeded linker dependencies, but the CMake FAQ says that 
     76# there is no way to change this behavior. 
     77# Here is a blog entry which talks about this problem: 
     78#   http://blogs.sun.com/rie/entry/tt_dependencies_tt_define_what 
    6879 
    69 if (WIN32) 
    70     target_link_libraries(thune thune-lib ws2_32) 
    71 endif (WIN32) 
     80target_link_libraries(thune-bin thune-lib) 
    7281 
    7382 
    7483if (UNIX) 
    75 install(TARGETS thune    DESTINATION /usr/local/bin) 
     84install(TARGETS thune-bin DESTINATION /usr/local/bin) 
    7685install(TARGETS thune-lib DESTINATION /usr/local/lib) 
    7786install(FILES   urlan.h   DESTINATION /usr/local/include) 
    78 endif (UNIX) 
    79  
    80  
    81 find_package( FreeType ) 
    82 find_package( OpenGL ) 
    83 find_package( OpenAL ) 
    84 find_package( PNG ) 
    85 find_package( GLV ) 
    86  
    87 # Holy shit CMake authors, having to repeat the conditional expression 
    88 # is retarded! 
    89  
    90 if (FREETYPE_FOUND AND OPENGL_FOUND AND OPENAL_FOUND AND PNG_FOUND AND GLV_FOUND) 
    91         add_subdirectory( gl . ) 
    92 else (FREETYPE_FOUND AND OPENGL_FOUND AND OPENAL_FOUND AND PNG_FOUND AND GLV_FOUND) 
    93         message(STATUS "Skipping Thune-GL. Missing these dependencies:") 
    94         if (NOT FREETYPE_FOUND) 
    95                 message(STATUS "  FreeType not found") 
    96         endif (NOT FREETYPE_FOUND) 
    97         if (NOT OPENGL_FOUND) 
    98                 message(STATUS "  OpenGL not found") 
    99         endif (NOT OPENGL_FOUND) 
    100         if (NOT OPENAL_FOUND) 
    101                 message(STATUS "  OpenAL not found") 
    102         endif (NOT OPENAL_FOUND) 
    103         if (NOT PNG_FOUND) 
    104                 message(STATUS "  PNG not found") 
    105         endif (NOT PNG_FOUND) 
    106         if (NOT GLV_FOUND) 
    107                 message(STATUS "  GLV not found") 
    108         endif (NOT GLV_FOUND) 
    109 endif (FREETYPE_FOUND AND OPENGL_FOUND AND OPENAL_FOUND AND PNG_FOUND AND GLV_FOUND) 
     87endif () 
    11088 
    11189# eof 
  • trunk/thune/cmake_modules/FindThuneGL.cmake

    r517 r518  
     1FIND_PATH(THUNEGL_INCLUDE_DIR thune-gl.h /usr/include /usr/local/include) 
     2 
    13FIND_LIBRARY(THUNEGL_LIBRARY NAMES thune-gl PATH /usr/lib64 /usr/local/lib64 /usr/lib /usr/local/lib)  
    24 
    3 IF (THUNEGL_LIBRARY) 
     5IF (THUNEGL_INCLUDE_DIR AND THUNEGL_LIBRARY) 
    46   SET(THUNEGL_FOUND TRUE) 
    5 ENDIF (THUNEGL_LIBRARY) 
     7ENDIF (THUNEGL_INCLUDE_DIR AND THUNEGL_LIBRARY) 
    68 
    79IF (THUNEGL_FOUND) 
    810   IF (NOT ThuneGL_FIND_QUIETLY) 
    9       MESSAGE(STATUS "Found Thune-GL: ${THUNE_LIBRARY}") 
     11      MESSAGE(STATUS "Found Thune-GL: ${THUNEGL_LIBRARY}") 
    1012   ENDIF (NOT ThuneGL_FIND_QUIETLY) 
    1113ELSE (THUNEGL_FOUND) 
  • trunk/thune/console.c

    r468 r518  
    3131#elif defined(THUNE_GL) 
    3232 
    33 extern int  gx_startup( UrlanEnv* ); 
    34 extern void gx_shutdown( UrlanEnv* ); 
    35 extern UDatatype ug_datatypes[]; 
     33#include "gx.h" 
    3634#define APPNAME     "Thune-GL" 
    3735#define CUSTOM_DT           ug_datatypes 
    38 #define CUSTOM_DT_COUNT     6 
     36#define CUSTOM_DT_COUNT     UG_DT_COUNT 
    3937 
    4038#else 
  • trunk/thune/gl/CMakeLists.txt

    r517 r518  
    11project(ThuneGL C) 
    2  
    3 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../cmake_modules/") 
    42 
    53# set(CMAKE_BUILD_TYPE Debug) 
     
    75 
    86 
    9 # These package checks are only needed when ../CMakeLists.txt is not used. 
    10 #find_package( FreeType REQUIRED ) 
    11 #find_package( OpenGL REQUIRED ) 
    12 #find_package( OpenAL REQUIRED ) 
    13 #find_package( PNG REQUIRED ) 
    14 #find_package( GLV REQUIRED ) 
     7# Why isn't this the default? 
     8# Having to repeat the conditional expression is retarded. 
     9set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) 
     10 
     11set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../cmake_modules/") 
     12 
     13 
     14find_package( Thune REQUIRED ) 
     15find_package( FreeType REQUIRED ) 
     16find_package( OpenGL REQUIRED ) 
     17find_package( OpenAL REQUIRED ) 
     18find_package( PNG REQUIRED ) 
     19find_package( GLV REQUIRED ) 
    1520 
    1621 
     
    1924    add_definitions(-std=c99) 
    2025#    set(GLV_FILE glv/mac/glv.c) 
    21 endif (APPLE) 
     26endif () 
    2227 
    2328if (UNIX AND NOT APPLE) 
     
    2833#    set(GLV_FILE glv/x11/glv.c) 
    2934    set(JOYSTICK_FILE joystick.c) 
    30 endif (UNIX AND NOT APPLE) 
     35endif () 
    3136 
    3237if (WIN32) 
    3338    include_directories(../win32) 
    3439#    set(GLV_FILE glv/win32/glv.c) 
    35 endif (WIN32) 
     40endif () 
    3641 
    3742 
     
    7075set_target_properties(thuneGL-lib PROPERTIES OUTPUT_NAME "thune-gl") 
    7176 
     77if (APPLE) 
     78    target_link_libraries(thuneGL-lib bz2 m) 
     79endif () 
     80 
     81if (UNIX AND NOT APPLE) 
     82    target_link_libraries(thuneGL-lib 
     83        vorbis vorbisfile alut 
     84        X11 Xxf86vm 
     85        bz2 m pthread 
     86    ) 
     87endif () 
     88 
     89if (WIN32) 
     90    target_link_libraries(thuneGL-lib ws2_32) 
     91endif () 
     92 
    7293link_directories(../) 
    7394target_link_libraries(thuneGL-lib 
    74     thune-lib 
     95    ${THUNE_LIBRARY} 
    7596    ${PNG_LIBRARY} 
    7697    ${FREETYPE_LIBRARY} 
     
    82103 
    83104 
    84 add_executable(thune-gl 
    85     ../console.c 
    86 ) 
    87  
     105add_executable(thune-gl ../console.c) 
    88106target_link_libraries(thune-gl thuneGL-lib) 
    89  
    90  
    91 if (APPLE) 
    92     target_link_libraries(thuneGL-lib bz2 m) 
    93 endif (APPLE) 
    94  
    95 if (UNIX AND NOT APPLE) 
    96     target_link_libraries(thuneGL-lib 
    97         vorbis vorbisfile alut 
    98         X11 Xxf86vm 
    99         bz2 m pthread 
    100     ) 
    101 endif (UNIX AND NOT APPLE) 
    102  
    103 if (WIN32) 
    104     target_link_libraries(thuneGL-lib ws2_32) 
    105 endif (WIN32) 
    106107 
    107108 
     
    110111install(TARGETS thuneGL-lib  DESTINATION /usr/local/lib) 
    111112#install(FILES   urlan.h     DESTINATION /usr/local/include) 
    112 endif (UNIX) 
     113endif () 
    113114 
    114115 
  • trunk/thune/gl/gx.h

    r517 r518  
    174174}; 
    175175 
     176 
     177#define UG_DT_COUNT    6 
     178extern UDatatype ug_datatypes[ UG_DT_COUNT ]; 
    176179 
    177180extern struct GrRenderState grState; 
  • trunk/thune/gl/gx_dt.c

    r516 r518  
    11351135 
    11361136 
    1137 UDatatype ug_datatypes[ 6 ] = 
     1137UDatatype ug_datatypes[ UG_DT_COUNT ] = 
    11381138{ 
    11391139    {"draw-list!", 0, 0, 
  • trunk/thune/gl/project.r

    r517 r518  
    1313    include_from %. 
    1414    include_from %.. 
    15     libs_from %.. %thune0 
     15   ;libs_from %.. %thune0 
    1616    cflags {-DLANG_THUNE} 
    1717    cflags {-DNO_AUDIO} 
     
    2222        include_from %/usr/include/freetype2 
    2323        sources [%joystick.c] 
     24 
     25        ;libs [%X11 %Xxf86vm] 
     26        ;libs [%freetype %bz2 %png %glv %GL %GLU 
     27        ;      %openal %alut %vorbis %vorbisfile] 
    2428    ] 
    2529    macx [ 
     
    7680 
    7781exe %thune-gl [ 
    78     opengl 
    7982    cflags {-DLANG_THUNE -DTHUNE_GL} 
     83    include_from %. 
    8084    libs_from %. %thune-gl0 
     85    libs_from %.. %thune0 
    8186    linux [ 
    82         libs_from %/usr/X11R6/lib64 [%X11 %Xxf86vm] 
    8387        ;libs_from %/usr/X11R6/lib [%X11 %Xxf86vm] 
     88        libs [%X11 %Xxf86vm] 
    8489        libs [%freetype %bz2 %png %glv] 
    8590        libs [%openal %alut %vorbis %vorbisfile] 
  • trunk/thune/project.r

    r516 r518  
    8282    unix [ 
    8383        sources [ %unix/os.c ] 
     84        ;libs {m bz2 pthread} 
    8485    ] 
    8586    win32 [ 
     
    99100 
    100101    macx  [ 
    101         libs %m 
    102         libs %bz2 
     102        libs {m bz2} 
    103103    ] 
    104104    unix  [ 
  • trunk/thune/thune-gl.spec

    r517 r518  
    1111BuildRoot: %{_tmppath}/thune-%{version}-build 
    1212%if 0%{?fedora_version} 
    13 BuildRequires: cmake libglv mesa-libGL-devel mesa-libGLU-devel freetype-devel openal-devel freealut-devel libvorbis-devel libpng-devel libXxf86vm-devel 
     13BuildRequires: cmake libglv thune mesa-libGL-devel mesa-libGLU-devel freetype-devel openal-devel freealut-devel libvorbis-devel libpng-devel libXxf86vm-devel 
    1414%endif 
    1515%if 0%{?mandriva_version} 
    16 BuildRequires: cmake libglv libmesagl1-devel libmesaglu1-devel freetype2-devel openal0-devel libfreealut0-devel libvorbis-devel libpng-devel libbzip2_1-devel 
     16BuildRequires: cmake libglv thune libmesagl1-devel libmesaglu1-devel freetype2-devel openal0-devel libfreealut0-devel libvorbis-devel libpng-devel libbzip2_1-devel 
    1717%endif 
    1818%if 0%{?suse_version} 
    19 BuildRequires: cmake libglv Mesa-devel freetype2-devel openal-devel freealut-devel libvorbis-devel libpng-devel 
     19BuildRequires: cmake libglv thune Mesa-devel freetype2-devel openal-devel freealut-devel libvorbis-devel libpng-devel 
    2020%endif 
    2121 
     
    2929 
    3030%build 
    31 cmake . 
     31cmake ./gl 
    3232make 
    3333