2023-03-11 22:10:18 +08:00
include ( AXPlatform )
2022-05-19 10:54:42 +08:00
2023-04-02 16:04:19 +08:00
if ( NOT CMAKE_GENERATOR MATCHES "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 ( )
2022-08-11 15:41:10 +08:00
function ( ax_link_cxx_prebuilt APP_NAME AX_ROOT_DIR AX_PREBUILT_DIR )
2023-03-04 15:38:39 +08:00
load_cache ( "${AX_ROOT_DIR}/${AX_PREBUILT_DIR}" EXCLUDE thirdparty_LIB_DEPENDS )
2023-02-24 19:33:26 +08:00
message ( STATUS "AX_ENABLE_MSEDGE_WEBVIEW2=${AX_ENABLE_MSEDGE_WEBVIEW2}" )
message ( STATUS "AX_ENABLE_MFMEDIA=${AX_ENABLE_MFMEDIA}" )
message ( STATUS "AX_ENABLE_EXT_IMGUI=${AX_ENABLE_EXT_IMGUI}" )
2023-09-12 01:06:28 +08:00
message ( STATUS "AX_ENABLE_EXT_INSPECTOR=${AX_ENABLE_EXT_INSPECTOR}" )
2023-02-24 19:33:26 +08:00
message ( STATUS "AX_ENABLE_EXT_FAIRYGUI=${AX_ENABLE_EXT_FAIRYGUI}" )
message ( STATUS "AX_ENABLE_EXT_LIVE2D=${AX_ENABLE_EXT_LIVE2D}" )
message ( STATUS "AX_ENABLE_EXT_GUI=${AX_ENABLE_EXT_GUI}" )
message ( STATUS "AX_ENABLE_EXT_ASSETMANAGER=${AX_ENABLE_EXT_ASSETMANAGER}" )
message ( STATUS "AX_ENABLE_EXT_PARTICLE3D=${AX_ENABLE_EXT_PARTICLE3D}" )
message ( STATUS "AX_ENABLE_EXT_PHYSICS_NODE=${AX_ENABLE_EXT_PHYSICS_NODE}" )
message ( STATUS "AX_ENABLE_EXT_SPINE=${AX_ENABLE_EXT_SPINE}" )
message ( STATUS "AX_ENABLE_EXT_EFFEKSEER=${AX_ENABLE_EXT_EFFEKSEER}" )
message ( STATUS "AX_ENABLE_EXT_LUA=${AX_ENABLE_EXT_LUA}" )
2023-09-02 19:56:50 +08:00
target_compile_definitions ( ${ APP_NAME } PUBLIC AX_GLES_PROFILE= ${ AX_GLES_PROFILE } )
2023-02-24 19:33:26 +08:00
ax_config_pred ( ${ APP_NAME } AX_ENABLE_MFMEDIA )
ax_config_pred ( ${ APP_NAME } AX_ENABLE_MSEDGE_WEBVIEW2 )
2022-05-19 10:54:42 +08:00
if ( NOT AX_USE_SHARED_PREBUILT )
target_compile_definitions ( ${ APP_NAME }
2022-07-16 10:43:05 +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 }
2023-03-11 22:10:18 +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 / p r e b u i l t / $ { p l a t f o r m _ n a m e } / $ { 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 / $ { p l a t f o r m _ n a m e } / $ { 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 / j p e g - t u r b o / p r e b u i l t / $ { p l a t f o r m _ n a m e } / $ { 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 / c u r l / p r e b u i l t / $ { p l a t f o r m _ n a m e } / $ { 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
)
2023-03-11 22:10:18 +08:00
# Linking platform libs
2022-11-17 21:26:17 +08:00
if ( WINDOWS )
target_link_libraries ( ${ APP_NAME } winmm Version )
else ( )
2022-11-17 23:20:26 +08:00
target_link_libraries ( ${ APP_NAME } X11 fontconfig glib-2.0 gtk-3 gobject-2.0 )
2022-11-17 21:26:17 +08:00
endif ( )
2022-05-19 10:54:42 +08:00
# Linking engine and thirdparty libs
2022-11-17 21:26:17 +08:00
set ( LIBS
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
r e c a s t
b u l l e t
w e b p
p u g i x m l
x x h a s h
2023-07-02 01:08:04 +08:00
f a s t l z
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
2023-05-10 13:45:40 +08:00
a s t c e n c
2022-08-11 15:41:10 +08:00
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
)
2023-02-24 19:33:26 +08:00
if ( AX_ENABLE_EXT_IMGUI )
list ( APPEND LIBS "ImGui" )
endif ( )
2023-09-12 01:06:28 +08:00
if ( AX_ENABLE_EXT_INSPECTOR )
list ( APPEND LIBS "Inspector" )
endif ( )
2023-02-24 19:33:26 +08:00
2022-11-17 21:26:17 +08:00
if ( WINDOWS )
target_link_libraries ( ${ APP_NAME }
$ { L I B S }
z l i b
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
l i b c u r l _ i m p
O p e n A L 3 2
)
else ( )
target_link_libraries ( ${ APP_NAME }
$ { L I B S }
z
j p e g
c u r l
2022-11-17 23:20:26 +08:00
s s l
c r y p t o
2022-11-17 21:26:17 +08:00
o p e n a l
)
endif ( )
2022-05-19 10:54:42 +08:00
# Copy dlls to app bin dir
2022-11-17 21:26:17 +08:00
if ( WINDOWS )
set ( ssl_dll_suffix "" )
if ( WIN64 )
set ( ssl_dll_suffix "-${ARCH_ALIAS}" )
endif ( )
2022-05-19 10:54:42 +08:00
add_custom_command ( TARGET ${ APP_NAME } POST_BUILD
2022-11-17 21:26:17 +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
2023-06-20 20:48:52 +08:00
" $ { 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 / $ { p l a t f o r m _ n a m e } / $ { 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 / $ { p l a t f o r m _ n a m e } / $ { 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 / $ { p l a t f o r m _ n a m e } / $ { 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 / $ { p l a t f o r m _ n a m e } / $ { A R C H _ A L I A S } / z l i b 1 . d l l "
2022-11-17 21:26:17 +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 "
$ < T A R G E T _ F I L E _ D I R : $ { A P P _ N A M E } > )
2022-05-19 10:54:42 +08:00
2023-01-06 18:38:16 +08:00
if ( BUILD_SHARED_LIBS )
add_custom_command ( TARGET ${ ax_target } 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 } / $ { 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 } g l a d . d l l "
" $ { 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 } g l f w . d l l "
" $ { 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 u g i x m l . d l l "
" $ { 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 } f r e e t y p e . d l l "
" $ { 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 } a x m o l . d l l "
" $ { 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 } c o c o s t u d i o . d l l "
" $ { 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 } G U I . d l l "
" $ { 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 a r t i c l e 3 d . d l l "
" $ { 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 h y s i c s - n o d e s . d l l "
" $ { 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 } s p i n e . d l l "
" $ { 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 } a s s e t s - m a n a g 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 } > )
endif ( )
2022-11-17 21:26:17 +08:00
# Copy windows angle binaries
2023-09-02 19:56:50 +08:00
if ( AX_GLES_PROFILE )
2022-11-16 17:03:39 +08:00
add_custom_command ( TARGET ${ APP_NAME } POST_BUILD
2022-11-17 21:26:17 +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
2023-06-20 20:48:52 +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 / $ { p l a t f o r m _ n a m e } / $ { 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 / $ { p l a t f o r m _ n a m e } / $ { 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 / $ { p l a t f o r m _ n a m e } / $ { 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 } >
)
2022-11-17 21:26:17 +08:00
endif ( )
if ( AX_ENABLE_MSEDGE_WEBVIEW2 )
2023-04-02 16:04:19 +08:00
if ( CMAKE_GENERATOR MATCHES "Ninja" )
2022-11-17 21:26:17 +08:00
target_link_libraries ( ${ APP_NAME } ${ AX_ROOT_DIR } / ${ AX_PREBUILT_DIR } /packages/Microsoft.Web.WebView2/build/native/ ${ ARCH_ALIAS } /WebView2Loader.dll.lib )
target_include_directories ( ${ APP_NAME } PRIVATE ${ AX_ROOT_DIR } / ${ AX_PREBUILT_DIR } /packages/Microsoft.Web.WebView2/build/native/include )
add_custom_command ( TARGET ${ APP_NAME } POST_BUILD
2023-04-02 16:04:19 +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 } / $ { A X _ P R E B U I L T _ D I R } / 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 } >
)
2022-11-17 21:26:17 +08:00
else ( )
target_link_libraries ( ${ APP_NAME } ${ AX_ROOT_DIR } / ${ AX_PREBUILT_DIR } /packages/Microsoft.Web.WebView2/build/native/Microsoft.Web.WebView2.targets )
endif ( )
2022-05-19 10:54:42 +08:00
endif ( )
endif ( )
2023-09-02 19:56:50 +08:00
# prebuilt, need copy axslc folder to target output directory
get_target_property ( rt_output ${ APP_NAME } RUNTIME_OUTPUT_DIRECTORY )
ax_sync_target_res ( ${ APP_NAME } LINK_TO "${rt_output}/${CMAKE_CFG_INTDIR}/axslc" FOLDERS ${ GLSLCC_OUT_DIR } SYNC_TARGET_ID axslc )
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 )
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-11-17 23:20:26 +08:00
ax_link_cxx_prebuilt ( ${ APP_NAME } ${ AX_ROOT_DIR } ${ AX_PREBUILT_DIR } )
2022-11-17 21:26:17 +08:00
if ( WINDOWS )
2023-04-02 16:04:19 +08:00
if ( MSVC )
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 } / $ { 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 "
$ < T A R G E T _ F I L E _ D I R : $ { A P P _ N A M E } > )
else ( )
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 } / $ { A X _ P R E B U I L T _ D I R } / b i n / $ < C O N F I G > / p l a i n l u a . d l l "
$ < T A R G E T _ F I L E _ D I R : $ { A P P _ N A M E } > )
endif ( )
2022-11-17 21:26:17 +08:00
endif ( )
2022-08-11 15:41:10 +08:00
endfunction ( ax_link_lua_prebuilt )