From f8adfb66ea686366edddc89e92c9a5537b8dfbef Mon Sep 17 00:00:00 2001 From: William Breathitt Gray Date: Wed, 9 Dec 2020 07:45:54 -0500 Subject: [PATCH] Add BUILD_EDITOR option to control cdogs-sdl-editor build --- CMakeLists.txt | 10 +++++++--- src/CMakeLists.txt | 6 +++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 169a17ca..510e4802 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,12 +29,14 @@ SET(WEBSITE "http://cxong.github.io/cdogs-sdl/") option(DEBUG "Enable debug build" OFF) option(DEBUG_PROFILE "Enable debug profile build" OFF) option(USE_SHARED_ENET "Use system installed copy of enet" OFF) +option(BUILD_EDITOR "Build cdogs-sdl-editor" ON) # check for crosscompiling (defined when using a toolchain file) if(CMAKE_CROSSCOMPILING) # check for gcw0 if(CMAKE_C_COMPILER MATCHES ".*gcw0-linux.*") set(GCW0 1) + set(BUILD_EDITOR OFF) endif() endif() @@ -65,7 +67,9 @@ find_package(Nanopb REQUIRED) find_package(SDL2 REQUIRED) find_package(SDL2_image REQUIRED) find_package(SDL2_mixer REQUIRED) -find_package(OpenGL REQUIRED) +if(BUILD_EDITOR) + find_package(OpenGL REQUIRED) +endif() find_package(CCache) link_directories(${SDL2_LIBRARY_DIRS} ${SDL2_IMAGE_LIBRARY_DIRS} ${SDL2_MIXER_LIBRARY_DIRS}) @@ -165,7 +169,7 @@ set_target_properties(cdogs-sdl PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}/src RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}/src ) -if(NOT "${GCW0}") +if(BUILD_EDITOR) set_target_properties(cdogs-sdl-editor PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR}/src RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_BINARY_DIR}/src @@ -200,7 +204,7 @@ install( PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/src/cdogs-sdl${EXE_EXTENSION} DESTINATION ${CDOGS_BIN_DIR}) -if(NOT "${GCW0}") +if(BUILD_EDITOR) install( PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/src/cdogs-sdl-editor${EXE_EXTENSION} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8fb82667..564cbf3f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,12 +4,12 @@ include_directories( ${SDL2_INCLUDE_DIRS} ${SDL2_IMAGE_INCLUDE_DIRS} ${SDL2_MIXER_INCLUDE_DIRS}) -if(NOT "${GCW0}") +if(BUILD_EDITOR) include_directories(${OPENGL_INCLUDE_DIRS}) endif() add_subdirectory(cdogs) -if(NOT "${GCW0}") +if(BUILD_EDITOR) add_subdirectory(cdogsed) endif() add_subdirectory(json) @@ -82,7 +82,7 @@ if(GCW0) ) endif() -if(NOT "${GCW0}") +if(BUILD_EDITOR) add_executable(cdogs-sdl-editor cdogsed/cdogsed.c ${CDOGS_SDL_EXTRA}) if(APPLE) set_target_properties(cdogs-sdl-editor PROPERTIES -- 2.29.2