-
Notifications
You must be signed in to change notification settings - Fork 342
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use modern cmake on all external prebuilt libs (#326)
* add part cmake files * correct header include error * add bullet cmake script * add others micro ext libs * fix can't found libs * lua/js tests project works on mac * ios use external * git mv include/freetype to include/freetype2 linux * try to works on android * correct most win32 libs * fix android cpp external link error * export lua.h header * fix zlib error on ios * unzip depend on zlib * can't set properties as cmake doc said * cpp tests works on win32 * tests project works on win32 * fix use external error on linux * cpp-tests works on linux * change 4 vs2017 buildtype to 2 build type folder
- Loading branch information
Showing
101 changed files
with
1,241 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.vscode | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
cmake_minimum_required(VERSION 3.6) | ||
|
||
set(lib_name box2d) | ||
set(target_name ext_${lib_name}) | ||
|
||
project(${lib_name}) | ||
|
||
include(../cmake/CocosExternalConfig.cmake) | ||
|
||
add_library(${target_name} STATIC IMPORTED GLOBAL) | ||
|
||
set_target_properties(${target_name} PROPERTIES | ||
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/include" | ||
) | ||
|
||
if(WINDOWS) | ||
set_target_properties(${target_name} PROPERTIES | ||
# need use absolutely path | ||
IMPORTED_LOCATION "${platform_spec_path}/lib${lib_name}.lib" | ||
) | ||
else() | ||
set_target_properties(${target_name} PROPERTIES | ||
IMPORTED_LOCATION "${platform_spec_path}/lib${lib_name}.a" | ||
) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
cmake_minimum_required(VERSION 3.6) | ||
project(external) | ||
|
||
add_library(external empty.cpp) | ||
|
||
add_subdirectory(Box2D) | ||
add_subdirectory(chipmunk) | ||
add_subdirectory(freetype2) | ||
add_subdirectory(recast) | ||
add_subdirectory(bullet) | ||
add_subdirectory(jpeg) | ||
add_subdirectory(openssl) | ||
add_subdirectory(tiff) | ||
add_subdirectory(uv) | ||
add_subdirectory(webp) | ||
add_subdirectory(websockets) | ||
add_subdirectory(tinyxml2) | ||
add_subdirectory(xxhash) | ||
add_subdirectory(xxtea) | ||
add_subdirectory(clipper) | ||
add_subdirectory(edtaa3func) | ||
add_subdirectory(ConvertUTF) | ||
add_subdirectory(poly2tri) | ||
add_subdirectory(md5) | ||
|
||
target_link_libraries(external | ||
ext_box2d | ||
ext_chipmunk | ||
ext_freetype | ||
ext_recast | ||
ext_jpeg | ||
ext_uv | ||
ext_webp | ||
ext_bullet | ||
ext_ssl | ||
ext_crypto | ||
ext_tiff | ||
ext_websockets | ||
ext_tinyxml2 | ||
ext_xxhash | ||
ext_xxtea | ||
ext_clipper | ||
ext_edtaa3func | ||
ext_convertUTF | ||
ext_poly2tri | ||
ext_md5 | ||
) | ||
|
||
# use lua/js specific libs by property to prevent conflict | ||
if(BUILD_JS_LIBS) | ||
add_subdirectory(spidermonkey) | ||
set_property(TARGET external APPEND PROPERTY | ||
CC_JS_DEPEND ext_spidermonkey | ||
) | ||
endif() | ||
if(BUILD_LUA_LIBS) | ||
add_subdirectory(lua/lua) | ||
add_subdirectory(lua/luajit) | ||
add_subdirectory(lua/tolua) | ||
add_subdirectory(lua/luasocket) | ||
set_property(TARGET external APPEND PROPERTY | ||
CC_LUA_DEPEND ext_lua ext_luajit ext_tolua ext_luasocket | ||
) | ||
endif() | ||
|
||
if(NOT LINUX) | ||
add_subdirectory(curl) | ||
add_subdirectory(png) | ||
target_link_libraries(external | ||
ext_curl | ||
ext_png | ||
) | ||
endif(NOT LINUX) | ||
|
||
if(LINUX) | ||
add_subdirectory(linux-specific/fmod) | ||
target_link_libraries(external | ||
ext_fmod | ||
) | ||
endif() | ||
|
||
if(ANDROID) | ||
add_subdirectory(android-specific/cpufeatures) | ||
add_subdirectory(android-specific/pvmp3dec) | ||
add_subdirectory(android-specific/tremolo) | ||
target_link_libraries(external | ||
ext_cpufeatures | ||
ext_pvmp3dec | ||
ext_tremolo | ||
) | ||
endif() | ||
|
||
if(WINDOWS) | ||
# sqlite3 prebuilt only existed at windows | ||
add_subdirectory(sqlite3) | ||
add_subdirectory(win32-specific/gles) | ||
add_subdirectory(win32-specific/icon) | ||
add_subdirectory(win32-specific/MP3Decoder) | ||
add_subdirectory(win32-specific/OggDecoder) | ||
add_subdirectory(win32-specific/OpenalSoft) | ||
target_link_libraries(external | ||
ext_sqlite3 | ||
ext_gles | ||
ext_icon | ||
ext_MP3Decoder | ||
ext_OggDecoder | ||
ext_OpenalSoft | ||
) | ||
endif() | ||
|
||
if(WINDOWS OR MACOSX OR LINUX) | ||
add_subdirectory(glfw3) | ||
target_link_libraries(external | ||
ext_glfw3 | ||
) | ||
endif() | ||
|
||
if(MACOSX OR ANDROID OR WINDOWS) | ||
add_subdirectory(zlib) | ||
target_link_libraries(external | ||
ext_zlib | ||
) | ||
endif() | ||
|
||
# unzip depend on zlib | ||
add_subdirectory(unzip) | ||
target_link_libraries(external ext_unzip) | ||
|
||
# put "external" into External folder, too | ||
set_target_properties(external | ||
PROPERTIES | ||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" | ||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" | ||
FOLDER "External" | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
cmake_minimum_required(VERSION 3.6) | ||
|
||
set(lib_name convertUTF) | ||
set(target_name ext_${lib_name}) | ||
|
||
project(${lib_name}) | ||
|
||
add_library(${target_name} STATIC | ||
ConvertUTF.c | ||
ConvertUTFWrapper.cpp | ||
) | ||
|
||
target_include_directories(${target_name} PUBLIC .) | ||
|
||
set_target_properties(${target_name} | ||
PROPERTIES | ||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" | ||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" | ||
FOLDER "External" | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## cocos2d-x externl | ||
|
||
add CMake Script for all platforms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
cmake_minimum_required(VERSION 3.6) | ||
|
||
set(lib_name cpufeatures) | ||
set(target_name ext_${lib_name}) | ||
|
||
project(lib_name) | ||
|
||
# CMake from android SDK set ANDROID_NDK instead of CMAKE_ANDROID_NDK | ||
if(ANDROID_NDK) | ||
add_library(${target_name} ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c) | ||
target_include_directories(${target_name} PUBLIC ${ANDROID_NDK}/sources/android/cpufeatures) | ||
else() | ||
add_library(${target_name} ${CMAKE_ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c) | ||
target_include_directories(${target_name} PUBLIC ${CMAKE_ANDROID_NDK}/sources/android/cpufeatures) | ||
endif() | ||
|
||
target_link_libraries(${target_name} dl) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,52 @@ | ||
set(PVMP3DEC_SRC | ||
./src/pvmp3_normalize.cpp | ||
./src/pvmp3_alias_reduction.cpp | ||
./src/pvmp3_crc.cpp | ||
./src/pvmp3_decode_header.cpp | ||
./src/pvmp3_decode_huff_cw.cpp | ||
./src/pvmp3_getbits.cpp | ||
./src/pvmp3_dequantize_sample.cpp | ||
./src/pvmp3_framedecoder.cpp | ||
./src/pvmp3_get_main_data_size.cpp | ||
./src/pvmp3_get_side_info.cpp | ||
./src/pvmp3_get_scale_factors.cpp | ||
./src/pvmp3_mpeg2_get_scale_data.cpp | ||
./src/pvmp3_mpeg2_get_scale_factors.cpp | ||
./src/pvmp3_mpeg2_stereo_proc.cpp | ||
./src/pvmp3_huffman_decoding.cpp | ||
./src/pvmp3_huffman_parsing.cpp | ||
./src/pvmp3_tables.cpp | ||
./src/pvmp3_imdct_synth.cpp | ||
./src/pvmp3_mdct_6.cpp | ||
./src/pvmp3_dct_6.cpp | ||
./src/pvmp3_poly_phase_synthesis.cpp | ||
./src/pvmp3_equalizer.cpp | ||
./src/pvmp3_seek_synch.cpp | ||
./src/pvmp3_stereo_proc.cpp | ||
./src/pvmp3_reorder.cpp | ||
./src/pvmp3_polyphase_filter_window.cpp | ||
./src/pvmp3_mdct_18.cpp | ||
./src/pvmp3_dct_9.cpp | ||
./src/pvmp3_dct_16.cpp | ||
) | ||
cmake_minimum_required(VERSION 3.6) | ||
|
||
set(lib_name pvmp3dec) | ||
set(target_name ext_${lib_name}) | ||
|
||
project(${lib_name}) | ||
|
||
add_library(pvmp3dec STATIC | ||
${PVMP3DEC_SRC} | ||
set(${target_name}_src | ||
./src/pvmp3_normalize.cpp | ||
./src/pvmp3_alias_reduction.cpp | ||
./src/pvmp3_crc.cpp | ||
./src/pvmp3_decode_header.cpp | ||
./src/pvmp3_decode_huff_cw.cpp | ||
./src/pvmp3_getbits.cpp | ||
./src/pvmp3_dequantize_sample.cpp | ||
./src/pvmp3_framedecoder.cpp | ||
./src/pvmp3_get_main_data_size.cpp | ||
./src/pvmp3_get_side_info.cpp | ||
./src/pvmp3_get_scale_factors.cpp | ||
./src/pvmp3_mpeg2_get_scale_data.cpp | ||
./src/pvmp3_mpeg2_get_scale_factors.cpp | ||
./src/pvmp3_mpeg2_stereo_proc.cpp | ||
./src/pvmp3_huffman_decoding.cpp | ||
./src/pvmp3_huffman_parsing.cpp | ||
./src/pvmp3_tables.cpp | ||
./src/pvmp3_imdct_synth.cpp | ||
./src/pvmp3_mdct_6.cpp | ||
./src/pvmp3_dct_6.cpp | ||
./src/pvmp3_poly_phase_synthesis.cpp | ||
./src/pvmp3_equalizer.cpp | ||
./src/pvmp3_seek_synch.cpp | ||
./src/pvmp3_stereo_proc.cpp | ||
./src/pvmp3_reorder.cpp | ||
./src/pvmp3_polyphase_filter_window.cpp | ||
./src/pvmp3_mdct_18.cpp | ||
./src/pvmp3_dct_9.cpp | ||
./src/pvmp3_dct_16.cpp | ||
) | ||
|
||
include_directories(include) | ||
include_directories(src) | ||
add_library(${target_name} STATIC | ||
${${target_name}_src} | ||
) | ||
|
||
set_target_properties(pvmp3dec | ||
target_include_directories(${target_name} PUBLIC include) | ||
target_include_directories(${target_name} PUBLIC src) | ||
set_target_properties(${target_name} | ||
PROPERTIES | ||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" | ||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" | ||
FOLDER "External" | ||
) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.