Ensure log directory exists first.
[SquirrelJME.git] / emulators / emulator-base / src / main / CMakeLists.txt
blob85ccff8b23ee9a3fd99a760af28cb552dc7d2140
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 # Use standard JNI search
16 find_package(JNI QUIET)
18 # If JNI was not found, use a local copy as a fallback
19 if(NOT JNI_FOUND)
20         # Where are the headers?
21         set(JNI_INCLUDE_DIRS
22                 "headers/jni")
24         # Set as found
25         set(JNI_FOUND ON)
26 endif()
28 # Declare library
29 add_library(libEmulatorBase SHARED
30         c/mle_debug.c
31         c/mle_form.c
32         c/mle_jar.c
33         c/mle_math.c
34         c/mle_midi.c
35         c/mle_nativearchive.c
36         c/mle_object.c
37         c/mle_pencil.c
38         c/mle_reflection.c
39         c/mle_runtime.c
40         c/mle_task.c
41         c/mle_terminal.c
42         c/mle_thread.c
43         c/mle_type.c
44         c/nativebinding.c
45         c/utils.c)
47 # Includes for the build
48 target_include_directories(libEmulatorBase PUBLIC
49         "headers"
50         "${CMAKE_SOURCE_DIR}/../../nanocoat/include"
51         ${JNI_INCLUDE_DIRS})
53 # It is easier to find this when it is in the build root
54 set_target_properties(libEmulatorBase PROPERTIES
55         RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
56         LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
57         ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
59 foreach(outputConfig ${CMAKE_CONFIGURATION_TYPES})
60         string(TOUPPER "${outputConfig}" outputConfig)
62         set_target_properties(libEmulatorBase PROPERTIES
63                 RUNTIME_OUTPUT_DIRECTORY_${outputConfig} "${CMAKE_BINARY_DIR}"
64                 LIBRARY_OUTPUT_DIRECTORY_${outputConfig} "${CMAKE_BINARY_DIR}"
65                 ARCHIVE_OUTPUT_DIRECTORY_${outputConfig} "${CMAKE_BINARY_DIR}")
66 endforeach()
68 # Use a more basic name for the library
69 set_target_properties(libEmulatorBase PROPERTIES
70         RUNTIME_OUTPUT_NAME
71         "emulator-base"
72         LIBRARY_OUTPUT_NAME
73         "emulator-base"
74         ARCHIVE_OUTPUT_NAME
75         "emulator-base")
77 # Always make this position independent
78 set_property(TARGET libEmulatorBase
79         PROPERTY POSITION_INDEPENDENT_CODE ON)