diff --git a/CMakeLists.txt b/CMakeLists.txt index 90ca1c980e..06329c0699 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,8 @@ option(DISABLE_NETWORK "Disable multiplayer functionality. Mainly for testing.") option(DISABLE_TTF "Disable support for TTF provided by freetype2.") option(ENABLE_LIGHTFX "Enable lighting effects." ON) +option(DISABLE_GUI "Don't build GUI. (Headless only.)") + if (FORCE32) set(TARGET_M "-m32") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TARGET_M}") @@ -204,12 +206,14 @@ endif() # Include sub-projects include("${ROOT_DIR}/src/openrct2/CMakeLists.txt" NO_POLICY_SCOPE) include("${ROOT_DIR}/src/openrct2-cli/CMakeLists.txt" NO_POLICY_SCOPE) -include("${ROOT_DIR}/src/openrct2-ui/CMakeLists.txt" NO_POLICY_SCOPE) +if(NOT DISABLE_GUI) + include("${ROOT_DIR}/src/openrct2-ui/CMakeLists.txt" NO_POLICY_SCOPE) +endif() # g2 add_custom_command( OUTPUT g2.dat - COMMAND ./openrct2 sprite build \"${CMAKE_BINARY_DIR}/g2.dat\" \"${ROOT_DIR}/resources/g2/sprites.json\" + COMMAND ./openrct2-cli sprite build \"${CMAKE_BINARY_DIR}/g2.dat\" \"${ROOT_DIR}/resources/g2/sprites.json\" WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) add_custom_target(g2 DEPENDS ${PROJECT} g2.dat) @@ -256,7 +260,9 @@ if (DOWNLOAD_OBJECTS) endif () install(TARGETS "libopenrct2" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}") -install(TARGETS "openrct2" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") +if(NOT DISABLE_GUI) + install(TARGETS "openrct2" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") +endif() install(TARGETS "openrct2-cli" OPTIONAL RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/g2.dat" DESTINATION "${CMAKE_INSTALL_DATADIR}/openrct2") install(DIRECTORY "data/" DESTINATION "${CMAKE_INSTALL_DATADIR}/openrct2")