2016-10-11 16:27:49 +08:00
include ( vcpkg_common_functions )
2016-12-08 07:21:30 +08:00
set ( SOURCE_PATH ${ CURRENT_BUILDTREES_DIR } /src/freeglut-3.0.0 )
2016-10-11 16:27:49 +08:00
vcpkg_download_distfile ( ARCHIVE
2019-04-26 14:37:20 +08:00
U R L S " h t t p s : / / s o u r c e f o r g e . n e t / p r o j e c t s / f r e e g l u t / f i l e s / 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 / d o w n l o a d "
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
)
vcpkg_extract_source_archive ( ${ ARCHIVE } )
2018-04-27 18:15:17 +08:00
if ( VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" )
message ( "Freeglut currently requires the following libraries from the system package manager:\n opengl\n glu\n libx11\n\nThese can be installed on Ubuntu systems via apt-get install libxi-dev libgl1-mesa-dev libglu1-mesa-dev mesa-common-dev" )
endif ( )
2017-07-01 05:38:26 +08:00
# disable debug suffix, because FindGLUT.cmake from CMake 3.8 doesn't support it
file ( READ ${ SOURCE_PATH } /CMakeLists.txt FREEGLUT_CMAKELISTS )
string ( REPLACE "SET( CMAKE_DEBUG_POSTFIX \" d\ " )"
" \ #SET( CMAKE_DEBUG_POSTFIX \"d\" )" FREEGLUT_CMAKELISTS "${FREEGLUT_CMAKELISTS}")
file ( WRITE ${ SOURCE_PATH } /CMakeLists.txt "${FREEGLUT_CMAKELISTS}" )
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 )
string ( REGEX REPLACE "\" freeglut[_a-z]+.lib\ ""
" \ " 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 } " )
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 }
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" )
file ( RENAME ${ CURRENT_PACKAGES_DIR } /lib/freeglut_static.lib ${ CURRENT_PACKAGES_DIR } /lib/freeglut.lib )
file ( RENAME ${ CURRENT_PACKAGES_DIR } /debug/lib/freeglut_static.lib ${ CURRENT_PACKAGES_DIR } /debug/lib/freeglut.lib )
endif ( )
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 } )