diff --git a/.travis.yml b/.travis.yml index 94ca713ba..cfc309195 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,12 +12,13 @@ addons: - libsdl2-dev script: - python scripts/check_header_guards.py -- if [ "$TRAVIS_OS_NAME" = "osx" ]; then CMAKE_EXTRA_ARGS="-DDOWNLOAD_GTEST=ON"; fi +- if [ "$TRAVIS_OS_NAME" = "osx" ]; then CMAKE_EXTRA_ARGS="-DDOWNLOAD_GTEST=ON -DDEV=ON"; fi - if [ "$TRAVIS_OS_NAME" != "osx" ]; then CMAKE_EXTRA_ARGS="-DGTEST_LIBRARY=../gtest_build/libgtest.a -DGTEST_MAIN_LIBRARY=../gtest_build/libgtest_main.a"; mkdir gtest_build; cmake -E chdir gtest_build cmake /usr/src/gtest; cmake --build gtest_build; fi - mkdir build; cd build -- cmake -Werror=dev $CMAKE_EXTRA_ARGS .. +- cmake -Werror=dev -DCMAKE_INSTALL_PREFIX=/usr $CMAKE_EXTRA_ARGS .. - make everything - make run_tests +- if [ "$TRAVIS_OS_NAME" != "osx" ]; then make DESTDIR=install install; test -x install/bin/DDNet; test -x install/bin/DDNet-Server; test -d install/bin/data; test -d install/usr/lib; fi - make package_default - cd ..; mkdir build_debug; cd build_debug - cmake -Werror=dev -DCMAKE_BUILD_TYPE=Debug $CMAKE_EXTRA_ARGS .. diff --git a/CMakeLists.txt b/CMakeLists.txt index 16588d700..51463efd5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,10 +77,15 @@ option(MYSQL "Enable mysql support" OFF) option(CLIENT "Compile client" ON) option(DOWNLOAD_GTEST "Download and compile GTest" ${AUTO_DEPENDENCIES_DEFAULT}) option(PREFER_BUNDLED_LIBS "Prefer bundled libraries over system libraries" ${AUTO_DEPENDENCIES_DEFAULT}) +option(DEV "Don't generate stuff necessary for packaging" OFF) # Set the default build type to Release if(NOT(CMAKE_BUILD_TYPE)) - set(CMAKE_BUILD_TYPE Release) + if(DEV) + set(CMAKE_BUILD_TYPE Release) + else() + set(CMAKE_BUILD_TYPE Debug) + endif() endif() set(DBG $,$>) @@ -1067,7 +1072,6 @@ foreach(ABS_T ${TOOLS}) string(REGEX REPLACE "\\.cpp$" "" TOOL "${T}") set(TOOL_DEPS ${DEPS}) set(TOOL_LIBS ${LIBS}) - set(EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL) if(TOOL MATCHES "^(tileset_.*|dilate|map_extract|map_replace_image)$") list(APPEND TOOL_DEPS ${PNGLITE_DEP}) list(APPEND TOOL_LIBS ${PNGLITE_LIBRARIES}) @@ -1076,8 +1080,9 @@ foreach(ABS_T ${TOOLS}) if(TOOL MATCHES "^config_") list(APPEND EXTRA_TOOL_SRC "src/tools/config_common.h") endif() - if(TOOL MATCHES "^(config_retrieve|config_store|dilate|map_diff|map_extract)$") - set(EXCLUDE_FROM_ALL) + set(EXCLUDE_FROM_ALL) + if(DEV) + set(EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL) endif() add_executable(${TOOL} ${EXCLUDE_FROM_ALL} ${TOOL_DEPS} @@ -1299,16 +1304,22 @@ if(TARGET_OS STREQUAL "windows") list(APPEND CPACK_FILES other/config_directory.bat) endif() -install(TARGETS ${CPACK_TARGETS} DESTINATION bin) -install(DIRECTORY data DESTINATION share/ddnet) +if(NOT DEV) + install(DIRECTORY data DESTINATION share/ddnet COMPONENT data) + install(TARGETS ${TARGET_CLIENT} DESTINATION bin COMPONENT client) + install(TARGETS ${TARGET_SERVER} DESTINATION bin COMPONENT server) + install(TARGETS ${TARGETS_TOOLS} DESTINATION lib/ddnet COMPONENT tools) +endif() -if(CMAKE_VERSION VERSION_GREATER 3.6 OR CMAKE_VERSION VERSION_EQUAL 3.6) +if(DEV) + # Don't generate CPack targets. +elseif(CMAKE_VERSION VERSION_LESS 3.6 OR CMAKE_VERSION VERSION_EQUAL 3.6) + message(WARNING "Cannot create CPack targets, CMake version too old. Use CMake 3.6 or newer.") +else() set(EXTRA_ARGS DESTINATION ${CPACK_PACKAGE_FILE_NAME} COMPONENT portable EXCLUDE_FROM_ALL) install(TARGETS ${CPACK_TARGETS} ${EXTRA_ARGS}) install(DIRECTORY ${CPACK_DIRS} ${EXTRA_ARGS}) install(FILES ${CPACK_FILES} ${EXTRA_ARGS}) -else() - message(WARNING "Cannot create CPack targets, CMake version too old. Use CMake 3.6 or newer.") endif() set(PACKAGE_TARGETS)