# Windows Configuration
Follow this project configuration guide for your Windows setup. Once completed, return to the Quick Start Guide to finish integration.
# PC Builds
In our example we have used Visual Studio 2017.
You can find the Visual Studio project files in ~"ProjectName"/proj.win32/
# Visual Studio 2017 Settings
- Open the solution (sln) file in Visual Studio 2017
- Right click on your Visual Studio Project in the Solution Explorer and select Properties
- Navigate to C/C++ > General and in the Additional Include Directories section add the following entry:
..\Frameplay\
- Navigate to Linker > General and in the Additional Library Directories section add the following entry:
..\Frameplay\Native\Platforms\Windows\Win32\
- Navigate to Linker > Input and under the Additional Dependencies section add the following entry:
FrameplayNative.lib
- The FrameplayNative.dll must be copied over to your build output directory. Use a Post Build Event by navigating to Build Events > Post-Build Event and under the Command Line section add the following entry:
copy /Y "..\Frameplay\Native\Platforms\Windows\Win32\FrameplayNative.dll" "$(OutDir)\FrameplayNative.dll"
# Build Win32
Start Debugging or Build the project in your editor. You can also build by running the following VS2017 commands.
cd ./com.company.cocos
cocos compile -p win32 -m debug
Successful builds will be located in "ProjectName"/bin/debug/win32/
# Android Builds
In our example we have used CMake to build our Android apk. CMake is automatically setup when creating a template c++ Cocos project. The CMakeLists
is found in the root of the project "ProjectName"/CMakeLists.txt
# CMAKE Settings
- Open the CMakeLists.txt file in the project root directory
- Add
Frameplay/
to the target_include_directories
target_include_directories(${APP_NAME}
PRIVATE Frameplay/
)
- Include the
libFrameplayNative.so
library fromFrameplay/Native/Platforms/Android/${ANDROID_ABI}
folder
set(FRAMEPLAY_ANDROID_LIB_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Frameplay/Native/Platforms/Android/${ANDROID_ABI}/)
add_library(libFrameplayNative SHARED IMPORTED)
set_target_properties(libFrameplayNative PROPERTIES IMPORTED_LOCATION ${FRAMEPLAY_ANDROID_LIB_PATH}libFrameplayNative.so)
- Link the libraries to your app
target_link_libraries(${APP_NAME} <your other libraries> libFrameplayNative)
- Add a custom command to copy the files from the lib directory into the build output directory.
add_custom_command(
TARGET ${APP_NAME} PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${FRAMEPLAY_ANDROID_LIB_PATH} $<TARGET_FILE_DIR:${APP_NAME}>
)
# Android Google AD_ID
For Google AD_ID to work you will need to complete the following.
In your cocos project folder go to com.company.cocos\proj.android\app
open build.gradle under dependencies include: implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':libcocos2dx')
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
}
Note: If your application is targeting Android 13 (API Level 33) or above, you will need to include this permission into AndroidManifest.xml located in com.company.cocos\proj.android\app
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
More information can be found here. (opens new window)
# Build Android
Build by running the following commands:
cd ./com.company.cocos
cocos compile -p android -m debug
Successful builds will be located in "ProjectName"/bin/debug/android/