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