Collect all of the various spread out 3rd party licenses to a single file.
[SquirrelJME.git] / emulators / emulator-base-native / CMakeLists.txt
blob7d755ff395ebfbdde30339e9e22025c9c4802174
1 # ---------------------------------------------------------------------------
2 # SquirrelJME
3 #     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
4 # ---------------------------------------------------------------------------
5 # SquirrelJME is under the Mozilla Public License Version 2.0.
6 # See license.mkd for licensing and copyright information.
7 # ---------------------------------------------------------------------------
8 # DESCRIPTION: CMake Helper for project
10 cmake_minimum_required(VERSION 3.5)
12 # Declare project
13 project(libEmulatorBase)
15 # Where is NanoCoat?
16 get_filename_component(nanocoatIncludePath
17         "${CMAKE_SOURCE_DIR}/../../nanocoat/include" ABSOLUTE)
18 message(STATUS "NanoCoat include is: ${nanocoatIncludePath}")
20 # Use standard JNI search
21 find_package(JNI QUIET)
23 # If JNI was not found, use a local copy as a fallback
24 if(NOT JNI_FOUND)
25         # Where are the headers?
26         set(JNI_INCLUDE_DIRS
27                 "${nanocoatIncludePath}/3rdparty/jni")
29         # Set as found
30         set(JNI_FOUND ON)
31 endif()
33 # Declare library
34 add_library(libEmulatorBase SHARED
35         c/jniHelper.c
36         c/mle_debug.c
37         c/mle_form.c
38         c/mle_jar.c
39         c/mle_math.c
40         c/mle_midi.c
41         c/mle_nativearchive.c
42         c/mle_object.c
43         c/mle_pencil.c
44         c/mle_reflection.c
45         c/mle_runtime.c
46         c/mle_task.c
47         c/mle_terminal.c
48         c/mle_thread.c
49         c/mle_type.c
50         c/nativebinding.c
51         c/utils.c)
53 # Includes for the build
54 target_include_directories(libEmulatorBase PUBLIC
55         "headers"
56         "${nanocoatIncludePath}"
57         ${JNI_INCLUDE_DIRS})
59 # Libraries for the build
60 get_filename_component(nanocoatLibPath
61         "${CMAKE_SOURCE_DIR}/../emulator-base/build/cmake-libsNativeNanoCoat"
62         ABSOLUTE)
63 message(STATUS "NanoCoat lib is: ${nanocoatLibPath}")
64 target_link_directories(libEmulatorBase PUBLIC
65         "${nanocoatLibPath}")
66 target_link_libraries(libEmulatorBase PUBLIC
67         "BaseStatic")
69 # It is easier to find this when it is in the build root
70 set_target_properties(libEmulatorBase PROPERTIES
71         RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
72         LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
73         ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
75 foreach(outputConfig ${CMAKE_CONFIGURATION_TYPES})
76         string(TOUPPER "${outputConfig}" outputConfig)
78         set_target_properties(libEmulatorBase PROPERTIES
79                 RUNTIME_OUTPUT_DIRECTORY_${outputConfig} "${CMAKE_BINARY_DIR}"
80                 LIBRARY_OUTPUT_DIRECTORY_${outputConfig} "${CMAKE_BINARY_DIR}"
81                 ARCHIVE_OUTPUT_DIRECTORY_${outputConfig} "${CMAKE_BINARY_DIR}")
82 endforeach()
84 # Use a more basic name for the library
85 set_target_properties(libEmulatorBase PROPERTIES
86         RUNTIME_OUTPUT_NAME
87         "emulator-base"
88         LIBRARY_OUTPUT_NAME
89         "emulator-base"
90         ARCHIVE_OUTPUT_NAME
91         "emulator-base")
93 # Always make this position independent
94 set_property(TARGET libEmulatorBase
95         PROPERTY POSITION_INDEPENDENT_CODE ON)