author | Tero Marttila <terom@fixme.fi> |
Mon, 26 Jan 2009 23:03:47 +0200 | |
changeset 431 | c6d7272a164b |
parent 422 | 5e4c8631779e |
child 433 | 4ee797e09383 |
permissions | -rw-r--r-- |
417
c503e0c6a740
support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
1 |
FILE(GLOB SOURCE_FILES "*.cc") |
c503e0c6a740
support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
2 |
FILE(GLOB HEADER_FILES "*.hh") |
0 | 3 |
|
397
13fa0546ef87
hopefully version stuff is now run properly on every make...
Tero Marttila <terom@fixme.fi>
parents:
186
diff
changeset
|
4 |
set_source_files_properties("version.c" PROPERTIES GENERATED true) |
0 | 5 |
|
417
c503e0c6a740
support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
6 |
# Component selection |
422 | 7 |
if (DEFINED GRAPHICS_ENABLED) |
8 |
# leave it |
|
9 |
||
10 |
elseif (DEFINED ENABLE_GRAPHICS) |
|
11 |
set (GRAPHICS_ENABLED ${ENABLE_GRAPHICS}) |
|
12 |
||
13 |
else (DEFINED GRAPHICS_ENABLED) |
|
14 |
set (GRAPHICS_ENABLED true) |
|
15 |
||
16 |
endif (DEFINED GRAPHICS_ENABLED) |
|
17 |
||
18 |
if (DEFINED NETWORK_ENABLED) |
|
19 |
# leave it |
|
20 |
||
21 |
elseif (DEFINED ENABLE_NETWORK) |
|
22 |
set (NETWORK_ENABLED ${ENABLE_NETWORK}) |
|
23 |
||
24 |
else (DEFINED NETWORK_ENABLED) |
|
25 |
set (NETWORK_ENABLED true) |
|
26 |
||
27 |
endif (DEFINED NETWORK_ENABLED) |
|
417
c503e0c6a740
support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
28 |
|
c503e0c6a740
support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
29 |
mark_as_advanced (CLEAR GRAPHICS_ENABLED NETWORK_ENABLED) |
c503e0c6a740
support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
30 |
|
0 | 31 |
# Generate config.h |
32 |
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/config.h" @ONLY) |
|
33 |
include_directories("${CMAKE_CURRENT_BINARY_DIR}") |
|
34 |
||
412
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
35 |
# main module |
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
36 |
set (CORE_CLANLIB_COMPONENTS Core App Signals) |
417
c503e0c6a740
support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
37 |
set (CORE_SOURCES ${SOURCE_FILES} ${HEADER_FILES} "version.c") |
412
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
38 |
|
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
39 |
# Graphics module |
417
c503e0c6a740
support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
40 |
if (GRAPHICS_ENABLED) |
c503e0c6a740
support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
41 |
add_subdirectory (Graphics) |
c503e0c6a740
support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
42 |
|
c503e0c6a740
support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
43 |
endif (GRAPHICS_ENABLED) |
c503e0c6a740
support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
44 |
|
c503e0c6a740
support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
45 |
# Network module |
c503e0c6a740
support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
46 |
if (NETWORK_ENABLED) |
c503e0c6a740
support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
47 |
add_subdirectory (Network) |
c503e0c6a740
support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
48 |
|
c503e0c6a740
support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
49 |
endif (NETWORK_ENABLED) |
412
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
50 |
|
0 | 51 |
# Libraries |
412
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
52 |
set (CLANLIB_VERSION 0.8) |
417
c503e0c6a740
support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
53 |
set (CLANLIB_COMPONENTS ${CORE_CLANLIB_COMPONENTS} ${GRAPHICS_CLANLIB_COMPONENTS} ${NETWORK_CLANLIB_COMPONENTS}) |
0 | 54 |
|
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
119
diff
changeset
|
55 |
# ClanLib 0.8 |
412
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
56 |
message (STATUS "Finding ClanLib version=${CLANLIB_VERSION}, components=${CLANLIB_COMPONENTS}" ) |
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
57 |
find_package(ClanLib ${CLANLIB_VERSION} REQUIRED COMPONENTS ${CLANLIB_COMPONENTS}) |
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
58 |
|
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
119
diff
changeset
|
59 |
include_directories(${ClanLib_INCLUDE_DIRS}) |
412
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
60 |
|
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
61 |
# build list of libs/source files |
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
119
diff
changeset
|
62 |
set(LIBS ${LIBS} ${ClanLib_LIBRARIES}) |
417
c503e0c6a740
support for building without Network/Graphics, although the disable-graphics case is kind of hackish still
Tero Marttila <terom@fixme.fi>
parents:
412
diff
changeset
|
63 |
set(SOURCES ${CORE_SOURCES} ${GRAPHICS_SOURCES} ${NETWORK_SOURCES}) |
0 | 64 |
|
65 |
# Assumes the project generates only one executable. If you need more, you'll need to alter |
|
66 |
# the script and replace ${PROJECT_SHORT_NAME} by executable name. |
|
67 |
add_executable("${PROJECT_SHORT_NAME}" ${SOURCES}) |
|
68 |
target_link_libraries("${PROJECT_SHORT_NAME}" ${LIBS}) |
|
69 |
install(TARGETS "${PROJECT_SHORT_NAME}" DESTINATION bin) |
|
70 |
||
6 | 71 |