author | Ryan C. Gordon <icculus@icculus.org> |
Thu, 12 Feb 2009 01:23:39 -0500 | |
changeset 569 | 117d6e606c4e |
parent 563 | d22551643fcb |
child 588 | ef3d2efa822d |
permissions | -rw-r--r-- |
35 | 1 |
CMAKE_MINIMUM_REQUIRED(VERSION 2.4) |
2 |
PROJECT(MojoShader) |
|
48 | 3 |
|
569
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
4 |
FIND_PROGRAM(HG hg DOC "Path to hg command line app: http://www.selenic.com/mercurial/") |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
5 |
IF(NOT HG) |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
6 |
MESSAGE(STATUS "Mercurial (hg) not found. You can go on, but version info will be wrong.") |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
7 |
SET(MOJOSHADER_VERSION -1) |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
8 |
SET(MOJOSHADER_CHANGESET "???") |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
9 |
ELSE(NOT HG) |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
10 |
MARK_AS_ADVANCED(HG) |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
11 |
EXECUTE_PROCESS( |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
12 |
COMMAND hg tip --template {rev} |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
13 |
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
14 |
RESULT_VARIABLE HGVERSION_RC |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
15 |
OUTPUT_VARIABLE MOJOSHADER_VERSION |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
16 |
ERROR_QUIET |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
17 |
OUTPUT_STRIP_TRAILING_WHITESPACE |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
18 |
) |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
19 |
EXECUTE_PROCESS( |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
20 |
COMMAND hg tip --template hg-{rev}:{node|short} |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
21 |
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
22 |
RESULT_VARIABLE HGVERSION_RC |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
23 |
OUTPUT_VARIABLE MOJOSHADER_CHANGESET |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
24 |
ERROR_QUIET |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
25 |
OUTPUT_STRIP_TRAILING_WHITESPACE |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
26 |
) |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
27 |
ENDIF(NOT HG) |
455
d99f47386d51
Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
423
diff
changeset
|
28 |
|
d99f47386d51
Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
423
diff
changeset
|
29 |
WRITE_FILE( |
d99f47386d51
Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
423
diff
changeset
|
30 |
"${CMAKE_CURRENT_SOURCE_DIR}/mojoshader_version.h" |
d99f47386d51
Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
423
diff
changeset
|
31 |
"/* This file was autogenerated. Do not edit! */\n" |
d99f47386d51
Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
423
diff
changeset
|
32 |
"#ifndef _INCL_MOJOSHADER_VERSION_H_\n" |
d99f47386d51
Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
423
diff
changeset
|
33 |
"#define _INCL_MOJOSHADER_VERSION_H_\n" |
d99f47386d51
Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
423
diff
changeset
|
34 |
"#define MOJOSHADER_VERSION ${MOJOSHADER_VERSION}\n" |
d99f47386d51
Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
423
diff
changeset
|
35 |
"#define MOJOSHADER_CHANGESET \"${MOJOSHADER_CHANGESET}\"\n" |
d99f47386d51
Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
423
diff
changeset
|
36 |
"#endif\n" |
d99f47386d51
Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
423
diff
changeset
|
37 |
) |
d99f47386d51
Generate MOJOSHADER_VERSION, etc.
Ryan C. Gordon <icculus@icculus.org>
parents:
423
diff
changeset
|
38 |
|
48 | 39 |
IF(CMAKE_COMPILER_IS_GNUCC) |
40 |
ADD_DEFINITIONS(-Wall -ggdb3) |
|
41 |
ENDIF(CMAKE_COMPILER_IS_GNUCC) |
|
42 |
||
52 | 43 |
# testparse uses this when I'm looking at memory usage patterns. |
44 |
#ADD_DEFINITIONS(-DMOJOSHADER_DEBUG_MALLOC=1) |
|
48 | 45 |
|
254 | 46 |
IF(MSVC) |
47 |
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS=1) |
|
48 |
ADD_DEFINITIONS(-TP) # force .c files to compile as C++. |
|
49 |
ENDIF(MSVC) |
|
50 |
||
465
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
455
diff
changeset
|
51 |
ADD_LIBRARY(mojoshader STATIC |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
455
diff
changeset
|
52 |
mojoshader.c |
555
940821555fda
Initial work on preprocessor. Not yet complete!
Ryan C. Gordon <icculus@icculus.org>
parents:
473
diff
changeset
|
53 |
mojoshader_preprocessor.c |
940821555fda
Initial work on preprocessor. Not yet complete!
Ryan C. Gordon <icculus@icculus.org>
parents:
473
diff
changeset
|
54 |
mojoshader_lexer.c |
465
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
455
diff
changeset
|
55 |
mojoshader_assembler.c |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
455
diff
changeset
|
56 |
mojoshader_opengl.c |
0a75f98f785b
Initial work on assembler. Not even close to done.
Ryan C. Gordon <icculus@icculus.org>
parents:
455
diff
changeset
|
57 |
) |
415
25ca83d8bbd5
Build mojoshader.c and mojoshader_opengl.c into a static library.
Ryan C. Gordon <icculus@icculus.org>
parents:
406
diff
changeset
|
58 |
|
569
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
59 |
FIND_PROGRAM(RE2C re2c DOC "Path to re2c command line app: http://re2c.org/") |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
60 |
IF(NOT RE2C) |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
61 |
MESSAGE(STATUS "re2c missing. You can go on, but can't rebuild the lexer.") |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
62 |
ELSE(NOT RE2C) |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
63 |
MARK_AS_ADVANCED(RE2C) |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
64 |
ADD_CUSTOM_COMMAND( |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
65 |
OUTPUT mojoshader_lexer.c |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
66 |
DEPENDS mojoshader_lexer.re |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
67 |
COMMAND ${RE2C} |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
68 |
ARGS -s -o ${CMAKE_CURRENT_SOURCE_DIR}/mojoshader_lexer.c ${CMAKE_CURRENT_SOURCE_DIR}/mojoshader_lexer.re |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
69 |
) |
117d6e606c4e
Cleaned up CMakeLists.txt to work in the absence of external tools.
Ryan C. Gordon <icculus@icculus.org>
parents:
563
diff
changeset
|
70 |
ENDIF(NOT RE2C) |
563
d22551643fcb
Added re2c step to build.
Ryan C. Gordon <icculus@icculus.org>
parents:
555
diff
changeset
|
71 |
|
333
2b36a1d72fa1
Wrote most of the arb1 OpenGL glue code.
Ryan C. Gordon <icculus@icculus.org>
parents:
328
diff
changeset
|
72 |
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
|
73 |
IF(SDL_FOUND) |
7e9d90724cf8
Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents:
153
diff
changeset
|
74 |
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
|
75 |
ADD_DEFINITIONS(-DFINDERRORS_COMPILE_SHADERS=1) |
269 | 76 |
ADD_EXECUTABLE(glcaps glcaps.c) |
77 |
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
|
78 |
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
|
79 |
TARGET_LINK_LIBRARIES(bestprofile mojoshader ${SDL_LIBRARY}) |
423
ee393c1cf3b4
Added availableprofiles.c ...
Ryan C. Gordon <icculus@icculus.org>
parents:
415
diff
changeset
|
80 |
ADD_EXECUTABLE(availableprofiles availableprofiles.c) |
ee393c1cf3b4
Added availableprofiles.c ...
Ryan C. Gordon <icculus@icculus.org>
parents:
415
diff
changeset
|
81 |
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
|
82 |
ENDIF(SDL_FOUND) |
7e9d90724cf8
Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents:
153
diff
changeset
|
83 |
|
415
25ca83d8bbd5
Build mojoshader.c and mojoshader_opengl.c into a static library.
Ryan C. Gordon <icculus@icculus.org>
parents:
406
diff
changeset
|
84 |
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
|
85 |
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
|
86 |
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
|
87 |
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
|
88 |
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
|
89 |
TARGET_LINK_LIBRARIES(finderrors mojoshader ${SDL_LIBRARY}) |
473
78c418bde2d2
Added assemble.c test program.
Ryan C. Gordon <icculus@icculus.org>
parents:
465
diff
changeset
|
90 |
ADD_EXECUTABLE(assemble assemble.c) |
78c418bde2d2
Added assemble.c test program.
Ryan C. Gordon <icculus@icculus.org>
parents:
465
diff
changeset
|
91 |
TARGET_LINK_LIBRARIES(assemble mojoshader) |
555
940821555fda
Initial work on preprocessor. Not yet complete!
Ryan C. Gordon <icculus@icculus.org>
parents:
473
diff
changeset
|
92 |
ADD_EXECUTABLE(preprocess preprocess.c) |
940821555fda
Initial work on preprocessor. Not yet complete!
Ryan C. Gordon <icculus@icculus.org>
parents:
473
diff
changeset
|
93 |
TARGET_LINK_LIBRARIES(preprocess mojoshader) |
1 | 94 |
|
95 |
# End of CMakeLists.txt ... |
|
96 |