Merge heads.
[SquirrelJME.git] / emulators / emulator-base-native / CMakeLists.txt
bloba3d11ef7c352b2a475515e920542a0b90a0f65c6
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
14     LANGUAGES C)
16 # Support bases
17 include("${CMAKE_SOURCE_DIR}/../../nanocoat/cmake/pre-fixes.cmake"
18     NO_POLICY_SCOPE)
19 include("${CMAKE_SOURCE_DIR}/../../nanocoat/cmake/utils.cmake"
20     NO_POLICY_SCOPE)
21 include("${CMAKE_SOURCE_DIR}/../../nanocoat/cmake/fixes.cmake"
22     NO_POLICY_SCOPE)
23 include("${CMAKE_SOURCE_DIR}/../../nanocoat/cmake/jni.cmake"
24     NO_POLICY_SCOPE)
25 include("${CMAKE_SOURCE_DIR}/../../nanocoat/cmake/threads.cmake"
26     NO_POLICY_SCOPE)
28 # Where is NanoCoat?
29 get_filename_component(nanocoatIncludePath
30         "${CMAKE_SOURCE_DIR}/../../nanocoat/include" ABSOLUTE)
31 message(STATUS "NanoCoat include is: ${nanocoatIncludePath}")
33 # Declare library
34 add_library(libEmulatorBase SHARED
35         c/jniHelper.c
36         c/mle_debug.c
37         c/mle_jar.c
38         c/mle_math.c
39         c/mle_midi.c
40         c/mle_nativearchive.c
41         c/mle_object.c
42         c/mle_pencil.c
43     c/mle_pencilfont.c
44         c/mle_reflection.c
45         c/mle_runtime.c
46         c/mle_scritchui.c
47         c/mle_scritchuibaseobject.c
48         c/mle_scritchuidylib.c
49         c/mle_task.c
50         c/mle_terminal.c
51         c/mle_thread.c
52         c/mle_type.c
53         c/nativebinding.c
54         c/utils.c)
56 # Includes for the build
57 target_include_directories(libEmulatorBase PUBLIC
58         "headers"
59         "${nanocoatIncludePath}"
60         ${JNI_INCLUDE_DIRS}
61         ${JAVA_INCLUDE_PATH}
62         ${JAVA_INCLUDE_PATH2})
64 # Libraries for the build
65 get_filename_component(nanocoatLibPath
66         "${CMAKE_SOURCE_DIR}/../emulator-base/build/cmake-libsNativeNanoCoat"
67         ABSOLUTE)
68 message(STATUS "NanoCoat lib is: ${nanocoatLibPath}")
69 target_link_directories(libEmulatorBase PUBLIC
70         "${nanocoatLibPath}")
71 target_link_libraries(libEmulatorBase PUBLIC
72         "BaseStatic" "${JAVA_JVM_LIBRARY}")
74 # It is easier to find this when it is in the build root
75 set_target_properties(libEmulatorBase PROPERTIES
76         RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
77         LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
78         ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
80 foreach(outputConfig ${CMAKE_CONFIGURATION_TYPES})
81         string(TOUPPER "${outputConfig}" outputConfig)
83         set_target_properties(libEmulatorBase PROPERTIES
84                 RUNTIME_OUTPUT_DIRECTORY_${outputConfig} "${CMAKE_BINARY_DIR}"
85                 LIBRARY_OUTPUT_DIRECTORY_${outputConfig} "${CMAKE_BINARY_DIR}"
86                 ARCHIVE_OUTPUT_DIRECTORY_${outputConfig} "${CMAKE_BINARY_DIR}")
87 endforeach()
89 # Use a more basic name for the library
90 set_target_properties(libEmulatorBase PROPERTIES
91         RUNTIME_OUTPUT_NAME
92         "emulator-base"
93         LIBRARY_OUTPUT_NAME
94         "emulator-base"
95         ARCHIVE_OUTPUT_NAME
96         "emulator-base")
98 # Always make this position independent
99 set_property(TARGET libEmulatorBase
100         PROPERTY POSITION_INDEPENDENT_CODE ON)