A blank base for heavier AWT components that would be needed by applets in the future...
[SquirrelJME.git] / nanocoat / CMakeLists.txt
blobe3b2f2607732ebdde95994e840a5b218ac15b218
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: Defines the base project and the versioning info
10 # Easier includes
11 include("${CMAKE_SOURCE_DIR}/cmake/easier-includes.cmake" NO_POLICY_SCOPE)
13 # Needed for some ancient RetroArch toolchains
14 if(${CMAKE_VERSION} VERSION_LESS "3.13")
15         message(STATUS "Ancient CMake has been detected (${CMAKE_VERSION})")
16         cmake_minimum_required(VERSION 3.7)
18         # Needs to be this or newer
19 else()
20         message(STATUS "Detected CMake (${CMAKE_VERSION})")
21         cmake_minimum_required(VERSION 3.13)
22 endif()
24 # Determine version information
25 squirreljme_include("identify-squirreljme-version.cmake")
27 # Fixes and otherwise for compatibility
28 squirreljme_include("pre-fixes.cmake")
30 # Define project
31 if(${CMAKE_VERSION} VERSION_LESS "3.12")
32         project(SquirrelJME
33                 VERSION ${SQUIRRELJME_VERSION}
34                 LANGUAGES C)
35 else()
36         project(SquirrelJME
37                 VERSION ${SQUIRRELJME_VERSION}
38                 DESCRIPTION "SquirrelJME is a Java ME 8 \
39 Virtual Machine for embedded and Internet of Things devices."
40                 HOMEPAGE_URL https://squirreljme.cc/
41                 LANGUAGES C)
42 endif()
44 # Fixes and otherwise for compatibility
45 squirreljme_include("fixes.cmake")
47 # Hardening options
48 squirreljme_include("hardening.cmake")
50 # CMake Utilities, compiled and used during build
51 squirreljme_include("utils.cmake")
53 # Doxygen
54 squirreljme_include("doxygen.cmake")
56 # Threading and atomics
57 squirreljme_include("threads.cmake")
59 # To Emily and Near...
60 squirreljme_include("i-miss-you.cmake")
62 # Everything is C99
63 set(CMAKE_C_STANDARD 99)
64 set(CMAKE_C_STANDARD_REQUIRED True)
66 # Assets and otherwise, such as icons, etc.
67 squirreljme_include("assets.cmake")
69 # Multi-library declarations
70 squirreljme_include("multilib.cmake")
72 # Turn some warnings into errors
73 if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
74         add_compile_options("-Werror=implicit-function-declaration")
75 endif()
77 # Visual studio does not like a bunch of standard C functions, even those
78 # that take sizes...
79 if(MSVC)
80         add_compile_definitions(_CRT_SECURE_NO_WARNINGS=1)
81 endif()
83 # Declare Version
84 add_compile_definitions(
85         SQUIRRELJME_VERSION_TRIM=${SQUIRRELJME_VERSION})
87 # Debugging?
88 if(SQUIRRELJME_IS_DEBUG)
89         add_compile_definitions(SJME_CONFIG_DEBUG=1)
91         if(SQUIRRELJME_ENABLE_TESTING)
92                 add_compile_definitions(SJME_CONFIG_UNIT_TEST=1)
93         endif()
94 endif()
96 # Valgrind Support on UNIX OSes, if debugging is enabled
97 if(ANDROID OR SQUIRRELJME_IS_UNIX)
98         if(SQUIRRELJME_IS_DEBUG)
99                 squirreljme_include("valgrind.cmake")
100         endif()
101 endif()
103 # Where should dynamic libraries go when output?
104 if(NOT DEFINED SQUIRRELJME_DYLIB_OUTPUT_DIR)
105         set(SQUIRRELJME_DYLIB_OUTPUT_DIR
106                 "${CMAKE_BINARY_DIR}")
107 endif()
109 # Enable support for testing, this is needed here otherwise testing will not
110 # work at all! Major headache this has caused...
111 # From: https://cmake.org/cmake/help/v3.13/command/enable_testing.html
112 # > Note that ctest expects to find a test file in the build directory root.
113 # > Therefore, this command should be in the source directory root.
114 if(SQUIRRELJME_ENABLE_TESTING OR
115         NOT DEFINED SQUIRRELJME_ENABLE_TESTING)
116         enable_testing()
117 else()
118         message(WARNING "Testing was disabled "
119                 "(${SQUIRRELJME_ENABLE_TESTING})...")
120 endif()
122 # CPack for installing
123 if(SQUIRRELJME_ENABLE_PACKING OR
124         NOT DEFINED SQUIRRELJME_ENABLE_PACKING)
125         squirreljme_include("packing.cmake")
126 endif()
128 # SquirrelJME Base Library, everything depends on this essentially
129 add_subdirectory(lib/base)
131 # Include the base core first because it is completely standalone and it
132 # uses nothing else
133 add_subdirectory(src)
135 # Internal Libraries other than Base
136 add_subdirectory(lib)
138 # Tests first since we add to these and when the ROMs register themselves
139 # they will get their tests added accordingly
140 if(SQUIRRELJME_ENABLE_TESTING OR
141         NOT DEFINED SQUIRRELJME_ENABLE_TESTING)
142         add_subdirectory(tests)
143 else()
144         message(WARNING "Testing was disabled "
145                 "(${SQUIRRELJME_ENABLE_TESTING})...")
146 endif()
148 # Front ends
149 add_subdirectory(frontend)
151 # Directory where the ROM compiled sources exist
152 add_subdirectory(rom)