mirror of
https://github.com/fltk/fltk.git
synced 2026-05-27 10:57:58 +08:00
Make building Fluid optional. (#539)
This commit is contained in:
@@ -22,6 +22,12 @@
|
|||||||
# USAGE: FLTK_RUN_FLUID TARGET_NAME "FLUID_SOURCE [.. FLUID_SOURCE]"
|
# USAGE: FLTK_RUN_FLUID TARGET_NAME "FLUID_SOURCE [.. FLUID_SOURCE]"
|
||||||
|
|
||||||
function (FLTK_RUN_FLUID TARGET SOURCES)
|
function (FLTK_RUN_FLUID TARGET SOURCES)
|
||||||
|
|
||||||
|
if (NOT FLTK_FLUID_EXECUTABLE)
|
||||||
|
message (WARNING "Not building ${SOURCES}. FLUID executable not found.")
|
||||||
|
return ()
|
||||||
|
endif (NOT FLTK_FLUID_EXECUTABLE)
|
||||||
|
|
||||||
set (CXX_FILES)
|
set (CXX_FILES)
|
||||||
foreach (src ${SOURCES})
|
foreach (src ${SOURCES})
|
||||||
if ("${src}" MATCHES "\\.fl$")
|
if ("${src}" MATCHES "\\.fl$")
|
||||||
@@ -36,6 +42,7 @@ function (FLTK_RUN_FLUID TARGET SOURCES)
|
|||||||
endif ("${src}" MATCHES "\\.fl$")
|
endif ("${src}" MATCHES "\\.fl$")
|
||||||
endforeach ()
|
endforeach ()
|
||||||
set (${TARGET} ${CXX_FILES} PARENT_SCOPE)
|
set (${TARGET} ${CXX_FILES} PARENT_SCOPE)
|
||||||
|
|
||||||
endfunction (FLTK_RUN_FLUID TARGET SOURCES)
|
endfunction (FLTK_RUN_FLUID TARGET SOURCES)
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
# FLTK_INCLUDE_DIRS - FLTK include directories
|
# FLTK_INCLUDE_DIRS - FLTK include directories
|
||||||
# FLTK_LIBRARIES - list of FLTK libraries built (not yet implemented)
|
# FLTK_LIBRARIES - list of FLTK libraries built (not yet implemented)
|
||||||
# FLTK_FLUID_EXECUTABLE - needed by the function FLTK_RUN_FLUID
|
# FLTK_FLUID_EXECUTABLE - needed by the function FLTK_RUN_FLUID
|
||||||
# (or the deprecated fltk_wrap_ui() CMake command)
|
# (or the deprecated fltk_wrap_ui() CMake command)
|
||||||
#
|
#
|
||||||
# It defines the following deprecated variables for backwards
|
# It defines the following deprecated variables for backwards
|
||||||
# compatibility (do not use for new projects):
|
# compatibility (do not use for new projects):
|
||||||
|
|||||||
+11
-11
@@ -21,16 +21,7 @@
|
|||||||
|
|
||||||
# Set the fluid executable path used to create .cxx/.h from .fl files
|
# Set the fluid executable path used to create .cxx/.h from .fl files
|
||||||
|
|
||||||
if (CMAKE_CROSSCOMPILING)
|
if (FLTK_BUILD_FLUID AND NOT CMAKE_CROSSCOMPILING)
|
||||||
# find a fluid executable on the host system
|
|
||||||
find_file(FLUID_PATH
|
|
||||||
NAMES fluid fluid.exe
|
|
||||||
PATHS ENV PATH
|
|
||||||
NO_CMAKE_FIND_ROOT_PATH
|
|
||||||
)
|
|
||||||
set (FLTK_FLUID_EXECUTABLE ${FLUID_PATH})
|
|
||||||
set (FLUID_EXPORT "") # don't export fluid
|
|
||||||
else ()
|
|
||||||
# use the fluid executable we build
|
# use the fluid executable we build
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
set (FLTK_FLUID_EXECUTABLE fluid-cmd)
|
set (FLTK_FLUID_EXECUTABLE fluid-cmd)
|
||||||
@@ -39,7 +30,16 @@ else ()
|
|||||||
set (FLTK_FLUID_EXECUTABLE fluid)
|
set (FLTK_FLUID_EXECUTABLE fluid)
|
||||||
set (FLUID_EXPORT fluid) # export fluid
|
set (FLUID_EXPORT fluid) # export fluid
|
||||||
endif ()
|
endif ()
|
||||||
endif (CMAKE_CROSSCOMPILING)
|
else ()
|
||||||
|
# find a fluid executable on the host system
|
||||||
|
find_file(FLUID_PATH
|
||||||
|
NAMES fluid fluid.exe
|
||||||
|
PATHS ENV PATH
|
||||||
|
NO_CMAKE_FIND_ROOT_PATH
|
||||||
|
)
|
||||||
|
set (FLTK_FLUID_EXECUTABLE ${FLUID_PATH})
|
||||||
|
set (FLUID_EXPORT "") # don't export fluid
|
||||||
|
endif (FLTK_BUILD_FLUID AND NOT CMAKE_CROSSCOMPILING)
|
||||||
|
|
||||||
# generate FLTK-Targets.cmake for build directory use
|
# generate FLTK-Targets.cmake for build directory use
|
||||||
export (TARGETS ${FLUID_EXPORT} ${FLTK_LIBRARIES} FILE ${CMAKE_CURRENT_BINARY_DIR}/FLTK-Targets.cmake)
|
export (TARGETS ${FLUID_EXPORT} ${FLTK_LIBRARIES} FILE ${CMAKE_CURRENT_BINARY_DIR}/FLTK-Targets.cmake)
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
#
|
#
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
macro (CREATE_EXAMPLE NAME SOURCES LIBRARIES)
|
function (CREATE_EXAMPLE NAME SOURCES LIBRARIES)
|
||||||
|
|
||||||
set (srcs) # source files
|
set (srcs) # source files
|
||||||
set (flsrcs) # fluid source (.fl) files
|
set (flsrcs) # fluid source (.fl) files
|
||||||
@@ -91,6 +91,10 @@ macro (CREATE_EXAMPLE NAME SOURCES LIBRARIES)
|
|||||||
# generate source files from .fl files, add output to sources
|
# generate source files from .fl files, add output to sources
|
||||||
|
|
||||||
if (flsrcs)
|
if (flsrcs)
|
||||||
|
if (NOT FLTK_FLUID_EXECUTABLE)
|
||||||
|
message(STATUS "Example app \"${NAME}\" will not be built. FLUID executable not found.")
|
||||||
|
return ()
|
||||||
|
endif ()
|
||||||
FLTK_RUN_FLUID (FLUID_SOURCES "${flsrcs}")
|
FLTK_RUN_FLUID (FLUID_SOURCES "${flsrcs}")
|
||||||
list (APPEND srcs ${FLUID_SOURCES})
|
list (APPEND srcs ${FLUID_SOURCES})
|
||||||
unset (FLUID_SOURCES)
|
unset (FLUID_SOURCES)
|
||||||
@@ -176,4 +180,4 @@ macro (CREATE_EXAMPLE NAME SOURCES LIBRARIES)
|
|||||||
# *unused* # endforeach ()
|
# *unused* # endforeach ()
|
||||||
# *unused* # endif ()
|
# *unused* # endif ()
|
||||||
|
|
||||||
endmacro (CREATE_EXAMPLE NAME SOURCES LIBRARIES)
|
endfunction ()
|
||||||
|
|||||||
+9
-6
@@ -122,14 +122,17 @@ if (UNIX OR MSYS OR MINGW)
|
|||||||
)
|
)
|
||||||
endmacro (INSTALL_MAN FILE LEVEL)
|
endmacro (INSTALL_MAN FILE LEVEL)
|
||||||
|
|
||||||
INSTALL_MAN (fluid 1)
|
if (FLTK_BUILD_FLUID)
|
||||||
|
INSTALL_MAN (fluid 1)
|
||||||
|
endif (FLTK_BUILD_FLUID)
|
||||||
INSTALL_MAN (fltk-config 1)
|
INSTALL_MAN (fltk-config 1)
|
||||||
INSTALL_MAN (fltk 3)
|
INSTALL_MAN (fltk 3)
|
||||||
|
|
||||||
# Don't (!) install man pages of games (GitHub issue #23)
|
if (FLTK_BUILD_TEST AND FLTK_BUILD_FLUID)
|
||||||
|
# Don't (!) install man pages of games (GitHub issue #23)
|
||||||
# INSTALL_MAN (blocks 6)
|
# INSTALL_MAN (blocks 6)
|
||||||
# INSTALL_MAN (checkers 6)
|
# INSTALL_MAN (checkers 6)
|
||||||
# INSTALL_MAN (sudoku 6)
|
# INSTALL_MAN (sudoku 6)
|
||||||
|
endif ()
|
||||||
|
|
||||||
endif (UNIX OR MSYS OR MINGW)
|
endif (UNIX OR MSYS OR MINGW)
|
||||||
|
|||||||
@@ -301,6 +301,7 @@ option (OPTION_BUILD_SHARED_LIBS
|
|||||||
option (OPTION_PRINT_SUPPORT "allow print support" ON)
|
option (OPTION_PRINT_SUPPORT "allow print support" ON)
|
||||||
option (OPTION_FILESYSTEM_SUPPORT "allow file system support" ON)
|
option (OPTION_FILESYSTEM_SUPPORT "allow file system support" ON)
|
||||||
|
|
||||||
|
option (FLTK_BUILD_FLUID "Build FLUID" ON)
|
||||||
option (FLTK_BUILD_TEST "Build test/demo programs" ON)
|
option (FLTK_BUILD_TEST "Build test/demo programs" ON)
|
||||||
option (FLTK_BUILD_EXAMPLES "Build example programs" OFF)
|
option (FLTK_BUILD_EXAMPLES "Build example programs" OFF)
|
||||||
|
|
||||||
|
|||||||
+9
-1
@@ -111,7 +111,9 @@ add_subdirectory(src)
|
|||||||
# build fluid
|
# build fluid
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
add_subdirectory(fluid)
|
if (FLTK_BUILD_FLUID)
|
||||||
|
add_subdirectory (fluid)
|
||||||
|
endif (FLTK_BUILD_FLUID)
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# variables shared by export and install
|
# variables shared by export and install
|
||||||
@@ -210,6 +212,12 @@ else ()
|
|||||||
message (STATUS "Shared libraries will not be built (set OPTION_BUILD_SHARED_LIBS=ON to build)")
|
message (STATUS "Shared libraries will not be built (set OPTION_BUILD_SHARED_LIBS=ON to build)")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
if (FLTK_BUILD_FLUID)
|
||||||
|
message (STATUS "FLUID will be built in ${CMAKE_CURRENT_BINARY_DIR}/bin/fluid")
|
||||||
|
else ()
|
||||||
|
message (STATUS "FLUID will not be built (set FLTK_BUILD_FLUID=ON to build)")
|
||||||
|
endif ()
|
||||||
|
|
||||||
if (FLTK_BUILD_TEST)
|
if (FLTK_BUILD_TEST)
|
||||||
message (STATUS "Test programs will be built in ${CMAKE_CURRENT_BINARY_DIR}/bin/test")
|
message (STATUS "Test programs will be built in ${CMAKE_CURRENT_BINARY_DIR}/bin/test")
|
||||||
endif ()
|
endif ()
|
||||||
|
|||||||
@@ -119,6 +119,9 @@ OPTION_BUILD_SHARED_LIBS - default OFF
|
|||||||
Normally FLTK is built as static libraries which makes more portable
|
Normally FLTK is built as static libraries which makes more portable
|
||||||
binaries. If you want to use shared libraries, this will build them too.
|
binaries. If you want to use shared libraries, this will build them too.
|
||||||
|
|
||||||
|
FLTK_BUILD_FLUID - default ON
|
||||||
|
Builds the Fast Light User-Interface Designer ("FLUID").
|
||||||
|
|
||||||
FLTK_BUILD_TEST - default ON
|
FLTK_BUILD_TEST - default ON
|
||||||
Builds the test and demo programs in the 'test' directory.
|
Builds the test and demo programs in the 'test' directory.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user