project_files/hwc/CMakeLists.txt
author koda
Sun, 11 Nov 2012 16:53:16 +0100
branchwebgl
changeset 8023 7de85783b823
parent 8008 2ed42786aca7
child 8029 7ba43d7e54e7
permissions -rw-r--r--
better clang search
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
da4c6db6ea6b correct includes and clang detection
koda
parents: 7999
diff changeset
    23
find_package(GLEW REQUIRED)
da4c6db6ea6b correct includes and clang detection
koda
parents: 7999
diff changeset
    24
da4c6db6ea6b correct includes and clang detection
koda
parents: 7999
diff changeset
    25
8006
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    26
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
    27
bb503cd46516 add a few cmakefiles for c engine and rtl
koda
parents:
diff changeset
    28
bb503cd46516 add a few cmakefiles for c engine and rtl
koda
parents:
diff changeset
    29
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/hwengine.c"
bb503cd46516 add a few cmakefiles for c engine and rtl
koda
parents:
diff changeset
    30
        COMMAND "${EXECUTABLE_OUTPUT_PATH}/pas2c${CMAKE_EXECUTABLE_SUFFIX}"
8006
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    31
        ARGS -n hwengine
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    32
             -i "${hedgewars_SOURCE_DIR}/hedgewars"
8008
2ed42786aca7 search for more clang names
koda
parents: 8006
diff changeset
    33
             #-i "~/xymengxy-webport/hedgewars"
8006
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    34
             -o "${CMAKE_CURRENT_BINARY_DIR}"
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    35
             -a "${CMAKE_CURRENT_BINARY_DIR}"
7999
bb503cd46516 add a few cmakefiles for c engine and rtl
koda
parents:
diff changeset
    36
        DEPENDS pas2c
8006
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    37
    )
7999
bb503cd46516 add a few cmakefiles for c engine and rtl
koda
parents:
diff changeset
    38
bb503cd46516 add a few cmakefiles for c engine and rtl
koda
parents:
diff changeset
    39
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
    40
8006
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    41
7999
bb503cd46516 add a few cmakefiles for c engine and rtl
koda
parents:
diff changeset
    42
add_subdirectory(rtl)
bb503cd46516 add a few cmakefiles for c engine and rtl
koda
parents:
diff changeset
    43
8004
da4c6db6ea6b correct includes and clang detection
koda
parents: 7999
diff changeset
    44
include_directories("${GLEW_INCLUDE_PATH}")
da4c6db6ea6b correct includes and clang detection
koda
parents: 7999
diff changeset
    45
include_directories(rtl)
7999
bb503cd46516 add a few cmakefiles for c engine and rtl
koda
parents:
diff changeset
    46
8006
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    47
set(engine_src               uDebug.c             uLandTexture.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    48
        LuaPas.c             uFloat.c             uLocale.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    49
        SDLh.c               uGame.c              uMisc.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    50
        adler32.c            uGears.c             uMobile.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    51
        hwengine.c           uGearsHandlers.c     uRandom.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    52
        uAI.c                uGearsHandlersRope.c uRender.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    53
        uAIActions.c         uGearsHedgehog.c     uRenderUtils.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    54
        uAIAmmoTests.c       uGearsList.c         uScript.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    55
        uAILandMarks.c       uGearsRender.c       uSinTable.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    56
        uAIMisc.c            uGearsUtils.c        uSound.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    57
        uAmmos.c             uIO.c                uStats.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    58
        uCaptions.c          uInputHandler.c      uStore.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    59
        uChat.c              uLand.c              uTeams.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    60
        uCollisions.c        uLandGenMaze.c       uTextures.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    61
        uCommandHandlers.c   uLandGraphics.c      uTypes.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    62
        uCommands.c          uLandObjects.c       uUtils.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    63
        uConsole.c           uLandOutline.c       uVariables.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    64
        uConsts.c            uLandPainted.c       uVisualGears.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    65
        uCursor.c            uLandTemplates.c     uWorld.c
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    66
    )
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    67
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    68
set(engine_hdr               uGame.h              uFloat.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    69
        uLocale.h            SDLh.h               uMisc.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    70
        adler32.h            uDebug.h             uLandTexture.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    71
        LuaPas.h             uGears.h             uMobile.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    72
        uAI.h                uGearsHandlersRope.h uRender.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    73
        uAIActions.h         uGearsHedgehog.h     uRenderUtils.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    74
        uAIAmmoTests.h       uGearsList.h         uScript.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    75
        uGearsHandlers.h     uRandom.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    76
        uAILandMarks.h       uGearsRender.h       uSinTable.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    77
        uAIMisc.h            uGearsUtils.h        uSound.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    78
        uAmmos.h             uIO.h                uStats.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    79
        uCaptions.h          uInputHandler.h      uStore.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    80
        uChat.h              uLand.h              uTeams.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    81
        uCollisions.h        uLandGenMaze.h       uTextures.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    82
        uCommandHandlers.h   uLandGraphics.h      uTypes.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    83
        uCommands.h          uLandObjects.h       uUtils.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    84
        uConsole.h           uLandOutline.h       uVariables.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    85
        uConsts.h            uLandPainted.h       uVisualGears.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    86
        uCursor.h            uLandTemplates.h     uWorld.h
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    87
    )
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    88
7999
bb503cd46516 add a few cmakefiles for c engine and rtl
koda
parents:
diff changeset
    89
add_executable(hwengine WIN32 ${engine_src})
bb503cd46516 add a few cmakefiles for c engine and rtl
koda
parents:
diff changeset
    90
add_dependencies(hwengine engine_c fpcrtl)
8006
7ca007615b88 no globs, sources not yet generated
koda
parents: 8004
diff changeset
    91