Skip to content
Snippets Groups Projects
CMakeLists.txt 1.72 KiB
Newer Older
  • Learn to ignore specific revisions
  • cmake_minimum_required (VERSION 3.6)
    
    David Bergström's avatar
    David Bergström committed
    project (starcraft-python-api)
    
    
    # Build with C++14 support, required by sc2api
    
    set(CMAKE_CXX_STANDARD 14)
    
    
    # Allow creating filters for projects in visual studio
    set_property(GLOBAL PROPERTY USE_FOLDERS ON)
    
    # Disable building for examples in the sc2api submodule
    set(BUILD_API_EXAMPLES OFF CACHE INTERNAL "" FORCE)
    
    # Disable building for tests in the sc2api submodule
    set(BUILD_API_TESTS OFF CACHE INTERNAL "" FORCE)
    
    
    David Bergström's avatar
    David Bergström committed
    add_subdirectory(lib/pybind11)
    
    add_subdirectory(lib/s2client-api)
    
    add_subdirectory(src)
    
    # Hack to make compile, these flags are otherwise set to give errors on warnings
    set_target_properties(sc2api PROPERTIES COMPILE_FLAGS "/W4")
    set_target_properties(sc2lib PROPERTIES COMPILE_FLAGS "/W4")
    set_target_properties(sc2renderer PROPERTIES COMPILE_FLAGS "/W4")
    set_target_properties(sc2utils PROPERTIES COMPILE_FLAGS "/W3")
    set_target_properties(sc2protocol PROPERTIES COMPILE_FLAGS "/W0")
    
    set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT CommandCenter)
    
    
    # TODO: Move everything below this line to a separate directory
    
    include_directories(SYSTEM
        ${PROJECT_SOURCE_DIR}/lib/s2client-api/include
        ${PROJECT_SOURCE_DIR}/lib/s2client-api/contrib/protobuf/src
        ${PROJECT_BINARY_DIR}/lib/s2client-api/generated
    )
    
    # All the source files for the bot.
    file(GLOB BOT_SOURCES "src/*.cpp" "src/*.h" "src/*.hpp")
    
    link_directories(${PROJECT_BINARY_DIR}/s2client-api/bin)
    
    # Enable compilation of the SC2 version of the bot code
    # TODO: Remove all remaining BW code
    add_definitions(-DSC2API)
    
    # Create the executable.
    
    pybind11_add_module(library library.cpp library.h ${BOT_SOURCES})
    
    target_link_libraries(library PRIVATE
        sc2api sc2lib sc2utils sc2protocol libprotobuf
    )