CMakeLists.txt
author Ryan C. Gordon <icculus@icculus.org>
Wed, 05 Nov 2008 20:53:05 -0500
changeset 455 d99f47386d51
parent 423 ee393c1cf3b4
child 465 0a75f98f785b
permissions -rw-r--r--
Generate MOJOSHADER_VERSION, etc.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35
5749d174b537 [svn] Might as well keep the tradition alive.
icculus
parents: 10
diff changeset
     1
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
5749d174b537 [svn] Might as well keep the tradition alive.
icculus
parents: 10
diff changeset
     2
PROJECT(MojoShader)
48
86dc2c772d26 [svn] Enabled -Wall, found some bugs.
icculus
parents: 35
diff changeset
     3
455
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
     4
EXECUTE_PROCESS(
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
     5
    COMMAND hg tip --template {rev}
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
     6
    WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
     7
    RESULT_VARIABLE HGVERSION_RC
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
     8
    OUTPUT_VARIABLE MOJOSHADER_VERSION
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
     9
    ERROR_QUIET
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
    10
    OUTPUT_STRIP_TRAILING_WHITESPACE
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
    11
)
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
    12
EXECUTE_PROCESS(
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
    13
    COMMAND hg tip --template hg-{rev}:{node|short}
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
    14
    WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
    15
    RESULT_VARIABLE HGVERSION_RC
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
    16
    OUTPUT_VARIABLE MOJOSHADER_CHANGESET
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
    17
    ERROR_QUIET
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
    18
    OUTPUT_STRIP_TRAILING_WHITESPACE
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
    19
)
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
    20
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
    21
WRITE_FILE(
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
    22
    "${CMAKE_CURRENT_SOURCE_DIR}/mojoshader_version.h"
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
    23
    "/* This file was autogenerated. Do not edit! */\n"
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
    24
    "#ifndef _INCL_MOJOSHADER_VERSION_H_\n"
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
    25
    "#define _INCL_MOJOSHADER_VERSION_H_\n"
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
    26
    "#define MOJOSHADER_VERSION ${MOJOSHADER_VERSION}\n"
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
    27
    "#define MOJOSHADER_CHANGESET \"${MOJOSHADER_CHANGESET}\"\n"
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
    28
    "#endif\n"
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
    29
)
d99f47386d51 Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents: 423
diff changeset
    30
48
86dc2c772d26 [svn] Enabled -Wall, found some bugs.
icculus
parents: 35
diff changeset
    31
IF(CMAKE_COMPILER_IS_GNUCC)
86dc2c772d26 [svn] Enabled -Wall, found some bugs.
icculus
parents: 35
diff changeset
    32
    ADD_DEFINITIONS(-Wall -ggdb3)
86dc2c772d26 [svn] Enabled -Wall, found some bugs.
icculus
parents: 35
diff changeset
    33
ENDIF(CMAKE_COMPILER_IS_GNUCC)
86dc2c772d26 [svn] Enabled -Wall, found some bugs.
icculus
parents: 35
diff changeset
    34
52
305ddf21d660 [svn] Okay, done with memory profiling for now.
icculus
parents: 48
diff changeset
    35
# testparse uses this when I'm looking at memory usage patterns.
305ddf21d660 [svn] Okay, done with memory profiling for now.
icculus
parents: 48
diff changeset
    36
#ADD_DEFINITIONS(-DMOJOSHADER_DEBUG_MALLOC=1)
48
86dc2c772d26 [svn] Enabled -Wall, found some bugs.
icculus
parents: 35
diff changeset
    37
254
13184ff204b9 More Windows patches.
Ryan C. Gordon <icculus@icculus.org>
parents: 225
diff changeset
    38
IF(MSVC)
13184ff204b9 More Windows patches.
Ryan C. Gordon <icculus@icculus.org>
parents: 225
diff changeset
    39
    ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS=1)
13184ff204b9 More Windows patches.
Ryan C. Gordon <icculus@icculus.org>
parents: 225
diff changeset
    40
    ADD_DEFINITIONS(-TP)  # force .c files to compile as C++.
13184ff204b9 More Windows patches.
Ryan C. Gordon <icculus@icculus.org>
parents: 225
diff changeset
    41
ENDIF(MSVC)
13184ff204b9 More Windows patches.
Ryan C. Gordon <icculus@icculus.org>
parents: 225
diff changeset
    42
415
25ca83d8bbd5 Build mojoshader.c and mojoshader_opengl.c into a static library.
Ryan C. Gordon <icculus@icculus.org>
parents: 406
diff changeset
    43
ADD_LIBRARY(mojoshader STATIC mojoshader.c mojoshader_opengl.c)
25ca83d8bbd5 Build mojoshader.c and mojoshader_opengl.c into a static library.
Ryan C. Gordon <icculus@icculus.org>
parents: 406
diff changeset
    44
333
2b36a1d72fa1 Wrote most of the arb1 OpenGL glue code.
Ryan C. Gordon <icculus@icculus.org>
parents: 328
diff changeset
    45
FIND_PACKAGE(SDL)
169
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    46
IF(SDL_FOUND)
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    47
    INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR})
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    48
    ADD_DEFINITIONS(-DFINDERRORS_COMPILE_SHADERS=1)
269
fbc4e1843809 Added glcaps.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
    49
    ADD_EXECUTABLE(glcaps glcaps.c)
fbc4e1843809 Added glcaps.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 254
diff changeset
    50
    TARGET_LINK_LIBRARIES(glcaps ${SDL_LIBRARY})
415
25ca83d8bbd5 Build mojoshader.c and mojoshader_opengl.c into a static library.
Ryan C. Gordon <icculus@icculus.org>
parents: 406
diff changeset
    51
    ADD_EXECUTABLE(bestprofile bestprofile.c)
25ca83d8bbd5 Build mojoshader.c and mojoshader_opengl.c into a static library.
Ryan C. Gordon <icculus@icculus.org>
parents: 406
diff changeset
    52
    TARGET_LINK_LIBRARIES(bestprofile mojoshader ${SDL_LIBRARY})
423
ee393c1cf3b4 Added availableprofiles.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 415
diff changeset
    53
    ADD_EXECUTABLE(availableprofiles availableprofiles.c)
ee393c1cf3b4 Added availableprofiles.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 415
diff changeset
    54
    TARGET_LINK_LIBRARIES(availableprofiles mojoshader ${SDL_LIBRARY})
169
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    55
ENDIF(SDL_FOUND)
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    56
415
25ca83d8bbd5 Build mojoshader.c and mojoshader_opengl.c into a static library.
Ryan C. Gordon <icculus@icculus.org>
parents: 406
diff changeset
    57
ADD_EXECUTABLE(testparse testparse.c)
25ca83d8bbd5 Build mojoshader.c and mojoshader_opengl.c into a static library.
Ryan C. Gordon <icculus@icculus.org>
parents: 406
diff changeset
    58
TARGET_LINK_LIBRARIES(testparse mojoshader)
25ca83d8bbd5 Build mojoshader.c and mojoshader_opengl.c into a static library.
Ryan C. Gordon <icculus@icculus.org>
parents: 406
diff changeset
    59
ADD_EXECUTABLE(testoutput testoutput.c)
25ca83d8bbd5 Build mojoshader.c and mojoshader_opengl.c into a static library.
Ryan C. Gordon <icculus@icculus.org>
parents: 406
diff changeset
    60
TARGET_LINK_LIBRARIES(testoutput mojoshader)
25ca83d8bbd5 Build mojoshader.c and mojoshader_opengl.c into a static library.
Ryan C. Gordon <icculus@icculus.org>
parents: 406
diff changeset
    61
ADD_EXECUTABLE(finderrors finderrors.c)
25ca83d8bbd5 Build mojoshader.c and mojoshader_opengl.c into a static library.
Ryan C. Gordon <icculus@icculus.org>
parents: 406
diff changeset
    62
TARGET_LINK_LIBRARIES(finderrors mojoshader ${SDL_LIBRARY})
1
99ac16070d07 [svn] Initial add.
icculus
parents:
diff changeset
    63
99ac16070d07 [svn] Initial add.
icculus
parents:
diff changeset
    64
# End of CMakeLists.txt ...
99ac16070d07 [svn] Initial add.
icculus
parents:
diff changeset
    65