FLTK sandbox

Check-in [0957b8a5d6]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:[CMake] Work around CMake bug in CMake versions 3.4.x. CMake versions 3.4.x crash when using fltk_wrap_ui, a built-in CMake command. According to the CMake devs this will be fixed in CMake 3.5. However, since fltk_wrap_ui is no longer necessary (it can replaced by custom build commands) and some Linux distributions deploy CMake 3.4.x we decided to use an own replacement function. This makes sure that FLTK can be built with CMake 3.4.x, but FLTK users may still have to rewrite their own CMake files to not use fltk_wrap_ui. git-svn-id: http://seriss.com/public/fltk/fltk/branches/branch-1.3@11081 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:0957b8a5d690f12351490d28011fdd64d4311d7c
User & Date: AlbrechtS@ea41ed52-d2ee-0310-a9c1-e6b18d33e121 2016-01-29 13:09:30
Context
2016-01-30
20:44
started adding of styles to fltk check-in: 5b4d03fe0b user: Nikita tags: styles
2016-01-29
13:09
[CMake] Work around CMake bug in CMake versions 3.4.x. CMake versions 3.4.x crash when using fltk_wrap_ui, a built-in CMake command. According to the CMake devs this will be fixed in CMake 3.5. However, since fltk_wrap_ui is no longer necessary (it can replaced by custom build commands) and some Linux distributions deploy CMake 3.4.x we decided to use an own replacement function. This makes sure that FLTK can be built with CMake 3.4.x, but FLTK users may still have to rewrite their own CMake files to not use fltk_wrap_ui. git-svn-id: http://seriss.com/public/fltk/fltk/branches/branch-1.3@11081 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 Leaf check-in: 0957b8a5d6 user: AlbrechtS@ea41ed52-d2ee-0310-a9c1-e6b18d33e121 tags: trunk
2016-01-25
18:41
Fixed incomplete example. Re: David Allen's post today on fltk.general git-svn-id: http://seriss.com/public/fltk/fltk/branches/branch-1.3@11052 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 check-in: fda071435c user: greg.ercolano@ea41ed52-d2ee-0310-a9c1-e6b18d33e121 tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to CMake/macros.cmake.

70
71
72
73
74
75
76

















77
78
79
80
81
82
83
..
93
94
95
96
97
98
99

100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
        ARCHIVE DESTINATION ${FLTK_LIBDIR}
        )

    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)

    set(srcs)			# source files
    set(flsrcs)			# fluid source files

................................................................................
        if("${src}" MATCHES "\\.fl$")
            list(APPEND flsrcs ${src})
        else()
            list(APPEND srcs ${src})
        endif("${src}" MATCHES "\\.fl$")
    endforeach(src)


    if(flsrcs)
        set(FLTK_WRAP_UI TRUE)
        fltk_wrap_ui(${tname} ${flsrcs})
    endif(flsrcs)

    if(APPLE AND NOT OPTION_APPLE_X11)
      unset(RESOURCE_PATH)
      if(${tname} STREQUAL "blocks" OR ${tname} STREQUAL "checkers" OR ${tname} STREQUAL "sudoku")
        set( ICON_NAME ${tname}.icns )
        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" )
      endif(${tname} STREQUAL "blocks" OR ${tname} STREQUAL "checkers" OR ${tname} STREQUAL "sudoku")

      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)
    else()
      add_executable(${tname} WIN32 ${srcs} ${${tname}_FLTK_UI_SRCS})
    endif(APPLE AND NOT OPTION_APPLE_X11)

    set_target_properties(${tname}    
	    PROPERTIES OUTPUT_NAME ${oname}
	  )
    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)
    if(APPLE AND (NOT OPTION_APPLE_X11) AND ${tname} STREQUAL "editor")
      set_target_properties("editor" PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${PROJECT_SOURCE_DIR}/ide/Xcode4/plists/editor-Info.plist" )
    endif(APPLE AND (NOT OPTION_APPLE_X11) AND ${tname} STREQUAL "editor")
    

    target_link_libraries(${tname} ${LIBRARIES})

    # link in optional libraries
    if(USE_XFT)
        target_link_libraries(${tname} ${X11_Xft_LIB})
    endif(USE_XFT)








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>

<
|












|




|


|



|
|










<







70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
...
110
111
112
113
114
115
116
117
118

119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155

156
157
158
159
160
161
162
        ARCHIVE DESTINATION ${FLTK_LIBDIR}
        )

    list(APPEND FLTK_LIBRARIES "${LIBRARY_NAME}")
    set(FLTK_LIBRARIES ${FLTK_LIBRARIES} PARENT_SCOPE)

endmacro(FL_ADD_LIBRARY LIBNAME LIBTYPE LIBFILES)

#######################################################################
# USAGE: FLTK_RUN_FLUID TARGET_NAME "FLUID_SOURCE [.. FLUID_SOURCE]"
function(FLTK_RUN_FLUID TARGET SOURCES)
    set(CXX_FILES)
    foreach(src ${SOURCES})
        if("${src}" MATCHES "\\.fl$")
	    string(REGEX REPLACE "(.*).fl" \\1 basename ${src})
	    add_custom_command(
		OUTPUT "${basename}.cxx" "${basename}.h"
		COMMAND fluid -c ${CMAKE_CURRENT_SOURCE_DIR}/${src}
		)
	    list(APPEND CXX_FILES "${basename}.cxx")
        endif("${src}" MATCHES "\\.fl$")
        set(${TARGET} ${CXX_FILES} PARENT_SCOPE)
	endforeach(src)
endfunction(FLTK_RUN_FLUID TARGET SOURCES)

#######################################################################
macro(CREATE_EXAMPLE NAME SOURCES LIBRARIES)

    set(srcs)			# source files
    set(flsrcs)			# fluid source files

................................................................................
        if("${src}" MATCHES "\\.fl$")
            list(APPEND flsrcs ${src})
        else()
            list(APPEND srcs ${src})
        endif("${src}" MATCHES "\\.fl$")
    endforeach(src)

    set(FLUID_SOURCES)
    if(flsrcs)

	FLTK_RUN_FLUID(FLUID_SOURCES "${flsrcs}")
    endif(flsrcs)

    if(APPLE AND NOT OPTION_APPLE_X11)
      unset(RESOURCE_PATH)
      if(${tname} STREQUAL "blocks" OR ${tname} STREQUAL "checkers" OR ${tname} STREQUAL "sudoku")
        set( ICON_NAME ${tname}.icns )
        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" )
      endif(${tname} STREQUAL "blocks" OR ${tname} STREQUAL "checkers" OR ${tname} STREQUAL "sudoku")

      if(DEFINED RESOURCE_PATH)
        add_executable(${tname} MACOSX_BUNDLE ${srcs} ${FLUID_SOURCES} ${RESOURCE_PATH})
        if(${tname} STREQUAL "demo")
          target_compile_definitions(demo PUBLIC USING_XCODE)
        endif(${tname} STREQUAL "demo")
      else()
        add_executable(${tname} MACOSX_BUNDLE ${srcs} ${FLUID_SOURCES})
      endif(DEFINED RESOURCE_PATH)
    else()
      add_executable(${tname} WIN32 ${srcs} ${FLUID_SOURCES})
    endif(APPLE AND NOT OPTION_APPLE_X11)

    set_target_properties(${tname}    
      PROPERTIES OUTPUT_NAME ${oname}
    )
    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)
    if(APPLE AND (NOT OPTION_APPLE_X11) AND ${tname} STREQUAL "editor")
      set_target_properties("editor" PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${PROJECT_SOURCE_DIR}/ide/Xcode4/plists/editor-Info.plist" )
    endif(APPLE AND (NOT OPTION_APPLE_X11) AND ${tname} STREQUAL "editor")
    

    target_link_libraries(${tname} ${LIBRARIES})

    # link in optional libraries
    if(USE_XFT)
        target_link_libraries(${tname} ${X11_Xft_LIB})
    endif(USE_XFT)