2014-09-27 04:44:47 +04:00
|
|
|
#
|
2014-11-22 03:42:44 +03:00
|
|
|
# "$Id$"
|
2014-09-27 04:44:47 +04:00
|
|
|
#
|
|
|
|
# macros.cmake defines macros used by the build system
|
|
|
|
# Written by Michael Surette
|
|
|
|
#
|
2015-02-16 17:30:27 +03:00
|
|
|
# Copyright 1998-2015 by Bill Spitzak and others.
|
2014-09-27 04:44:47 +04:00
|
|
|
#
|
|
|
|
# This library is free software. Distribution and use rights are outlined in
|
|
|
|
# the file "COPYING" which should have been included with this file. If this
|
|
|
|
# file is missing or damaged, see the license at:
|
|
|
|
#
|
|
|
|
# http://www.fltk.org/COPYING.php
|
|
|
|
#
|
|
|
|
# Please report all bugs and problems on the following page:
|
|
|
|
#
|
|
|
|
# http://www.fltk.org/str.php
|
|
|
|
#
|
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
# macros used by the build system
|
|
|
|
#######################################################################
|
|
|
|
macro(FL_ADD_LIBRARY LIBNAME LIBTYPE LIBFILES)
|
|
|
|
|
|
|
|
if(${LIBTYPE} STREQUAL "SHARED")
|
|
|
|
set(LIBRARY_NAME ${LIBNAME}_SHARED)
|
|
|
|
else()
|
|
|
|
set(LIBRARY_NAME ${LIBNAME})
|
|
|
|
endif(${LIBTYPE} STREQUAL "SHARED")
|
|
|
|
|
|
|
|
add_library(${LIBRARY_NAME} ${LIBTYPE} ${LIBFILES})
|
|
|
|
|
|
|
|
set_target_properties(${LIBRARY_NAME}
|
|
|
|
PROPERTIES
|
|
|
|
OUTPUT_NAME ${LIBNAME}
|
|
|
|
DEBUG_OUTPUT_NAME "${LIBNAME}d"
|
|
|
|
CLEAN_DIRECT_OUTPUT TRUE
|
|
|
|
COMPILE_DEFINITIONS "FL_LIBRARY"
|
|
|
|
)
|
|
|
|
|
|
|
|
if(${LIBTYPE} STREQUAL "SHARED")
|
|
|
|
set_target_properties(${LIBRARY_NAME}
|
|
|
|
PROPERTIES
|
|
|
|
VERSION ${FLTK_VERSION_FULL}
|
|
|
|
SOVERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}
|
|
|
|
PREFIX "lib" # for MSVC static/shared coexistence
|
|
|
|
)
|
|
|
|
endif(${LIBTYPE} STREQUAL "SHARED")
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
if(OPTION_LARGE_FILE)
|
|
|
|
set_target_properties(${LIBNAME}
|
|
|
|
PROPERTIES
|
|
|
|
LINK_FLAGS /LARGEADDRESSAWARE
|
|
|
|
)
|
|
|
|
endif(OPTION_LARGE_FILE)
|
|
|
|
|
|
|
|
if(${LIBTYPE} STREQUAL "SHARED")
|
|
|
|
set_target_properties(${LIBRARY_NAME}
|
|
|
|
PROPERTIES
|
|
|
|
COMPILE_DEFINITIONS "FL_DLL"
|
|
|
|
)
|
|
|
|
endif(${LIBTYPE} STREQUAL "SHARED")
|
|
|
|
endif(MSVC)
|
|
|
|
|
|
|
|
install(TARGETS ${LIBRARY_NAME}
|
|
|
|
EXPORT FLTK-Targets
|
2015-02-16 17:30:27 +03:00
|
|
|
RUNTIME DESTINATION ${FLTK_BINDIR}
|
|
|
|
LIBRARY DESTINATION ${FLTK_LIBDIR}
|
|
|
|
ARCHIVE DESTINATION ${FLTK_LIBDIR}
|
2014-09-27 04:44:47 +04:00
|
|
|
)
|
|
|
|
|
|
|
|
list(APPEND FLTK_LIBRARIES "${LIBRARY_NAME}")
|
|
|
|
set(FLTK_LIBRARIES ${FLTK_LIBRARIES} PARENT_SCOPE)
|
|
|
|
|
|
|
|
endmacro(FL_ADD_LIBRARY LIBNAME LIBTYPE LIBFILES)
|
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
macro(CREATE_EXAMPLE NAME SOURCES LIBRARIES)
|
|
|
|
|
2014-10-09 20:11:36 +04:00
|
|
|
set(srcs) # source files
|
|
|
|
set(flsrcs) # fluid source files
|
|
|
|
|
|
|
|
set(tname ${NAME}) # target name
|
|
|
|
set(oname ${NAME}) # output (executable) name
|
|
|
|
|
|
|
|
# rename reserved target name "help" (CMake 2.8.12 and later)
|
|
|
|
if(${tname} MATCHES "^help$")
|
|
|
|
set(tname "test_help")
|
|
|
|
endif(${tname} MATCHES "^help$")
|
|
|
|
|
2014-09-27 04:44:47 +04:00
|
|
|
foreach(src ${SOURCES})
|
2014-10-12 05:24:04 +04:00
|
|
|
if("${src}" MATCHES "\\.fl$")
|
2014-09-27 04:44:47 +04:00
|
|
|
list(APPEND flsrcs ${src})
|
|
|
|
else()
|
|
|
|
list(APPEND srcs ${src})
|
2014-10-12 05:24:04 +04:00
|
|
|
endif("${src}" MATCHES "\\.fl$")
|
2014-09-27 04:44:47 +04:00
|
|
|
endforeach(src)
|
|
|
|
|
|
|
|
if(flsrcs)
|
|
|
|
set(FLTK_WRAP_UI TRUE)
|
2014-10-09 20:11:36 +04:00
|
|
|
fltk_wrap_ui(${tname} ${flsrcs})
|
2014-09-27 04:44:47 +04:00
|
|
|
endif(flsrcs)
|
|
|
|
|
2015-04-07 18:31:12 +03:00
|
|
|
if(APPLE)
|
2015-04-08 15:16:52 +03:00
|
|
|
unset(RESOURCE_PATH)
|
2015-04-07 18:31:12 +03:00
|
|
|
if(${tname} STREQUAL "blocks" OR ${tname} STREQUAL "checkers" OR ${tname} STREQUAL "sudoku")
|
|
|
|
set( ICON_NAME ${tname}.icns )
|
2015-04-08 15:16:52 +03:00
|
|
|
set( RESOURCE_PATH "${PROJECT_SOURCE_DIR}/test/${tname}.app/Contents/Resources/${ICON_NAME}" )
|
|
|
|
elseif(${tname} STREQUAL "demo")
|
|
|
|
set( RESOURCE_PATH "${PROJECT_SOURCE_DIR}/test/demo.menu" )
|
2015-04-07 18:31:12 +03:00
|
|
|
endif(${tname} STREQUAL "blocks" OR ${tname} STREQUAL "checkers" OR ${tname} STREQUAL "sudoku")
|
2015-04-08 15:16:52 +03:00
|
|
|
|
|
|
|
if(DEFINED RESOURCE_PATH)
|
|
|
|
add_executable(${tname} MACOSX_BUNDLE ${srcs} ${RESOURCE_PATH})
|
|
|
|
if(${tname} STREQUAL "demo")
|
|
|
|
target_compile_definitions(demo PUBLIC USING_XCODE)
|
|
|
|
endif(${tname} STREQUAL "demo")
|
|
|
|
else()
|
|
|
|
add_executable(${tname} MACOSX_BUNDLE ${srcs} ${${tname}_FLTK_UI_SRCS})
|
|
|
|
endif(DEFINED RESOURCE_PATH)
|
2015-04-07 18:31:12 +03:00
|
|
|
else()
|
|
|
|
add_executable(${tname} WIN32 ${srcs} ${${tname}_FLTK_UI_SRCS})
|
|
|
|
endif(APPLE)
|
|
|
|
|
|
|
|
set_target_properties(${tname}
|
|
|
|
PROPERTIES OUTPUT_NAME ${oname}
|
|
|
|
)
|
2015-04-08 15:16:52 +03:00
|
|
|
if(APPLE AND DEFINED RESOURCE_PATH)
|
|
|
|
if(NOT ${tname} STREQUAL "demo")
|
|
|
|
set_target_properties(${tname} PROPERTIES MACOSX_BUNDLE_ICON_FILE ${ICON_NAME})
|
|
|
|
endif(NOT ${tname} STREQUAL "demo")
|
|
|
|
set_target_properties(${tname} PROPERTIES RESOURCE ${RESOURCE_PATH})
|
|
|
|
endif(APPLE AND DEFINED RESOURCE_PATH)
|
2015-12-29 19:41:15 +03:00
|
|
|
if(${tname} STREQUAL "editor")
|
|
|
|
set_target_properties("editor" PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${PROJECT_SOURCE_DIR}/ide/Xcode4/plists/editor-Info.plist" )
|
|
|
|
endif(${tname} STREQUAL "editor")
|
2015-04-08 15:16:52 +03:00
|
|
|
|
2014-09-27 04:44:47 +04:00
|
|
|
|
2014-10-09 20:11:36 +04:00
|
|
|
target_link_libraries(${tname} ${LIBRARIES})
|
2014-09-27 04:44:47 +04:00
|
|
|
|
|
|
|
# link in optional libraries
|
|
|
|
if(USE_XFT)
|
2014-10-09 20:11:36 +04:00
|
|
|
target_link_libraries(${tname} ${X11_Xft_LIB})
|
2014-09-27 04:44:47 +04:00
|
|
|
endif(USE_XFT)
|
|
|
|
|
|
|
|
if(HAVE_XINERAMA)
|
2014-10-09 20:11:36 +04:00
|
|
|
target_link_libraries(${tname} ${X11_Xinerama_LIB})
|
2014-09-27 04:44:47 +04:00
|
|
|
endif(HAVE_XINERAMA)
|
|
|
|
|
|
|
|
endmacro(CREATE_EXAMPLE NAME SOURCES LIBRARIES)
|
|
|
|
|
|
|
|
#######################################################################
|