add_subdirectory(script)
add_subdirectory(settingsgen)
add_subdirectory(strgen)

if(OPTION_TOOLS_ONLY)
    return()
endif()

add_subdirectory(3rdparty)
add_subdirectory(ai)
add_subdirectory(blitter)
add_subdirectory(core)
add_subdirectory(game)
add_subdirectory(lang)
add_subdirectory(linkgraph)
add_subdirectory(misc)
add_subdirectory(music)
add_subdirectory(network)
add_subdirectory(os)
add_subdirectory(pathfinder)
add_subdirectory(saveload)
add_subdirectory(sound)
add_subdirectory(spriteloader)
add_subdirectory(table)
add_subdirectory(video)
add_subdirectory(widgets)

add_files(
    viewport_sprite_sorter_sse4.cpp
    CONDITION SSE_FOUND
)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
    set_compile_flags(
        viewport_sprite_sorter_sse4.cpp
        COMPILE_FLAGS -msse4.1)
endif()

add_files(
    aircraft.h
    aircraft_cmd.cpp
    aircraft_gui.cpp
    airport.cpp
    airport.h
    airport_gui.cpp
    animated_tile.cpp
    animated_tile_func.h
    articulated_vehicles.cpp
    articulated_vehicles.h
    autoreplace.cpp
    autoreplace_base.h
    autoreplace_cmd.cpp
    autoreplace_func.h
    autoreplace_gui.cpp
    autoreplace_gui.h
    autoreplace_type.h
    autoslope.h
    base_consist.cpp
    base_consist.h
    base_media_base.h
    base_media_func.h
    base_station_base.h
    bitmap_type.h
    bmp.cpp
    bmp.h
    bootstrap_gui.cpp
    bridge.h
    bridge_gui.cpp
    bridge_map.cpp
    bridge_map.h
    build_vehicle_gui.cpp
    cargo_type.h
    cargoaction.cpp
    cargoaction.h
    cargomonitor.cpp
    cargomonitor.h
    cargopacket.cpp
    cargopacket.h
    cargotype.cpp
    cargotype.h
    cheat.cpp
    cheat_func.h
    cheat_gui.cpp
    cheat_type.h
    clear_cmd.cpp
    clear_func.h
    clear_map.h
    cmd_helper.h
    command.cpp
    command_func.h
    command_type.h
    company_base.h
    company_cmd.cpp
    company_func.h
    company_gui.cpp
    company_gui.h
    company_manager_face.h
    company_type.h
    console.cpp
    console_cmds.cpp
    console_func.h
    console_gui.cpp
    console_gui.h
    console_internal.h
    console_type.h
    cpu.cpp
    cpu.h
    crashlog.cpp
    crashlog.h
    currency.cpp
    currency.h
    date.cpp
    date_func.h
    date_gui.cpp
    date_gui.h
    date_type.h
    debug.cpp
    debug.h
    dedicated.cpp
    depot.cpp
    depot_base.h
    depot_cmd.cpp
    depot_func.h
    depot_gui.cpp
    depot_map.h
    depot_type.h
    direction_func.h
    direction_type.h
    disaster_vehicle.cpp
    disaster_vehicle.h
    dock_gui.cpp
    driver.cpp
    driver.h
    economy.cpp
    economy_base.h
    economy_func.h
    economy_type.h
    effectvehicle.cpp
    effectvehicle_base.h
    effectvehicle_func.h
    elrail.cpp
    elrail_func.h
    engine.cpp
    engine_base.h
    engine_func.h
    engine_gui.cpp
    engine_gui.h
    engine_type.h
    error.h
    error_gui.cpp
    fileio.cpp
    fileio_func.h
    fileio_type.h
    fios.cpp
    fios.h
    fios_gui.cpp
    fontcache.cpp
    fontcache.h
    fontcache_internal.h
    fontdetection.h
    framerate_gui.cpp
    framerate_type.h
    gamelog.cpp
    gamelog.h
    gamelog_internal.h
    genworld.cpp
    genworld.h
    genworld_gui.cpp
    gfx.cpp
    gfx_func.h
    gfx_layout.cpp
    gfx_layout.h
    gfx_type.h
    gfxinit.cpp
    gfxinit.h
    goal.cpp
    goal_base.h
    goal_gui.cpp
    goal_type.h
    graph_gui.cpp
    graph_gui.h
    ground_vehicle.cpp
    ground_vehicle.hpp
    group.h
    group_cmd.cpp
    group_gui.cpp
    group_gui.h
    group_type.h
    gui.h
    guitimer_func.h
    heightmap.cpp
    heightmap.h
    highscore.cpp
    highscore.h
    highscore_gui.cpp
    hotkeys.cpp
    hotkeys.h
    house.h
    house_type.h
    industry.h
    industry_cmd.cpp
    industry_gui.cpp
    industry_map.h
    industry_type.h
    industrytype.h
    ini.cpp
    ini_load.cpp
    ini_type.h
    intro_gui.cpp
    landscape.cpp
    landscape.h
    landscape_type.h
    language.h
    livery.h
    main_gui.cpp
    map.cpp
    map_func.h
    map_type.h
    misc.cpp
    misc_cmd.cpp
    misc_gui.cpp
    mixer.cpp
    mixer.h
    music.cpp
    music_gui.cpp
    newgrf.cpp
    newgrf.h
    newgrf_airport.cpp
    newgrf_airport.h
    newgrf_airporttiles.cpp
    newgrf_airporttiles.h
    newgrf_animation_base.h
    newgrf_animation_type.h
    newgrf_callbacks.h
    newgrf_canal.cpp
    newgrf_canal.h
    newgrf_cargo.cpp
    newgrf_cargo.h
    newgrf_class.h
    newgrf_class_func.h
    newgrf_commons.cpp
    newgrf_commons.h
    newgrf_config.cpp
    newgrf_config.h
    newgrf_debug.h
    newgrf_debug_gui.cpp
    newgrf_engine.cpp
    newgrf_engine.h
    newgrf_generic.cpp
    newgrf_generic.h
    newgrf_gui.cpp
    newgrf_house.cpp
    newgrf_house.h
    newgrf_industries.cpp
    newgrf_industries.h
    newgrf_industrytiles.cpp
    newgrf_industrytiles.h
    newgrf_object.cpp
    newgrf_object.h
    newgrf_profiling.cpp
    newgrf_profiling.h
    newgrf_properties.h
    newgrf_railtype.cpp
    newgrf_railtype.h
    newgrf_roadtype.cpp
    newgrf_roadtype.h
    newgrf_sound.cpp
    newgrf_sound.h
    newgrf_spritegroup.cpp
    newgrf_spritegroup.h
    newgrf_station.cpp
    newgrf_station.h
    newgrf_storage.cpp
    newgrf_storage.h
    newgrf_text.cpp
    newgrf_text.h
    newgrf_town.cpp
    newgrf_town.h
    newgrf_townname.cpp
    newgrf_townname.h
    news_func.h
    news_gui.cpp
    news_gui.h
    news_type.h
    object.h
    object_base.h
    object_cmd.cpp
    object_gui.cpp
    object_map.h
    object_type.h
    openttd.cpp
    openttd.h
    order_backup.cpp
    order_backup.h
    order_base.h
    order_cmd.cpp
    order_func.h
    order_gui.cpp
    order_type.h
    osk_gui.cpp
    pbs.cpp
    pbs.h
    progress.cpp
    progress.h
    querystring_gui.h
    rail.cpp
    rail.h
    rail_cmd.cpp
    rail_gui.cpp
    rail_gui.h
    rail_map.h
    rail_type.h
    random_access_file.cpp
    random_access_file_type.h
    rev.h
    road.cpp
    road.h
    road_cmd.cpp
    road_cmd.h
    road_func.h
    road_gui.cpp
    road_gui.h
    road_internal.h
    road_map.cpp
    road_map.h
    road_type.h
    roadstop.cpp
    roadstop_base.h
    roadveh.h
    roadveh_cmd.cpp
    roadveh_gui.cpp
    safeguards.h
    screenshot_gui.cpp
    screenshot_gui.h
    screenshot.cpp
    screenshot.h
    settings.cpp
    settings_func.h
    settings_gui.cpp
    settings_gui.h
    settings_internal.h
    settings_table.h
    settings_table.cpp
    settings_type.h
    ship.h
    ship_cmd.cpp
    ship_gui.cpp
    signal.cpp
    signal_func.h
    signal_type.h
    signs.cpp
    signs_base.h
    signs_cmd.cpp
    signs_func.h
    signs_gui.cpp
    signs_type.h
    slope_func.h
    slope_type.h
    smallmap_gui.cpp
    smallmap_gui.h
    sortlist_type.h
    sound.cpp
    sound_func.h
    sound_type.h
    sprite.cpp
    sprite.h
    spritecache.cpp
    spritecache.h
    station.cpp
    station_base.h
    station_cmd.cpp
    station_func.h
    station_gui.cpp
    station_gui.h
    station_kdtree.h
    station_map.h
    station_type.h
    statusbar_gui.cpp
    statusbar_gui.h
    stdafx.h
    story.cpp
    story_base.h
    story_gui.cpp
    story_type.h
    strgen/strgen.h
    string.cpp
    string_base.h
    string_func.h
    string_type.h
    stringfilter.cpp
    stringfilter_type.h
    strings.cpp
    strings_func.h
    strings_type.h
    subsidy.cpp
    subsidy_base.h
    subsidy_func.h
    subsidy_gui.cpp
    subsidy_type.h
    tar_type.h
    terraform_cmd.cpp
    terraform_gui.cpp
    terraform_gui.h
    textbuf.cpp
    textbuf_gui.h
    textbuf_type.h
    texteff.cpp
    texteff.hpp
    textfile_gui.cpp
    textfile_gui.h
    textfile_type.h
    tgp.cpp
    tgp.h
    thread.h
    tile_cmd.h
    tile_map.cpp
    tile_map.h
    tile_type.h
    tilearea.cpp
    tilearea_type.h
    tilehighlight_func.h
    tilehighlight_type.h
    tilematrix_type.hpp
    timetable.h
    timetable_cmd.cpp
    timetable_gui.cpp
    toolbar_gui.cpp
    toolbar_gui.h
    town.h
    town_cmd.cpp
    town_gui.cpp
    town_kdtree.h
    town_map.h
    town_type.h
    townname.cpp
    townname_func.h
    townname_type.h
    track_func.h
    track_type.h
    train.h
    train_cmd.cpp
    train_gui.cpp
    transparency.h
    transparency_gui.cpp
    transparency_gui.h
    transport_type.h
    tree_cmd.cpp
    tree_gui.cpp
    tree_map.h
    tunnel_map.cpp
    tunnel_map.h
    tunnelbridge.h
    tunnelbridge_cmd.cpp
    tunnelbridge_map.h
    vehicle.cpp
    vehicle_base.h
    vehicle_cmd.cpp
    vehicle_func.h
    vehicle_gui.cpp
    vehicle_gui.h
    vehicle_gui_base.h
    vehicle_type.h
    vehiclelist.cpp
    vehiclelist.h
    viewport.cpp
    viewport_func.h
    viewport_gui.cpp
    viewport_kdtree.h
    viewport_sprite_sorter.h
    viewport_type.h
    void_cmd.cpp
    void_map.h
    walltime_func.h
    water.h
    water_cmd.cpp
    water_map.h
    waypoint.cpp
    waypoint_base.h
    waypoint_cmd.cpp
    waypoint_func.h
    waypoint_gui.cpp
    widget.cpp
    widget_type.h
    window.cpp
    window_func.h
    window_gui.h
    window_type.h
    zoom_func.h
    zoom_type.h
)
