axmol/cocos/scripting/js-bindings/CMakeLists.txt

180 lines
6.9 KiB
CMake
Raw Normal View History

2015-05-05 10:50:19 +08:00
#/****************************************************************************
# Copyright (c) 2014-2017 Chukong Technologies Inc.
2016-03-21 21:04:06 +08:00
#
2015-05-05 10:50:19 +08:00
# http://www.cocos2d-x.org
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# ****************************************************************************/
V3 android cmake support, add mac/ios support (#18646) * CMake build improvements * android cmake support * Enable proguard for cocos2d * examples & test cmake support * add android build type param to gradle.properties file * less warnings * update all android configs to recomended settings * fix network cmake error * fix js-tests cmake error * android build config, add cmake * android build config, add cmake * add lua share lib * android lua cmake build fix * fix * luajit test * run fail, still * fix js-warning * correct lua main include * lua test project cmake support android * try to add lua-template cmake support * lua template fix * js_tests support cmake on android * js-tests improve * cmake support js-template * test to realise prebuild * cmake improve, no feature * improve templates cmake * refactor cmake struct * correct cpp-tests cmake * cpp-templates cmake improve * typo fix * cmake struct refator * change default option * adapt new project struct * uniform cmake test style * add_dependencies to support make -j * little struct improve * little fix * adapt cmake bin dir * little improve about cmake version * change build all tests condition * add source_group for Xcode * add mark source files * add more mark source code * add template project to test * add macos info.plist template * add pak macos for all project * lua test icon fix * not consider lua project for now * modify pak method * add another ios toolchain * add ios system library * update ios toolchain, and reduce ios compile errors * reduce error * make ios engine lib compile pass * cpp-empty-test ios bundle * cpp-tests ios support * js-tests ios support * templates project support ios * fix the way of lua-tests package * try to fix lua-template on macOS * comment lua-template sim file * improve display on xcode * update cmake readme * check android compile again * fix android compile error * fix linux cmake res error * update deps version, for cmake * fix lua_template linux compile error * close android cmake support for now * review template android share library name * change PROP_BUILD_TOOLS_VERSION version to 27.0.1 * change android compile version * make `PROP_APP_PLATFORM` back, add comments for android native build * Revert "make `PROP_APP_PLATFORM` back, add comments for android native build" This reverts commit 272ddc19886891b9502cde070753a870c0fdb588.
2018-02-08 09:24:33 +08:00
set(cocos_root ${COCOS2DX_ROOT_PATH})
2015-05-05 10:50:19 +08:00
#platform
if(WIN32) # Win32
add_definitions(-D_USRJSSTATIC)
2015-05-05 10:50:19 +08:00
elseif(APPLE)# osx or ios
set(PLATFORM_HEADER manual/platform/ios/JavaScriptObjCBridge.h)
set(PLATFORM_SRC manual/platform/ios/JavaScriptObjCBridge.mm)
V3 android cmake support, add mac/ios support (#18646) * CMake build improvements * android cmake support * Enable proguard for cocos2d * examples & test cmake support * add android build type param to gradle.properties file * less warnings * update all android configs to recomended settings * fix network cmake error * fix js-tests cmake error * android build config, add cmake * android build config, add cmake * add lua share lib * android lua cmake build fix * fix * luajit test * run fail, still * fix js-warning * correct lua main include * lua test project cmake support android * try to add lua-template cmake support * lua template fix * js_tests support cmake on android * js-tests improve * cmake support js-template * test to realise prebuild * cmake improve, no feature * improve templates cmake * refactor cmake struct * correct cpp-tests cmake * cpp-templates cmake improve * typo fix * cmake struct refator * change default option * adapt new project struct * uniform cmake test style * add_dependencies to support make -j * little struct improve * little fix * adapt cmake bin dir * little improve about cmake version * change build all tests condition * add source_group for Xcode * add mark source files * add more mark source code * add template project to test * add macos info.plist template * add pak macos for all project * lua test icon fix * not consider lua project for now * modify pak method * add another ios toolchain * add ios system library * update ios toolchain, and reduce ios compile errors * reduce error * make ios engine lib compile pass * cpp-empty-test ios bundle * cpp-tests ios support * js-tests ios support * templates project support ios * fix the way of lua-tests package * try to fix lua-template on macOS * comment lua-template sim file * improve display on xcode * update cmake readme * check android compile again * fix android compile error * fix linux cmake res error * update deps version, for cmake * fix lua_template linux compile error * close android cmake support for now * review template android share library name * change PROP_BUILD_TOOLS_VERSION version to 27.0.1 * change android compile version * make `PROP_APP_PLATFORM` back, add comments for android native build * Revert "make `PROP_APP_PLATFORM` back, add comments for android native build" This reverts commit 272ddc19886891b9502cde070753a870c0fdb588.
2018-02-08 09:24:33 +08:00
elseif(ANDROID)
set(PLATFORM_HEADER manual/platform/android/CCJavascriptJavaBridge.h)
set(PLATFORM_SRC manual/platform/android/CCJavascriptJavaBridge.cpp)
2015-05-05 10:50:19 +08:00
endif()
V3 android cmake support, add mac/ios support (#18646) * CMake build improvements * android cmake support * Enable proguard for cocos2d * examples & test cmake support * add android build type param to gradle.properties file * less warnings * update all android configs to recomended settings * fix network cmake error * fix js-tests cmake error * android build config, add cmake * android build config, add cmake * add lua share lib * android lua cmake build fix * fix * luajit test * run fail, still * fix js-warning * correct lua main include * lua test project cmake support android * try to add lua-template cmake support * lua template fix * js_tests support cmake on android * js-tests improve * cmake support js-template * test to realise prebuild * cmake improve, no feature * improve templates cmake * refactor cmake struct * correct cpp-tests cmake * cpp-templates cmake improve * typo fix * cmake struct refator * change default option * adapt new project struct * uniform cmake test style * add_dependencies to support make -j * little struct improve * little fix * adapt cmake bin dir * little improve about cmake version * change build all tests condition * add source_group for Xcode * add mark source files * add more mark source code * add template project to test * add macos info.plist template * add pak macos for all project * lua test icon fix * not consider lua project for now * modify pak method * add another ios toolchain * add ios system library * update ios toolchain, and reduce ios compile errors * reduce error * make ios engine lib compile pass * cpp-empty-test ios bundle * cpp-tests ios support * js-tests ios support * templates project support ios * fix the way of lua-tests package * try to fix lua-template on macOS * comment lua-template sim file * improve display on xcode * update cmake readme * check android compile again * fix android compile error * fix linux cmake res error * update deps version, for cmake * fix lua_template linux compile error * close android cmake support for now * review template android share library name * change PROP_BUILD_TOOLS_VERSION version to 27.0.1 * change android compile version * make `PROP_APP_PLATFORM` back, add comments for android native build * Revert "make `PROP_APP_PLATFORM` back, add comments for android native build" This reverts commit 272ddc19886891b9502cde070753a870c0fdb588.
2018-02-08 09:24:33 +08:00
if(ANDROID OR IOS)
set(PLATFORM_HEADER
${PLATFORM_HEADER}
auto/jsb_cocos2dx_experimental_webView_auto.hpp
manual/experimental/jsb_cocos2dx_experimental_webView_manual.h
auto/jsb_cocos2dx_experimental_video_auto.hpp
manual/experimental/jsb_cocos2dx_experimental_video_manual.h
)
set(PLATFORM_SRC
${PLATFORM_SRC}
auto/jsb_cocos2dx_experimental_webView_auto.cpp
manual/experimental/jsb_cocos2dx_experimental_webView_manual.cpp
auto/jsb_cocos2dx_experimental_video_auto.cpp
manual/experimental/jsb_cocos2dx_experimental_video_manual.cpp
)
V3 android cmake support, add mac/ios support (#18646) * CMake build improvements * android cmake support * Enable proguard for cocos2d * examples & test cmake support * add android build type param to gradle.properties file * less warnings * update all android configs to recomended settings * fix network cmake error * fix js-tests cmake error * android build config, add cmake * android build config, add cmake * add lua share lib * android lua cmake build fix * fix * luajit test * run fail, still * fix js-warning * correct lua main include * lua test project cmake support android * try to add lua-template cmake support * lua template fix * js_tests support cmake on android * js-tests improve * cmake support js-template * test to realise prebuild * cmake improve, no feature * improve templates cmake * refactor cmake struct * correct cpp-tests cmake * cpp-templates cmake improve * typo fix * cmake struct refator * change default option * adapt new project struct * uniform cmake test style * add_dependencies to support make -j * little struct improve * little fix * adapt cmake bin dir * little improve about cmake version * change build all tests condition * add source_group for Xcode * add mark source files * add more mark source code * add template project to test * add macos info.plist template * add pak macos for all project * lua test icon fix * not consider lua project for now * modify pak method * add another ios toolchain * add ios system library * update ios toolchain, and reduce ios compile errors * reduce error * make ios engine lib compile pass * cpp-empty-test ios bundle * cpp-tests ios support * js-tests ios support * templates project support ios * fix the way of lua-tests package * try to fix lua-template on macOS * comment lua-template sim file * improve display on xcode * update cmake readme * check android compile again * fix android compile error * fix linux cmake res error * update deps version, for cmake * fix lua_template linux compile error * close android cmake support for now * review template android share library name * change PROP_BUILD_TOOLS_VERSION version to 27.0.1 * change android compile version * make `PROP_APP_PLATFORM` back, add comments for android native build * Revert "make `PROP_APP_PLATFORM` back, add comments for android native build" This reverts commit 272ddc19886891b9502cde070753a870c0fdb588.
2018-02-08 09:24:33 +08:00
endif()
set(JSBINDING_HEADER
${PLATFORM_HEADER}
auto/jsb_cocos2dx_extension_auto.hpp
auto/jsb_cocos2dx_builder_auto.hpp
auto/jsb_cocos2dx_physics3d_auto.hpp
auto/jsb_cocos2dx_ui_auto.hpp
auto/jsb_cocos2dx_spine_auto.hpp
auto/jsb_cocos2dx_auto.hpp
auto/jsb_cocos2dx_studio_auto.hpp
auto/jsb_cocos2dx_navmesh_auto.hpp
auto/jsb_cocos2dx_audioengine_auto.hpp
auto/js_bindings_chipmunk_functions_registration.h
auto/js_bindings_chipmunk_auto_classes.h
auto/js_bindings_chipmunk_auto_classes_registration.h
auto/jsb_cocos2dx_network_auto.hpp
auto/jsb_cocos2dx_3d_auto.hpp
auto/jsb_cocos2dx_3d_extension_auto.hpp
auto/js_bindings_chipmunk_functions.h
manual/js_bindings_core.h
manual/js_module_register.h
manual/ui/jsb_cocos2dx_ui_manual.h
manual/3d/jsb_cocos2dx_3d_manual.h
manual/cocosbuilder/js_bindings_ccbreader.h
manual/js_manual_conversions.h
manual/extension/jsb_cocos2dx_extension_manual.h
manual/spine/jsb_cocos2dx_spine_manual.h
manual/jsb_opengl_registration.h
manual/jsb_opengl_manual.h
manual/network/jsb_websocket.h
manual/network/js_network_manual.h
manual/network/XMLHTTPRequest.h
manual/network/jsb_socketio.h
manual/component/CCComponentJS.h
manual/navmesh/jsb_cocos2dx_navmesh_conversions.h
manual/navmesh/jsb_cocos2dx_navmesh_manual.h
manual/jsb_helper.h
manual/js_bindings_opengl.h
manual/chipmunk/js_bindings_chipmunk_manual.h
manual/chipmunk/js_bindings_chipmunk_registration.h
manual/js_bindings_config.h
manual/ScriptingCore.h
manual/localstorage/js_bindings_system_functions.h
manual/localstorage/js_bindings_system_functions_registration.h
manual/localstorage/js_bindings_system_registration.h
manual/js-BindingsExport.h
manual/physics3d/jsb_cocos2dx_physics3d_manual.h
manual/jsb_opengl_functions.h
manual/cocostudio/jsb_cocos2dx_studio_conversions.h
manual/cocostudio/jsb_cocos2dx_studio_manual.h
manual/jsb_event_dispatcher_manual.h
manual/spidermonkey_specifics.h
)
2015-05-05 10:50:19 +08:00
set(JSBINDING_SRC
${PLATFORM_SRC}
auto/jsb_cocos2dx_auto.cpp
auto/jsb_cocos2dx_audioengine_auto.cpp
auto/jsb_cocos2dx_builder_auto.cpp
auto/jsb_cocos2dx_extension_auto.cpp
auto/jsb_cocos2dx_network_auto.cpp
auto/jsb_cocos2dx_spine_auto.cpp
auto/jsb_cocos2dx_studio_auto.cpp
auto/jsb_cocos2dx_ui_auto.cpp
auto/jsb_cocos2dx_3d_auto.cpp
auto/jsb_cocos2dx_3d_extension_auto.cpp
auto/jsb_cocos2dx_physics3d_auto.cpp
auto/jsb_cocos2dx_navmesh_auto.cpp
auto/js_bindings_chipmunk_functions.cpp
auto/js_bindings_chipmunk_auto_classes.cpp
manual/ScriptingCore.cpp
manual/cocos2d_specifics.cpp
manual/js_manual_conversions.cpp
manual/js_bindings_core.cpp
manual/js_bindings_opengl.cpp
manual/jsb_opengl_functions.cpp
manual/jsb_opengl_manual.cpp
manual/jsb_opengl_registration.cpp
manual/jsb_event_dispatcher_manual.cpp
manual/component/CCComponentJS.cpp
manual/chipmunk/js_bindings_chipmunk_manual.cpp
manual/chipmunk/js_bindings_chipmunk_registration.cpp
manual/cocosbuilder/js_bindings_ccbreader.cpp
manual/cocostudio/jsb_cocos2dx_studio_manual.cpp
manual/cocostudio/jsb_cocos2dx_studio_conversions.cpp
manual/extension/jsb_cocos2dx_extension_manual.cpp
manual/localstorage/js_bindings_system_functions.cpp
manual/localstorage/js_bindings_system_registration.cpp
manual/network/XMLHTTPRequest.cpp
manual/network/jsb_websocket.cpp
manual/network/jsb_socketio.cpp
manual/network/js_network_manual.cpp
manual/spine/jsb_cocos2dx_spine_manual.cpp
manual/ui/jsb_cocos2dx_ui_manual.cpp
manual/3d/jsb_cocos2dx_3d_manual.cpp
manual/physics3d/jsb_cocos2dx_physics3d_manual.cpp
manual/navmesh/jsb_cocos2dx_navmesh_conversions.cpp
manual/navmesh/jsb_cocos2dx_navmesh_manual.cpp
)
2015-05-05 10:50:19 +08:00
include_directories(
${cocos_root}/cocos/platform/${PLATFORM_FOLDER}
${cocos_root}/external/spidermonkey/include/${PLATFORM_FOLDER}
2015-05-05 10:50:19 +08:00
)
list(APPEND JSBINDING_SRC ${JSBINDING_HEADER} ${PLATFORM_HEADER})
2015-05-05 10:50:19 +08:00
add_library(jscocos2d STATIC
${JSBINDING_SRC}
)
2015-05-05 10:50:19 +08:00
V3 android cmake support, add mac/ios support (#18646) * CMake build improvements * android cmake support * Enable proguard for cocos2d * examples & test cmake support * add android build type param to gradle.properties file * less warnings * update all android configs to recomended settings * fix network cmake error * fix js-tests cmake error * android build config, add cmake * android build config, add cmake * add lua share lib * android lua cmake build fix * fix * luajit test * run fail, still * fix js-warning * correct lua main include * lua test project cmake support android * try to add lua-template cmake support * lua template fix * js_tests support cmake on android * js-tests improve * cmake support js-template * test to realise prebuild * cmake improve, no feature * improve templates cmake * refactor cmake struct * correct cpp-tests cmake * cpp-templates cmake improve * typo fix * cmake struct refator * change default option * adapt new project struct * uniform cmake test style * add_dependencies to support make -j * little struct improve * little fix * adapt cmake bin dir * little improve about cmake version * change build all tests condition * add source_group for Xcode * add mark source files * add more mark source code * add template project to test * add macos info.plist template * add pak macos for all project * lua test icon fix * not consider lua project for now * modify pak method * add another ios toolchain * add ios system library * update ios toolchain, and reduce ios compile errors * reduce error * make ios engine lib compile pass * cpp-empty-test ios bundle * cpp-tests ios support * js-tests ios support * templates project support ios * fix the way of lua-tests package * try to fix lua-template on macOS * comment lua-template sim file * improve display on xcode * update cmake readme * check android compile again * fix android compile error * fix linux cmake res error * update deps version, for cmake * fix lua_template linux compile error * close android cmake support for now * review template android share library name * change PROP_BUILD_TOOLS_VERSION version to 27.0.1 * change android compile version * make `PROP_APP_PLATFORM` back, add comments for android native build * Revert "make `PROP_APP_PLATFORM` back, add comments for android native build" This reverts commit 272ddc19886891b9502cde070753a870c0fdb588.
2018-02-08 09:24:33 +08:00
target_link_libraries(jscocos2d cocos2d)
add_dependencies(jscocos2d cocos2d)
cmake support win32 ,and support generate&use prebuilt libs (#18683) * fix win32 prebuilt error, and set cmake as default android native build * cpp-template support msvc * add msvc version check * add -D_USRLUASTATIC, fix lua lib cmake compile error * fix cpp-empty-test res copy dir, add function needed * improve msvc res copy * refactor cmake copy dll logic * fix cpp-tests compile error * refactor copy dll temp * refactor win32 exe using dlls * js-project compile support cmake using msvc * improve res mark for win32 * update the way of lua project res mark * add D_USRLUASTATIC for lua project * unify RELEASE Release to Release, add CMAKE_CONFIGURATION_TYPES * improve VS shows targets, add folder * improve mac/ios res mark * reduce useless comments * unify cpp src include variable * refactor cpp test project package logic * improve pkg app logic * start support prebuilt libs for cpp project using cmake * improve prebuilt libs generate * expand js/lua support prebuilt libs on mac * adapt IDE generate libs path * start do prebuilt for android * improve the way of using external libs for prebuilt * prebuilt libs support cpp-empty-test on android studio * cpp-tests prebuilt libs, and remove useless * start to improve libs using, to adapt prebuilt * improve cpp tests prebuilt on android * prebuilt support lua & js test on android * prebuilt support cpp&js template * rename prebuilt variabl, detail androd config * finish android support prebuilt using cmake * fix cmake script run in windows error * reduce variable name length * improve the way of win32 use dlls to adapt prebuilt * loosen pick js/lua engine lib condition * self review and start check linux build * unify compile option location * strict copy dlls condition * improve libs link order * start redo the way of copy dlls * unify dlls copy logic * fix linux res copy error * update cmake copy file path in linux * make prebuilt dir if needed, and divide Debug and Release dir * cmake win32 divide Debug and Release dir well * comment Lua Template project, for the unfinished lua simulator support * add simulator cmake file * start support simulator * simulator support cmake build on macOS * fix simulator compile error on win32 * add simulator prebuilt support * improve mark cocos app macro * improve cmake template project format * improve cmake app files format * fix format improve mistake * detail cmake readme * improve readme, useless comments * add game.rc to template project * check travis openssl version * try update travis openssl * upgrade travis openssl * change openssl link * change to upgrade openssl * re install python with upgrade openssl * add comment for macro and func, improve variable name
2018-03-08 09:47:57 +08:00
# use necessary external libs and system libs
target_use_jscocos2d_depend_libs(jscocos2d)
2015-05-05 10:50:19 +08:00
set_target_properties(jscocos2d
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
FOLDER "Internal"
)
V3 android cmake support, add mac/ios support (#18646) * CMake build improvements * android cmake support * Enable proguard for cocos2d * examples & test cmake support * add android build type param to gradle.properties file * less warnings * update all android configs to recomended settings * fix network cmake error * fix js-tests cmake error * android build config, add cmake * android build config, add cmake * add lua share lib * android lua cmake build fix * fix * luajit test * run fail, still * fix js-warning * correct lua main include * lua test project cmake support android * try to add lua-template cmake support * lua template fix * js_tests support cmake on android * js-tests improve * cmake support js-template * test to realise prebuild * cmake improve, no feature * improve templates cmake * refactor cmake struct * correct cpp-tests cmake * cpp-templates cmake improve * typo fix * cmake struct refator * change default option * adapt new project struct * uniform cmake test style * add_dependencies to support make -j * little struct improve * little fix * adapt cmake bin dir * little improve about cmake version * change build all tests condition * add source_group for Xcode * add mark source files * add more mark source code * add template project to test * add macos info.plist template * add pak macos for all project * lua test icon fix * not consider lua project for now * modify pak method * add another ios toolchain * add ios system library * update ios toolchain, and reduce ios compile errors * reduce error * make ios engine lib compile pass * cpp-empty-test ios bundle * cpp-tests ios support * js-tests ios support * templates project support ios * fix the way of lua-tests package * try to fix lua-template on macOS * comment lua-template sim file * improve display on xcode * update cmake readme * check android compile again * fix android compile error * fix linux cmake res error * update deps version, for cmake * fix lua_template linux compile error * close android cmake support for now * review template android share library name * change PROP_BUILD_TOOLS_VERSION version to 27.0.1 * change android compile version * make `PROP_APP_PLATFORM` back, add comments for android native build * Revert "make `PROP_APP_PLATFORM` back, add comments for android native build" This reverts commit 272ddc19886891b9502cde070753a870c0fdb588.
2018-02-08 09:24:33 +08:00
if(XCODE OR VS)
cocos_mark_code_files("jscocos2d")
endif()