project_files/hwc/CMakeLists.txt
author koda
Sun, 11 Nov 2012 17:52:49 +0100
branchwebgl
changeset 8029 7ba43d7e54e7
parent 8023 7de85783b823
child 8035 68ec3138c16d
permissions -rw-r--r--
cmake linking for engine in c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8004
da4c6db6ea6b correct includes and clang detection
koda
parents: 7999
diff changeset
     1
da4c6db6ea6b correct includes and clang detection
koda
parents: 7999
diff changeset
     2
if(CLANG)
da4c6db6ea6b correct includes and clang detection
koda
parents: 7999
diff changeset
     3
    set(clang_executable ${CLANG})
da4c6db6ea6b correct includes and clang detection
koda
parents: 7999
diff changeset
     4
else()
8023
7de85783b823 better clang search
koda
parents: 8008
diff changeset
     5
    find_program(clang_executable
7de85783b823 better clang search
koda
parents: 8008
diff changeset
     6
        NAMES clang-mp-3.2 clang-mp-3.1 clang-mp-3.0 clang
7de85783b823 better clang search
koda
parents: 8008
diff changeset
     7
        PATHS /opt/local/bin /usr/local/bin /usr/bin)
8004
da4c6db6ea6b correct includes and clang detection
koda
parents: 7999
diff changeset
     8
endif()
da4c6db6ea6b correct includes and clang detection
koda
parents: 7999
diff changeset
     9
da4c6db6ea6b correct includes and clang detection
koda
parents: 7999
diff changeset
    10
if (clang_executable)
da4c6db6ea6b correct includes and clang detection
koda
parents: 7999
diff changeset
    11
    exec_program(${clang_executable} ARGS "-v" OUTPUT_VARIABLE clang_version_full)
da4c6db6ea6b correct includes and clang detection
koda
parents: 7999
diff changeset
    12
    string(REGEX MATCH "[0-9]+\\.[0-9]+" clang_version_long "${clang_version_full}")
da4c6db6ea6b correct includes and clang detection
koda
parents: 7999
diff changeset
    13
    string(REGEX REPLACE "([0-9]+\\.[0-9]+)" "\\1" clang_version "${clang_version_long}")
8008
2ed42786aca7 search for more clang names
koda
parents: 8006
diff changeset
    14
    #TODO: check version >= 3.0
8004
da4c6db6ea6b correct includes and clang detection
koda
parents: 7999
diff changeset
    15
    message(STATUS "Found CLANG: ${clang_executable} (version ${clang_version})")
da4c6db6ea6b correct includes and clang detection
koda
parents: 7999
diff changeset
    16
else()
da4c6db6ea6b correct includes and clang detection
koda
parents: 7999
diff changeset
    17
    message(FATAL_ERROR "No LLVM/Clang compiler found (required for engine_c target)")
da4c6db6ea6b correct includes and clang detection
koda
parents: 7999
diff changeset
    18
endif()
da4c6db6ea6b correct includes and clang detection
koda
parents: 7999
diff changeset
    19
8006
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    20
set(CMAKE_C_COMPILER ${clang_executable})
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    21
8004
da4c6db6ea6b correct includes and clang detection
koda
parents: 7999
diff changeset
    22
8029
7ba43d7e54e7 cmake linking for engine in c
koda
parents: 8023
diff changeset
    23
find_package(OPENGL REQUIRED)
8004
da4c6db6ea6b correct includes and clang detection
koda
parents: 7999
diff changeset
    24
find_package(GLEW REQUIRED)
8029
7ba43d7e54e7 cmake linking for engine in c
koda
parents: 8023
diff changeset
    25
find_package(SDL REQUIRED)
7ba43d7e54e7 cmake linking for engine in c
koda
parents: 8023
diff changeset
    26
find_package(SDL_mixer REQUIRED)
7ba43d7e54e7 cmake linking for engine in c
koda
parents: 8023
diff changeset
    27
find_package(SDL_net REQUIRED)
7ba43d7e54e7 cmake linking for engine in c
koda
parents: 8023
diff changeset
    28
find_package(SDL_image REQUIRED)
7ba43d7e54e7 cmake linking for engine in c
koda
parents: 8023
diff changeset
    29
find_package(SDL_ttf REQUIRED)
8004
da4c6db6ea6b correct includes and clang detection
koda
parents: 7999
diff changeset
    30
8006
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    31
configure_file(${hedgewars_SOURCE_DIR}/hedgewars/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc)
7999
bb503cd46516 add a few cmakefiles for c engine and rtl
koda
parents:
diff changeset
    32
bb503cd46516 add a few cmakefiles for c engine and rtl
koda
parents:
diff changeset
    33
bb503cd46516 add a few cmakefiles for c engine and rtl
koda
parents:
diff changeset
    34
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/hwengine.c"
bb503cd46516 add a few cmakefiles for c engine and rtl
koda
parents:
diff changeset
    35
        COMMAND "${EXECUTABLE_OUTPUT_PATH}/pas2c${CMAKE_EXECUTABLE_SUFFIX}"
8006
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    36
        ARGS -n hwengine
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    37
             -i "${hedgewars_SOURCE_DIR}/hedgewars"
8008
2ed42786aca7 search for more clang names
koda
parents: 8006
diff changeset
    38
             #-i "~/xymengxy-webport/hedgewars"
8006
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    39
             -o "${CMAKE_CURRENT_BINARY_DIR}"
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    40
             -a "${CMAKE_CURRENT_BINARY_DIR}"
7999
bb503cd46516 add a few cmakefiles for c engine and rtl
koda
parents:
diff changeset
    41
        DEPENDS pas2c
8006
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    42
    )
7999
bb503cd46516 add a few cmakefiles for c engine and rtl
koda
parents:
diff changeset
    43
bb503cd46516 add a few cmakefiles for c engine and rtl
koda
parents:
diff changeset
    44
add_custom_target(engine_c ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/hwengine.c")
bb503cd46516 add a few cmakefiles for c engine and rtl
koda
parents:
diff changeset
    45
8006
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    46
7999
bb503cd46516 add a few cmakefiles for c engine and rtl
koda
parents:
diff changeset
    47
add_subdirectory(rtl)
bb503cd46516 add a few cmakefiles for c engine and rtl
koda
parents:
diff changeset
    48
8004
da4c6db6ea6b correct includes and clang detection
koda
parents: 7999
diff changeset
    49
include_directories("${GLEW_INCLUDE_PATH}")
da4c6db6ea6b correct includes and clang detection
koda
parents: 7999
diff changeset
    50
include_directories(rtl)
7999
bb503cd46516 add a few cmakefiles for c engine and rtl
koda
parents:
diff changeset
    51
8006
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    52
set(engine_src               uDebug.c             uLandTexture.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    53
        LuaPas.c             uFloat.c             uLocale.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    54
        SDLh.c               uGame.c              uMisc.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    55
        adler32.c            uGears.c             uMobile.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    56
        hwengine.c           uGearsHandlers.c     uRandom.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    57
        uAI.c                uGearsHandlersRope.c uRender.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    58
        uAIActions.c         uGearsHedgehog.c     uRenderUtils.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    59
        uAIAmmoTests.c       uGearsList.c         uScript.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    60
        uAILandMarks.c       uGearsRender.c       uSinTable.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    61
        uAIMisc.c            uGearsUtils.c        uSound.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    62
        uAmmos.c             uIO.c                uStats.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    63
        uCaptions.c          uInputHandler.c      uStore.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    64
        uChat.c              uLand.c              uTeams.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    65
        uCollisions.c        uLandGenMaze.c       uTextures.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    66
        uCommandHandlers.c   uLandGraphics.c      uTypes.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    67
        uCommands.c          uLandObjects.c       uUtils.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    68
        uConsole.c           uLandOutline.c       uVariables.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    69
        uConsts.c            uLandPainted.c       uVisualGears.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    70
        uCursor.c            uLandTemplates.c     uWorld.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    71
    )
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    72
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    73
set(engine_hdr               uGame.h              uFloat.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    74
        uLocale.h            SDLh.h               uMisc.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    75
        adler32.h            uDebug.h             uLandTexture.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    76
        LuaPas.h             uGears.h             uMobile.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    77
        uAI.h                uGearsHandlersRope.h uRender.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    78
        uAIActions.h         uGearsHedgehog.h     uRenderUtils.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    79
        uAIAmmoTests.h       uGearsList.h         uScript.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    80
        uGearsHandlers.h     uRandom.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    81
        uAILandMarks.h       uGearsRender.h       uSinTable.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    82
        uAIMisc.h            uGearsUtils.h        uSound.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    83
        uAmmos.h             uIO.h                uStats.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    84
        uCaptions.h          uInputHandler.h      uStore.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    85
        uChat.h              uLand.h              uTeams.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    86
        uCollisions.h        uLandGenMaze.h       uTextures.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    87
        uCommandHandlers.h   uLandGraphics.h      uTypes.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    88
        uCommands.h          uLandObjects.h       uUtils.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    89
        uConsole.h           uLandOutline.h       uVariables.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    90
        uConsts.h            uLandPainted.h       uVisualGears.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    91
        uCursor.h            uLandTemplates.h     uWorld.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    92
    )
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    93
7999
bb503cd46516 add a few cmakefiles for c engine and rtl
koda
parents:
diff changeset
    94
add_executable(hwengine WIN32 ${engine_src})
8029
7ba43d7e54e7 cmake linking for engine in c
koda
parents: 8023
diff changeset
    95
7ba43d7e54e7 cmake linking for engine in c
koda
parents: 8023
diff changeset
    96
target_link_libraries(hwengine  fpcrtl
7ba43d7e54e7 cmake linking for engine in c
koda
parents: 8023
diff changeset
    97
                                ${LUA_LIBRARY}
7ba43d7e54e7 cmake linking for engine in c
koda
parents: 8023
diff changeset
    98
                                ${OPENGL_LIBRARY}
7ba43d7e54e7 cmake linking for engine in c
koda
parents: 8023
diff changeset
    99
                                ${SDL_LIBRARY}
7ba43d7e54e7 cmake linking for engine in c
koda
parents: 8023
diff changeset
   100
                                ${SDLMIXER_LIBRARY}
7ba43d7e54e7 cmake linking for engine in c
koda
parents: 8023
diff changeset
   101
                                ${SDLNET_LIBRARY}
7ba43d7e54e7 cmake linking for engine in c
koda
parents: 8023
diff changeset
   102
                                ${SDLIMAGE_LIBRARY}
7ba43d7e54e7 cmake linking for engine in c
koda
parents: 8023
diff changeset
   103
                                ${SDLTTF_LIBRARY}
7ba43d7e54e7 cmake linking for engine in c
koda
parents: 8023
diff changeset
   104
                            )
7ba43d7e54e7 cmake linking for engine in c
koda
parents: 8023
diff changeset
   105
7999
bb503cd46516 add a few cmakefiles for c engine and rtl
koda
parents:
diff changeset
   106
add_dependencies(hwengine engine_c fpcrtl)
8006
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
   107