2016-10-11 16:27:49 +08:00
include ( vcpkg_common_functions )
2019-10-08 01:35:13 +08:00
2016-10-11 16:27:49 +08:00
vcpkg_download_distfile ( ARCHIVE
2019-05-09 04:47:32 +08:00
U R L S " h t t p : / / d o w n l o a d s . s o u r c e f o r g e . n e t / p r o j e c t / f r e e g l u t / f r e e g l u t / 3 . 0 . 0 / f r e e g l u t - 3 . 0 . 0 . t a r . g z "
2016-10-11 16:27:49 +08:00
F I L E N A M E " f r e e g l u t - 3 . 0 . 0 . t a r . g z "
S H A 5 1 2 9 c 4 5 d 5 b 2 0 3 b 2 6 a 7 f f 9 2 3 3 1 b 3 e 0 8 0 a 4 8 e 8 0 6 c 9 2 f b b e 7 c 6 5 d 9 2 6 2 d d 1 8 c 3 9 c d 6 e f d a d 8 a 7 9 5 a 8 0 f 4 9 9 a 2 d 2 3 d f 8 4 b 4 9 0 9 d b d 7 c 1 b a b 2 0 d 7 d d 3 5 5 5 d 3 d 8 8 7 8 2 c e 9 d d 1 5 b 0
)
2019-05-09 04:47:32 +08:00
vcpkg_extract_source_archive_ex (
O U T _ S O U R C E _ P A T H S O U R C E _ P A T H
A R C H I V E $ { A R C H I V E }
P A T C H E S
u s e _ t a r g e t s _ t o _ e x p o r t _ x 1 1 _ d e p e n d e n c y . p a t c h
m a c O S _ X q u a r t z . p a t c h
)
2016-10-11 16:27:49 +08:00
2018-04-27 18:15:17 +08:00
if ( VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" )
2019-05-10 02:45:23 +08:00
message ( "Freeglut currently requires the following libraries from the system package manager:\n opengl\n glu\n libx11\n xrandr\n xi\n xxf86vm\n\nThese can be installed on Ubuntu systems via apt-get install libxi-dev libgl1-mesa-dev libglu1-mesa-dev mesa-common-dev libxrandr-dev libxxf86vm-dev\nOn macOS Xquartz is required." )
2018-04-27 18:15:17 +08:00
endif ( )
2016-11-16 09:39:33 +08:00
if ( VCPKG_LIBRARY_LINKAGE STREQUAL dynamic )
set ( FREEGLUT_STATIC OFF )
set ( FREEGLUT_DYNAMIC ON )
else ( )
set ( FREEGLUT_STATIC ON )
set ( FREEGLUT_DYNAMIC OFF )
endif ( )
2018-09-07 20:24:27 +08:00
# Patch header
file ( READ ${ SOURCE_PATH } /include/GL/freeglut_std.h FREEGLUT_STDH )
2019-05-09 04:47:32 +08:00
string ( REGEX REPLACE "\" freeglut_static.lib\ ""
2018-09-07 20:24:27 +08:00
" \ " f r e e g l u t . l i b \ " " F R E E G L U T _ S T D H " $ { F R E E G L U T _ S T D H } " )
2019-05-09 04:47:32 +08:00
string ( REGEX REPLACE "\" freeglut_staticd.lib\ ""
" \ " f r e e g l u t d . l i b \ " " F R E E G L U T _ S T D H " $ { F R E E G L U T _ S T D H } " )
2018-09-07 20:24:27 +08:00
file ( WRITE ${ SOURCE_PATH } /include/GL/freeglut_std.h "${FREEGLUT_STDH}" )
2016-10-11 16:27:49 +08:00
vcpkg_configure_cmake (
2016-12-08 07:21:30 +08:00
S O U R C E _ P A T H $ { S O U R C E _ P A T H }
2019-08-01 04:01:02 +08:00
P R E F E R _ N I N J A
2016-10-11 16:27:49 +08:00
O P T I O N S
2016-11-16 09:39:33 +08:00
- D F R E E G L U T _ B U I L D _ S T A T I C _ L I B S = $ { F R E E G L U T _ S T A T I C }
- D F R E E G L U T _ B U I L D _ S H A R E D _ L I B S = $ { F R E E G L U T _ D Y N A M I C }
2016-10-11 16:27:49 +08:00
- D F R E E G L U T _ B U I L D _ D E M O S = O F F
2016-11-16 09:39:33 +08:00
- D I N S T A L L _ P D B = O F F # Installing pdbs failed on debug static. So, disable it and let vcpkg_copy_pdbs() do it
2016-10-11 16:27:49 +08:00
)
vcpkg_install_cmake ( )
2017-11-08 21:55:46 +08:00
# Rename static lib (otherwise it's incompatible with FindGLUT.cmake)
2018-04-27 18:15:17 +08:00
if ( VCPKG_LIBRARY_LINKAGE STREQUAL "static" )
if ( NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" )
2020-01-31 06:40:10 +08:00
if ( NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL release )
file ( RENAME ${ CURRENT_PACKAGES_DIR } /lib/freeglut_static.lib ${ CURRENT_PACKAGES_DIR } /lib/freeglut.lib )
endif ( )
if ( NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL debug )
file ( RENAME ${ CURRENT_PACKAGES_DIR } /debug/lib/freeglut_staticd.lib ${ CURRENT_PACKAGES_DIR } /debug/lib/freeglutd.lib )
endif ( )
2018-04-27 18:15:17 +08:00
endif ( )
2020-01-23 04:19:17 +08:00
vcpkg_replace_string (
" $ { C U R R E N T _ P A C K A G E S _ D I R } / i n c l u d e / G L / f r e e g l u t _ s t d . h "
" i f d e f F R E E G L U T _ S T A T I C "
" i f 1 / / i f d e f F R E E G L U T _ S T A T I C "
)
2017-11-08 21:55:46 +08:00
endif ( )
2017-07-01 05:38:26 +08:00
# Clean
2016-10-11 16:27:49 +08:00
file ( REMOVE_RECURSE ${ CURRENT_PACKAGES_DIR } /debug/include )
# Handle copyright
2016-12-08 07:21:30 +08:00
file ( COPY ${ SOURCE_PATH } /COPYING DESTINATION ${ CURRENT_PACKAGES_DIR } /share/freeglut )
2016-10-11 16:27:49 +08:00
file ( RENAME ${ CURRENT_PACKAGES_DIR } /share/freeglut/COPYING ${ CURRENT_PACKAGES_DIR } /share/freeglut/copyright )
2016-11-16 09:39:33 +08:00
2017-11-17 15:54:55 +08:00
vcpkg_copy_pdbs ( )
file ( COPY ${ CMAKE_CURRENT_LIST_DIR } /usage DESTINATION ${ CURRENT_PACKAGES_DIR } /share/ ${ PORT } )
2019-05-10 02:45:23 +08:00
if ( VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux" )
file ( COPY ${ CMAKE_CURRENT_LIST_DIR } /vcpkg-cmake-wrapper.cmake DESTINATION ${ CURRENT_PACKAGES_DIR } /share/glut )
endif ( )