# Sets the minimum version of CMake required to build your native library.
# This ensures that a certain set of CMake features is available to
# your build.

cmake_minimum_required(VERSION 3.4.1)

# build native_app_glue as a static lib
add_library(
	app-glue STATIC
	../libs/native_app_glue/android_native_app_glue.c
)

# Specifies a library name, specifies whether the library is STATIC or
# SHARED, and provides relative paths to the source code. You can
# define multiple libraries by adding multiple add.library() commands,
# and CMake builds them for you. When you build your app, Gradle
# automatically packages shared libraries with your APK.

# now build app's shared lib
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")

add_library(
	native-lib SHARED
	../libs/yoga/yoga/YGNodeList.c
	../libs/yoga/yoga/Yoga.c
	../libs/tinyxml2/tinyxml2.cpp
	../libs/jpeg/jpgd.cpp
	../libs/jpeg/jpge.cpp
	../libs/poly2tri/poly2tri/common/shapes.cc
	../libs/poly2tri/poly2tri/sweep/advancing_front.cc
	../libs/poly2tri/poly2tri/sweep/cdt.cc
	../libs/poly2tri/poly2tri/sweep/sweep_context.cc
	../libs/poly2tri/poly2tri/sweep/sweep.cc
	../libs/fmt/src/format.cc
	src/main/cpp/main.cpp
	../src/pch.cpp
	../src/util.cpp
	../src/rtt.cpp
	../src/bezier.cpp
	../src/asset.cpp
	../src/image.cpp
	../src/texture.cpp
	../src/font.cpp
	../src/shader.cpp
	../src/shape.cpp
	../src/app.cpp
	../src/app_cloud.cpp
	../src/app_dialogs.cpp
	../src/app_events.cpp
	../src/app_layout.cpp
	../src/app_shaders.cpp
	../src/brush.cpp
	../src/canvas.cpp
	../src/canvas_modes.cpp
	../src/log.cpp
	../src/action.cpp
	../src/layout.cpp
	../src/version.cpp
	../src/node.cpp
	../src/node_about.cpp
	../src/node_border.cpp
	../src/node_button.cpp
	../src/node_button_custom.cpp
	../src/node_canvas.cpp
	../src/node_checkbox.cpp
	../src/node_color_quad.cpp
	../src/node_colorwheel.cpp
	../src/node_combobox.cpp
	../src/node_changelog.cpp
	../src/node_dialog_browse.cpp
	../src/node_dialog_cloud.cpp
	../src/node_dialog_open.cpp
	../src/node_dialog_picker.cpp
	../src/node_dialog_layer_rename.cpp
	../src/node_dialog_resize.cpp
	../src/node_icon.cpp
	../src/node_image.cpp
	../src/node_image_texture.cpp
	../src/node_message_box.cpp
	../src/node_panel_brush.cpp
	../src/node_panel_color.cpp
	../src/node_panel_grid.cpp
	../src/node_panel_layer.cpp
	../src/node_panel_stroke.cpp
	../src/node_popup_menu.cpp
	../src/node_progress_bar.cpp
	../src/node_settings.cpp
	../src/node_slider.cpp
	../src/node_stroke_preview.cpp
	../src/node_text.cpp
	../src/node_text_input.cpp
	../src/node_usermanual.cpp
	../src/node_viewport.cpp
	../src/node_scroll.cpp
	../src/abr.cpp
)

target_include_directories(native-lib PRIVATE
	src/main/cpp
	../src
	../libs/glm
	../libs/tinyxml2
	../libs/yoga
	../libs/stb
	../libs/jpeg
	../libs/curl-android-ios/android/include
	../libs/poly2tri/poly2tri
	../libs/base64
	../libs/sqlite3
	../libs/nanort
	../libs/native_app_glue
	../libs/hash-library
	../libs/fmt/include
)

# add lib dependencies
target_link_libraries(
	native-lib
	android
	app-glue
	${CMAKE_SOURCE_DIR}/../libs/curl-android-ios/android/${ANDROID_ABI}/libcurl.a
	EGL
	GLESv3
	log
	z
)
