2022-05-19 10:54:42 +08:00
option ( AX_ENABLE_MSEDGE_WEBVIEW2 "Enable msedge webview2" TRUE )
if ( NOT ( "${CMAKE_GENERATOR_PLATFORM}" STREQUAL "Win32" ) )
set ( WIN64 TRUE )
set ( ARCH_ALIAS "x64" )
else ( )
set ( WIN32 TRUE )
set ( ARCH_ALIAS "x86" )
endif ( )
if ( NOT CMAKE_GENERATOR STREQUAL "Ninja" )
2022-08-19 19:52:10 +08:00
set ( BUILD_CONFIG_DIR "\$\(Configuration\)/" )
else ( )
set ( BUILD_CONFIG_DIR "" )
2022-05-19 10:54:42 +08:00
endif ( )
message ( STATUS "AX_ENABLE_MSEDGE_WEBVIEW2=${AX_ENABLE_MSEDGE_WEBVIEW2}" )
2022-08-11 15:41:10 +08:00
function ( ax_link_cxx_prebuilt APP_NAME AX_ROOT_DIR AX_PREBUILT_DIR )
2022-05-19 10:54:42 +08:00
if ( NOT AX_USE_SHARED_PREBUILT )
target_compile_definitions ( ${ APP_NAME }
2022-07-15 19:17:01 +08:00
P R I V A T E A X _ S T A T I C = 1
2022-05-19 10:54:42 +08:00
)
endif ( )
target_include_directories ( ${ APP_NAME }
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / l u a
P R I V A T E $ { A X _ R O O T _ D I R } / e x t e n s i o n s / s c r i p t i n g / l u a - b i n d i n g s / m a n u a l
P R I V A T E $ { A X _ R O O T _ D I R }
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y
P R I V A T E $ { A X _ R O O T _ D I R } / e x t e n s i o n s
P R I V A T E $ { A X _ R O O T _ D I R } / c o r e
P R I V A T E $ { A X _ R O O T _ D I R } / c o r e / p l a t f o r m
P R I V A T E $ { A X _ R O O T _ D I R } / c o r e / b a s e
P R I V A T E $ { A X _ R O O T _ D I R } / c o r e / a u d i o
P R I V A T E $ { A X _ R O O T _ D I R } / c o r e / p l a t f o r m / w i n 3 2
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / f m t / i n c l u d e
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / r o b i n - m a p / i n c l u d e
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / f r e e t y p e / i n c l u d e
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / g l f w / i n c l u d e / G L F W
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / b o x 2 d / i n c l u d e
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / c h i p m u n k / i n c l u d e
P R I V A T E $ { A X _ R O O T _ D I R } / $ { A X _ P R E B U I L T _ D I R } / e n g i n e / t h i r d p a r t y / f r e e t y p e / i n c l u d e
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / w e b p / s r c / w e b p
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / p u g i x m l
2022-08-19 19:52:10 +08:00
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / x x h a s h
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / C o n v e r t U T F
2022-05-19 10:54:42 +08:00
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / o p e n a l / i n c l u d e
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / o g g / i n c l u d e
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / g l a d / i n c l u d e
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / g l f w / i n c l u d e
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / p n g
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / u n z i p / .
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / l l h t t p / i n c l u d e
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / l u a / p l a i n l u a
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / l u a / t o l u a / .
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / l u a / l u a - c j s o n / .
P R I V A T E $ { A X _ R O O T _ D I R } / e x t e n s i o n s / c o c o s t u d i o
P R I V A T E $ { A X _ R O O T _ D I R } / e x t e n s i o n s / s p i n e / r u n t i m e / i n c l u d e
P R I V A T E $ { A X _ R O O T _ D I R } / e x t e n s i o n s / f a i r y g u i
P R I V A T E $ { A X _ R O O T _ D I R } / e x t e n s i o n s / G U I
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / z l i b / i n c l u d e
2022-08-19 10:12:06 +08:00
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / j p e g - t u r b o / i n c l u d e
2022-05-19 10:54:42 +08:00
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / o p e n s s l / i n c l u d e
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / c u r l / i n c l u d e
)
2022-08-19 19:52:10 +08:00
SET ( CONFIGURATION_SUBFOLDER "" )
2022-05-19 10:54:42 +08:00
target_link_directories ( ${ APP_NAME }
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / o p e n s s l / p r e b u i l t / w i n d o w s / $ { A R C H _ A L I A S }
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / z l i b / p r e b u i l t / w i n d o w s / $ { A R C H _ A L I A S }
2022-08-19 10:12:06 +08:00
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / j p e g - t u r b o / p r e b u i l t / w i n d o w s / $ { A R C H _ A L I A S }
2022-05-19 10:54:42 +08:00
P R I V A T E $ { A X _ R O O T _ D I R } / t h i r d p a r t y / c u r l / p r e b u i l t / w i n d o w s / $ { A R C H _ A L I A S }
2022-08-19 19:52:10 +08:00
P R I V A T E $ { A X _ R O O T _ D I R } / $ { A X _ P R E B U I L T _ D I R } / l i b # cmake will auto add suffix '/$(Configuration)', refer to https://github.com/Kitware/CMake/blob/master/Source/cmVisualStudio10TargetGenerator.cxx#L4145
2022-05-19 10:54:42 +08:00
)
# Linking OS libs
target_link_libraries ( ${ APP_NAME } winmm Version )
# Linking engine and thirdparty libs
target_link_libraries ( ${ APP_NAME }
2022-08-11 15:41:10 +08:00
s p i n e
p a r t i c l e 3 d
a s s e t s - m a n a g e r
c o c o s t u d i o
D r a g o n B o n e s
2022-10-01 16:24:52 +08:00
a x m o l
2022-08-11 15:41:10 +08:00
b o x 2 d
c h i p m u n k
f r e e t y p e
z l i b
r e c a s t
b u l l e t
j p e g - s t a t i c
l i b c r y p t o
l i b s s l
w e b p
p u g i x m l
x x h a s h
l z 4
2022-09-02 10:36:25 +08:00
c l i p p e r 2
2022-08-11 15:41:10 +08:00
C o n v e r t U T F
p o l y 2 t r i
a s t c
l i b c u r l _ i m p
O p e n A L 3 2
o g g
g l a d
g l f w
p n g
u n z i p
l l h t t p
p h y s i c s - n o d e s
2022-05-19 10:54:42 +08:00
)
# Copy dlls to app bin dir
# copy thirdparty dlls to target bin dir
# copy_thirdparty_dlls(${APP_NAME} $<TARGET_FILE_DIR:${APP_NAME}>)
set ( ssl_dll_suffix "" )
if ( WIN64 )
set ( ssl_dll_suffix "-${ARCH_ALIAS}" )
endif ( )
add_custom_command ( TARGET ${ APP_NAME } POST_BUILD
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y _ i f _ d i f f e r e n t
" $ { A X _ R O O T _ D I R } / t h i r d p a r t y / o p e n s s l / p r e b u i l t / w i n d o w s / $ { A R C H _ A L I A S } / l i b c r y p t o - 3 $ { s s l _ d l l _ s u f f i x } . d l l "
" $ { A X _ R O O T _ D I R } / t h i r d p a r t y / o p e n s s l / p r e b u i l t / w i n d o w s / $ { A R C H _ A L I A S } / l i b s s l - 3 $ { s s l _ d l l _ s u f f i x } . d l l "
" $ { A X _ R O O T _ D I R } / t h i r d p a r t y / c u r l / p r e b u i l t / w i n d o w s / $ { A R C H _ A L I A S } / l i b c u r l . d l l "
" $ { A X _ R O O T _ D I R } / t h i r d p a r t y / z l i b / p r e b u i l t / w i n d o w s / $ { A R C H _ A L I A S } / z l i b 1 . d l l "
2022-08-19 19:52:10 +08:00
" $ { A X _ R O O T _ D I R } / $ { A X _ P R E B U I L T _ D I R } / b i n / $ { B U I L D _ C O N F I G _ D I R } O p e n A L 3 2 . d l l "
2022-05-19 10:54:42 +08:00
$ < T A R G E T _ F I L E _ D I R : $ { A P P _ N A M E } > )
# Copy windows angle binaries
if ( AX_USE_COMPAT_GL )
add_custom_command ( TARGET ${ APP_NAME } POST_BUILD
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y _ i f _ d i f f e r e n t
2022-09-12 22:46:35 +08:00
$ { A X _ R O O T _ D I R } / t h i r d p a r t y / a n g l e / p r e b u i l t / w i n d o w s / $ { A R C H _ A L I A S } / l i b G L E S v 2 . d l l
$ { A X _ R O O T _ D I R } / t h i r d p a r t y / a n g l e / p r e b u i l t / w i n d o w s / $ { A R C H _ A L I A S } / l i b E G L . d l l
$ { A X _ R O O T _ D I R } / t h i r d p a r t y / a n g l e / p r e b u i l t / w i n d o w s / $ { A R C H _ A L I A S } / d 3 d c o m p i l e r _ 4 7 . d l l
2022-05-19 10:54:42 +08:00
$ < T A R G E T _ F I L E _ D I R : $ { A P P _ N A M E } >
)
endif ( )
if ( AX_ENABLE_MSEDGE_WEBVIEW2 )
if ( CMAKE_GENERATOR STREQUAL "Ninja" )
target_link_libraries ( ${ APP_NAME } ${ AX_ROOT_DIR } /build/packages/Microsoft.Web.WebView2/build/native/ ${ ARCH_ALIAS } /WebView2Loader.dll.lib )
target_include_directories ( ${ APP_NAME } ${ AX_ROOT_DIR } /build/packages/Microsoft.Web.WebView2/build/native/include )
2022-08-11 15:41:10 +08:00
add_custom_command ( TARGET ${ ax_target } POST_BUILD
2022-05-19 10:54:42 +08:00
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y _ i f _ d i f f e r e n t
" $ { A X _ R O O T _ D I R } / b u i l d / p a c k a g e s / M i c r o s o f t . W e b . W e b V i e w 2 / b u i l d / n a t i v e / $ { A R C H _ A L I A S } / W e b V i e w 2 L o a d e r . d l l "
$ < T A R G E T _ F I L E _ D I R : $ { A P P _ N A M E } >
)
else ( )
target_link_libraries ( ${ APP_NAME } ${ AX_ROOT_DIR } /build/packages/Microsoft.Web.WebView2/build/native/Microsoft.Web.WebView2.targets )
endif ( )
endif ( )
2022-08-11 15:41:10 +08:00
endfunction ( ax_link_cxx_prebuilt )
2022-05-19 10:54:42 +08:00
2022-08-11 15:41:10 +08:00
function ( ax_link_lua_prebuilt APP_NAME AX_ROOT_DIR AX_PREBUILT_DIR )
ax_link_cxx_prebuilt ( ${ APP_NAME } ${ AX_ROOT_DIR } ${ AX_PREBUILT_DIR } )
2022-05-19 10:54:42 +08:00
if ( NOT AX_USE_SHARED_PREBUILT )
target_compile_definitions ( ${ APP_NAME }
P R I V A T E _ U S R L U A S T A T I C = 1
)
endif ( )
2022-08-08 18:02:17 +08:00
target_link_libraries ( ${ APP_NAME } axlua lua-cjson tolua plainlua )
2022-05-19 10:54:42 +08:00
add_custom_command ( TARGET ${ APP_NAME } POST_BUILD
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y _ i f _ d i f f e r e n t
2022-08-19 19:52:10 +08:00
" $ { A X _ R O O T _ D I R } / $ { A X _ P R E B U I L T _ D I R } / b i n / $ { B U I L D _ C O N F I G _ D I R } p l a i n l u a . d l l "
2022-05-19 10:54:42 +08:00
$ < T A R G E T _ F I L E _ D I R : $ { A P P _ N A M E } > )
2022-08-11 15:41:10 +08:00
endfunction ( ax_link_lua_prebuilt )