author | Tero Marttila <terom@fixme.fi> |
Tue, 27 Jan 2009 00:25:58 +0200 | |
changeset 439 | 9823e6cd1086 |
parent 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 |
|
433
4ee797e09383
convert CMakeLists to use CMake's OPTION command (with our own wrapper)
Tero Marttila <terom@fixme.fi>
parents:
422
diff
changeset
|
6 |
# define + adapt option value, these need to be set as C++ booleans |
4ee797e09383
convert CMakeLists to use CMake's OPTION command (with our own wrapper)
Tero Marttila <terom@fixme.fi>
parents:
422
diff
changeset
|
7 |
macro (kg_option option_var option_config description default) |
4ee797e09383
convert CMakeLists to use CMake's OPTION command (with our own wrapper)
Tero Marttila <terom@fixme.fi>
parents:
422
diff
changeset
|
8 |
option (${option_var} ${description} ${default}) |
422 | 9 |
|
433
4ee797e09383
convert CMakeLists to use CMake's OPTION command (with our own wrapper)
Tero Marttila <terom@fixme.fi>
parents:
422
diff
changeset
|
10 |
if (${option_var}) |
4ee797e09383
convert CMakeLists to use CMake's OPTION command (with our own wrapper)
Tero Marttila <terom@fixme.fi>
parents:
422
diff
changeset
|
11 |
set (${option_config} true) |
4ee797e09383
convert CMakeLists to use CMake's OPTION command (with our own wrapper)
Tero Marttila <terom@fixme.fi>
parents:
422
diff
changeset
|
12 |
else (${option_var}) |
4ee797e09383
convert CMakeLists to use CMake's OPTION command (with our own wrapper)
Tero Marttila <terom@fixme.fi>
parents:
422
diff
changeset
|
13 |
set (${option_config} false) |
4ee797e09383
convert CMakeLists to use CMake's OPTION command (with our own wrapper)
Tero Marttila <terom@fixme.fi>
parents:
422
diff
changeset
|
14 |
endif (${option_var}) |
422 | 15 |
|
433
4ee797e09383
convert CMakeLists to use CMake's OPTION command (with our own wrapper)
Tero Marttila <terom@fixme.fi>
parents:
422
diff
changeset
|
16 |
mark_as_advanced(${option_var}) |
4ee797e09383
convert CMakeLists to use CMake's OPTION command (with our own wrapper)
Tero Marttila <terom@fixme.fi>
parents:
422
diff
changeset
|
17 |
endmacro (kg_option) |
422 | 18 |
|
433
4ee797e09383
convert CMakeLists to use CMake's OPTION command (with our own wrapper)
Tero Marttila <terom@fixme.fi>
parents:
422
diff
changeset
|
19 |
# Define options |
4ee797e09383
convert CMakeLists to use CMake's OPTION command (with our own wrapper)
Tero Marttila <terom@fixme.fi>
parents:
422
diff
changeset
|
20 |
KG_OPTION (ENABLE_DEBUG DEBUG_ENABLED "Enable debug behaviour" ON) |
4ee797e09383
convert CMakeLists to use CMake's OPTION command (with our own wrapper)
Tero Marttila <terom@fixme.fi>
parents:
422
diff
changeset
|
21 |
KG_OPTION (ENABLE_GRAPHICS GRAPHICS_ENABLED "Enable graphics support" ON) |
4ee797e09383
convert CMakeLists to use CMake's OPTION command (with our own wrapper)
Tero Marttila <terom@fixme.fi>
parents:
422
diff
changeset
|
22 |
KG_OPTION (ENABLE_NETWORK NETWORK_ENABLED "Enable network support" ON) |
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
|
23 |
|
0 | 24 |
# Generate config.h |
25 |
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/config.h" @ONLY) |
|
26 |
include_directories("${CMAKE_CURRENT_BINARY_DIR}") |
|
27 |
||
412
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
28 |
# main module |
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
29 |
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
|
30 |
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
|
31 |
|
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
32 |
# 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
|
33 |
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
|
34 |
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
|
35 |
|
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
|
36 |
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
|
37 |
|
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
|
38 |
# 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
|
39 |
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
|
40 |
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
|
41 |
|
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 |
endif (NETWORK_ENABLED) |
412
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
43 |
|
0 | 44 |
# Libraries |
412
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
45 |
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
|
46 |
set (CLANLIB_COMPONENTS ${CORE_CLANLIB_COMPONENTS} ${GRAPHICS_CLANLIB_COMPONENTS} ${NETWORK_CLANLIB_COMPONENTS}) |
0 | 47 |
|
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
119
diff
changeset
|
48 |
# ClanLib 0.8 |
412
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
49 |
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
|
50 |
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
|
51 |
|
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
119
diff
changeset
|
52 |
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
|
53 |
|
721c60072091
new graphics code compiles... no, it doesn't work yet
Tero Marttila <terom@fixme.fi>
parents:
411
diff
changeset
|
54 |
# 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
|
55 |
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
|
56 |
set(SOURCES ${CORE_SOURCES} ${GRAPHICS_SOURCES} ${NETWORK_SOURCES}) |
0 | 57 |
|
58 |
# Assumes the project generates only one executable. If you need more, you'll need to alter |
|
59 |
# the script and replace ${PROJECT_SHORT_NAME} by executable name. |
|
60 |
add_executable("${PROJECT_SHORT_NAME}" ${SOURCES}) |
|
61 |
target_link_libraries("${PROJECT_SHORT_NAME}" ${LIBS}) |
|
62 |
install(TARGETS "${PROJECT_SHORT_NAME}" DESTINATION bin) |
|
63 |
||
6 | 64 |