Skip to content

Commit 7f91cef

Browse files
HasenpfoteHasenpfote
Hasenpfote
authored and
Hasenpfote
committed
オリジナルアップロード忘れ
1 parent d534ebf commit 7f91cef

37 files changed

+3802
-1
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
build/
1+
/build
22
imgui.ini
+241
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
1+
if ( NOT DEFINED CMAKE_BUILD_TYPE )
2+
set( CMAKE_BUILD_TYPE Release CACHE STRING "Build type" )
3+
endif ()
4+
5+
project (glew)
6+
7+
cmake_minimum_required (VERSION 2.8.12)
8+
9+
include(GNUInstallDirs)
10+
11+
if (COMMAND cmake_policy)
12+
cmake_policy (SET CMP0003 NEW)
13+
cmake_policy (SET CMP0042 NEW)
14+
endif()
15+
16+
set(CMAKE_DEBUG_POSTFIX d)
17+
18+
option (BUILD_UTILS "utilities" ON)
19+
option (GLEW_REGAL "Regal mode" OFF)
20+
option (GLEW_OSMESA "OSMesa mode" OFF)
21+
if (APPLE)
22+
option (BUILD_FRAMEWORK "Build Framework bundle for OSX" OFF)
23+
endif ()
24+
25+
set (GLEW_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../..)
26+
27+
# get version from config/version
28+
file (STRINGS ${GLEW_DIR}/config/version _VERSION_MAJOR_STRING REGEX "GLEW_MAJOR[ ]*=[ ]*[0-9]+.*")
29+
string (REGEX REPLACE "GLEW_MAJOR[ ]*=[ ]*([0-9]+)" "\\1" CPACK_PACKAGE_VERSION_MAJOR ${_VERSION_MAJOR_STRING})
30+
file (STRINGS ${GLEW_DIR}/config/version _VERSION_MINOR_STRING REGEX "GLEW_MINOR[ ]*=[ ]*[0-9]+.*")
31+
string (REGEX REPLACE "GLEW_MINOR[ ]*=[ ]*([0-9]+)" "\\1" CPACK_PACKAGE_VERSION_MINOR ${_VERSION_MINOR_STRING})
32+
file (STRINGS ${GLEW_DIR}/config/version _VERSION_PATCH_STRING REGEX "GLEW_MICRO[ ]*=[ ]*[0-9]+.*")
33+
string (REGEX REPLACE "GLEW_MICRO[ ]*=[ ]*([0-9]+)" "\\1" CPACK_PACKAGE_VERSION_PATCH ${_VERSION_PATCH_STRING})
34+
set (GLEW_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
35+
36+
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
37+
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
38+
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
39+
40+
find_package (OpenGL REQUIRED)
41+
42+
# X11 required when builing visualinfo and glewinfo,
43+
# but not for Windows or Apple OSX platforms
44+
if (BUILD_UTILS AND NOT WIN32 AND NOT APPLE)
45+
find_package (X11)
46+
endif()
47+
48+
if (WIN32)
49+
set (GLEW_LIB_NAME glew32)
50+
else ()
51+
set (GLEW_LIB_NAME GLEW)
52+
set (DLL_PREFIX lib)
53+
endif ()
54+
55+
set (GLEW_LIBRARIES ${OPENGL_LIBRARIES})
56+
57+
add_definitions (-DGLEW_NO_GLU)
58+
59+
#### Regal mode ####
60+
61+
if (GLEW_REGAL)
62+
if (WIN32)
63+
set (REGAL_LIB_NAME regal32)
64+
else ()
65+
set (REGAL_LIB_NAME Regal)
66+
endif ()
67+
add_definitions (-DGLEW_REGAL)
68+
set (GLEW_LIBRARIES ${REGAL_LIB_NAME})
69+
endif ()
70+
71+
#### OSMesa mode ####
72+
73+
if (GLEW_OSMESA)
74+
if (WIN32)
75+
set (OSMESA_LIB_NAME osmesa)
76+
else ()
77+
set (OSMESA_LIB_NAME OSMesa)
78+
endif ()
79+
add_definitions (-DGLEW_OSMESA)
80+
set (GLEW_LIBRARIES ${OSMESA_LIB_NAME} ${OPENGL_LIBRARIES})
81+
set (X11_LIBRARIES)
82+
endif ()
83+
84+
#### GLEW ####
85+
86+
include_directories (${GLEW_DIR}/include)
87+
88+
set (GLEW_PUBLIC_HEADERS_FILES ${GLEW_DIR}/include/GL/wglew.h ${GLEW_DIR}/include/GL/glew.h ${GLEW_DIR}/include/GL/glxew.h)
89+
set (GLEW_SRC_FILES ${GLEW_DIR}/src/glew.c)
90+
91+
if (WIN32)
92+
list (APPEND GLEW_SRC_FILES ${GLEW_DIR}/build/glew.rc)
93+
endif ()
94+
95+
add_library (glew SHARED ${GLEW_PUBLIC_HEADERS_FILES} ${GLEW_SRC_FILES})
96+
set_target_properties (glew PROPERTIES COMPILE_DEFINITIONS "GLEW_BUILD" OUTPUT_NAME "${GLEW_LIB_NAME}" PREFIX "${DLL_PREFIX}"
97+
VERSION ${GLEW_VERSION}
98+
SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR})
99+
add_library (glew_s STATIC ${GLEW_PUBLIC_HEADERS_FILES} ${GLEW_SRC_FILES})
100+
set_target_properties (glew_s PROPERTIES COMPILE_DEFINITIONS "GLEW_STATIC" OUTPUT_NAME "${GLEW_LIB_NAME}" PREFIX lib)
101+
102+
if (MSVC)
103+
# add options from visual studio project
104+
target_compile_definitions (glew PRIVATE "GLEW_BUILD;VC_EXTRALEAN")
105+
target_compile_definitions (glew_s PRIVATE "GLEW_STATIC;VC_EXTRALEAN")
106+
target_link_libraries (glew LINK_PRIVATE -BASE:0x62AA0000)
107+
# kill security checks which are dependent on stdlib
108+
target_compile_options (glew PRIVATE -GS-)
109+
target_compile_options (glew_s PRIVATE -GS-)
110+
# remove stdlib dependency
111+
target_link_libraries (glew LINK_PRIVATE -nodefaultlib -noentry)
112+
string(REGEX REPLACE "/RTC(su|[1su])" "" CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
113+
elseif (WIN32 AND ((CMAKE_C_COMPILER_ID MATCHES "GNU") OR (CMAKE_C_COMPILER_ID MATCHES "Clang")))
114+
# remove stdlib dependency on windows with GCC and Clang (for similar reasons
115+
# as to MSVC - to allow it to be used with any Windows compiler)
116+
target_compile_options (glew PRIVATE -fno-builtin -fno-stack-protector)
117+
target_compile_options (glew_s PRIVATE -fno-builtin -fno-stack-protector)
118+
target_link_libraries (glew LINK_PRIVATE -nostdlib)
119+
endif ()
120+
121+
if (BUILD_FRAMEWORK)
122+
set_target_properties(glew PROPERTIES
123+
FRAMEWORK TRUE
124+
FRAMEWORK_VERSION ${GLEW_VERSION}
125+
MACOSX_FRAMEWORK_IDENTIFIER net.sourceforge.glew
126+
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${GLEW_VERSION}
127+
MACOSX_FRAMEWORK_BUNDLE_VERSION ${GLEW_VERSION}
128+
XCODE_ATTRIBUTE_INSTALL_PATH "@rpath"
129+
PUBLIC_HEADER "${GLEW_PUBLIC_HEADERS_FILES}"
130+
OUTPUT_NAME GLEW
131+
)
132+
endif()
133+
134+
target_link_libraries (glew LINK_PUBLIC ${GLEW_LIBRARIES})
135+
target_link_libraries (glew_s ${GLEW_LIBRARIES})
136+
137+
if(CMAKE_VERSION VERSION_LESS 2.8.12)
138+
set(MAYBE_EXPORT "")
139+
else()
140+
target_compile_definitions(glew_s INTERFACE "GLEW_STATIC")
141+
foreach(t glew glew_s)
142+
target_include_directories(${t} PUBLIC $<INSTALL_INTERFACE:include>)
143+
endforeach()
144+
set(MAYBE_EXPORT EXPORT glew-targets)
145+
endif()
146+
147+
set(targets_to_install "")
148+
if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS)
149+
list(APPEND targets_to_install glew)
150+
endif()
151+
152+
if(NOT DEFINED BUILD_SHARED_LIBS OR NOT BUILD_SHARED_LIBS)
153+
list(APPEND targets_to_install glew_s)
154+
endif()
155+
156+
install ( TARGETS ${targets_to_install}
157+
${MAYBE_EXPORT}
158+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
159+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
160+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
161+
FRAMEWORK DESTINATION ${CMAKE_INSTALL_PREFIX}
162+
)
163+
164+
if (BUILD_UTILS)
165+
set (GLEWINFO_SRC_FILES ${GLEW_DIR}/src/glewinfo.c)
166+
if (WIN32)
167+
list (APPEND GLEWINFO_SRC_FILES ${GLEW_DIR}/build/glewinfo.rc)
168+
endif ()
169+
add_executable (glewinfo ${GLEWINFO_SRC_FILES})
170+
target_link_libraries (glewinfo glew)
171+
if (NOT WIN32)
172+
target_link_libraries(glewinfo ${X11_LIBRARIES})
173+
endif ()
174+
175+
set (VISUALINFO_SRC_FILES ${GLEW_DIR}/src/visualinfo.c)
176+
if (WIN32)
177+
list (APPEND VISUALINFO_SRC_FILES ${GLEW_DIR}/build/visualinfo.rc)
178+
endif ()
179+
add_executable (visualinfo ${VISUALINFO_SRC_FILES})
180+
target_link_libraries (visualinfo glew)
181+
if (NOT WIN32)
182+
target_link_libraries(visualinfo ${X11_LIBRARIES})
183+
endif ()
184+
185+
install ( TARGETS glewinfo visualinfo
186+
DESTINATION ${CMAKE_INSTALL_BINDIR})
187+
endif ()
188+
189+
set (prefix ${CMAKE_INSTALL_PREFIX})
190+
set (exec_prefix ${CMAKE_INSTALL_PREFIX})
191+
set (libdir ${CMAKE_INSTALL_FULL_LIBDIR})
192+
set (includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR})
193+
set (version ${GLEW_VERSION})
194+
set (libname ${GLEW_LIB_NAME})
195+
set (cflags)
196+
set (requireslib glu)
197+
198+
# Mac OSX has no glu.pc unless optional X11/GLX is installed
199+
if (APPLE)
200+
set (requireslib)
201+
endif ()
202+
203+
configure_file (${GLEW_DIR}/glew.pc.in ${GLEW_DIR}/glew.pc @ONLY)
204+
205+
install(FILES ${GLEW_DIR}/glew.pc
206+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
207+
)
208+
209+
if(WIN32 AND MSVC AND (NOT MSVC_VERSION LESS 1600) AND (NOT CMAKE_VERSION VERSION_LESS "3.1"))
210+
install(
211+
FILES $<TARGET_PDB_FILE:glew>
212+
DESTINATION ${CMAKE_INSTALL_LIBDIR}
213+
CONFIGURATIONS Debug RelWithDebInfo
214+
)
215+
endif()
216+
217+
install (FILES
218+
${GLEW_DIR}/include/GL/wglew.h
219+
${GLEW_DIR}/include/GL/glew.h
220+
${GLEW_DIR}/include/GL/glxew.h
221+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/GL)
222+
223+
if(MAYBE_EXPORT)
224+
install(EXPORT glew-targets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/glew
225+
NAMESPACE GLEW::)
226+
install(FILES
227+
${CMAKE_CURRENT_SOURCE_DIR}/glew-config.cmake
228+
${CMAKE_CURRENT_SOURCE_DIR}/CopyImportedTargetProperties.cmake
229+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/glew)
230+
endif()
231+
232+
if(NOT TARGET uninstall)
233+
configure_file(
234+
${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in
235+
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
236+
IMMEDIATE @ONLY)
237+
238+
add_custom_target(uninstall
239+
COMMAND ${CMAKE_COMMAND} -P
240+
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
241+
endif()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#.rst:
2+
# CopyImportedTargetProperties
3+
# --------------------------
4+
#
5+
# Copies the `INTERFACE*` and `IMPORTED*` properties from a target
6+
# to another one.
7+
# This function can be used to duplicate an `IMPORTED` or an `ALIAS` library
8+
# with a different name since ``add_library(... ALIAS ...)`` does not work
9+
# for those targets.
10+
#
11+
# ::
12+
#
13+
# copy_imported_target_properties(<source-target> <destination-target>)
14+
#
15+
# The function copies all the `INTERFACE*` and `IMPORTED*` target
16+
# properties from `<source-target>` to `<destination-target>`.
17+
#
18+
# The function uses the `IMPORTED_CONFIGURATIONS` property to determine
19+
# which configuration-dependent properties should be copied
20+
# (`IMPORTED_LOCATION_<CONFIG>`, etc...)
21+
#
22+
# Example:
23+
#
24+
# Internally the CMake project of ZLIB builds the ``zlib`` and
25+
# ``zlibstatic`` targets which can be exported in the ``ZLIB::`` namespace
26+
# with the ``install(EXPORT ...)`` command.
27+
#
28+
# The config-module will then create the import libraries ``ZLIB::zlib`` and
29+
# ``ZLIB::zlibstatic``. To use ``ZLIB::zlibstatic`` under the standard
30+
# ``ZLIB::ZLIB`` name we need to create the ``ZLIB::ZLIB`` imported library
31+
# and copy the appropriate properties:
32+
#
33+
# add_library(ZLIB::ZLIB STATIC IMPORTED)
34+
# copy_imported_target_properties(ZLIB::zlibstatic ZLIB::ZLIB)
35+
#
36+
37+
function(copy_imported_target_properties src_target dest_target)
38+
39+
set(config_dependent_props
40+
IMPORTED_IMPLIB
41+
IMPORTED_LINK_DEPENDENT_LIBRARIES
42+
IMPORTED_LINK_INTERFACE_LANGUAGES
43+
IMPORTED_LINK_INTERFACE_LIBRARIES
44+
IMPORTED_LINK_INTERFACE_MULTIPLICITY
45+
IMPORTED_LOCATION
46+
IMPORTED_NO_SONAME
47+
IMPORTED_SONAME
48+
)
49+
50+
# copy configuration-independent properties
51+
foreach(prop
52+
${config_dependent_props}
53+
IMPORTED_CONFIGURATIONS
54+
INTERFACE_AUTOUIC_OPTIONS
55+
INTERFACE_COMPILE_DEFINITIONS
56+
INTERFACE_COMPILE_FEATURES
57+
INTERFACE_COMPILE_OPTIONS
58+
INTERFACE_INCLUDE_DIRECTORIES
59+
INTERFACE_LINK_LIBRARIES
60+
INTERFACE_POSITION_INDEPENDENT_CODE
61+
INTERFACE_SOURCES
62+
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
63+
)
64+
get_property(is_set TARGET ${src_target} PROPERTY ${prop} SET)
65+
if(is_set)
66+
get_target_property(v ${src_target} ${prop})
67+
set_target_properties(${dest_target} PROPERTIES ${prop} "${v}")
68+
# message(STATUS "set_target_properties(${dest_target} PROPERTIES ${prop} ${v})")
69+
endif()
70+
endforeach()
71+
72+
# copy configuration-dependent properties
73+
get_target_property(imported_configs ${src_target}
74+
IMPORTED_CONFIGURATIONS)
75+
76+
foreach(config ${imported_configs})
77+
foreach(prop_prefix ${config_dependent_props})
78+
set(prop ${prop_prefix}_${config})
79+
get_property(is_set TARGET ${src_target} PROPERTY ${prop} SET)
80+
if(is_set)
81+
get_target_property(v ${src_target} ${prop})
82+
set_target_properties(${dest_target}
83+
PROPERTIES ${prop} "${v}")
84+
# message(STATUS "set_target_properties(${dest_target} PROPERTIES ${prop} ${v})")
85+
endif()
86+
endforeach()
87+
endforeach()
88+
endfunction()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
2+
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
3+
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
4+
5+
if (NOT DEFINED CMAKE_INSTALL_PREFIX)
6+
set (CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@")
7+
endif ()
8+
message(${CMAKE_INSTALL_PREFIX})
9+
10+
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
11+
string(REGEX REPLACE "\n" ";" files "${files}")
12+
foreach(file ${files})
13+
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
14+
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
15+
exec_program(
16+
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
17+
OUTPUT_VARIABLE rm_out
18+
RETURN_VALUE rm_retval
19+
)
20+
if(NOT "${rm_retval}" STREQUAL 0)
21+
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
22+
endif(NOT "${rm_retval}" STREQUAL 0)
23+
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
24+
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
25+
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
26+
endforeach(file)

0 commit comments

Comments
 (0)