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