Correct incorrect library size calculation.
[SquirrelJME.git] / nanocoat / CMakeLists.txt
blobe76c859c13804c7fa42e689e961e22813dd785f7
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 # CMake Utilities, compiled and used during build
48 squirreljme_include("utils.cmake")
50 # To Emily and Near...
51 squirreljme_include("i-miss-you.cmake")
53 # Everything is C99
54 set(CMAKE_C_STANDARD 99)
55 set(CMAKE_C_STANDARD_REQUIRED True)
57 # Assets and otherwise, such as icons, etc.
58 squirreljme_include("assets.cmake")
60 # Turn some warnings into errors
61 if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
62         add_compile_options("-Werror=implicit-function-declaration")
63 endif()
65 # Visual studio does not like a bunch of standard C functions, even those
66 # that take sizes...
67 if(MSVC)
68         add_compile_definitions(_CRT_SECURE_NO_WARNINGS=1)
69 endif()
71 # Declare Version
72 add_compile_definitions(
73         SQUIRRELJME_VERSION_TRIM=${SQUIRRELJME_VERSION})
75 # Debugging?
76 if(SQUIRRELJME_IS_DEBUG)
77         add_compile_definitions(SJME_CONFIG_DEBUG=1)
79         if(SQUIRRELJME_ENABLE_TESTING)
80                 add_compile_definitions(SJME_CONFIG_UNIT_TEST=1)
81         endif()
82 endif()
84 # Valgrind Support on UNIX OSes, if debugging
85 if(ANDROID OR SQUIRRELJME_IS_UNIX)
86         if(SQUIRRELJME_IS_DEBUG)
87                 squirreljme_include("valgrind.cmake")
88         endif()
89 endif()
91 # Enable support for testing, this is needed here otherwise testing will not
92 # work at all! Major headache this has caused...
93 # From: https://cmake.org/cmake/help/v3.13/command/enable_testing.html
94 # > Note that ctest expects to find a test file in the build directory root.
95 # > Therefore, this command should be in the source directory root.
96 if(SQUIRRELJME_ENABLE_TESTING OR
97         NOT DEFINED SQUIRRELJME_ENABLE_TESTING)
98         enable_testing()
99 else()
100         message(WARNING "Testing was disabled "
101                 "(${SQUIRRELJME_ENABLE_TESTING})...")
102 endif()
104 # CPack for installing
105 if(SQUIRRELJME_ENABLE_PACKING OR
106         NOT DEFINED SQUIRRELJME_ENABLE_PACKING)
107         squirreljme_include("packing.cmake")
108 endif()
110 # Include the base core first because it is completely standalone and it
111 # uses nothing else
112 add_subdirectory(src)
114 # Tests first since we add to these and when the ROMs register themselves
115 # they will get their tests added accordingly
116 if(SQUIRRELJME_ENABLE_TESTING OR
117         NOT DEFINED SQUIRRELJME_ENABLE_TESTING)
118         add_subdirectory(tests)
119 else()
120         message(WARNING "Testing was disabled "
121                 "(${SQUIRRELJME_ENABLE_TESTING})...")
122 endif()
124 # Front ends
125 add_subdirectory(frontend)
127 # Directory where the ROM compiled sources exist
128 add_subdirectory(rom)