Skip to content

Commit 4e415d7

Browse files
committed
Build with catnip
1 parent 2128043 commit 4e415d7

3 files changed

Lines changed: 58 additions & 192 deletions

File tree

CMakeLists.txt

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
cmake_minimum_required(VERSION 3.13)
2+
3+
project(citro2d
4+
LANGUAGES C ASM
5+
)
6+
7+
include(GNUInstallDirs)
8+
9+
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
10+
set(CMAKE_INSTALL_PREFIX "${CTR_ROOT}" CACHE PATH "" FORCE)
11+
endif()
12+
13+
# Define static library target
14+
add_library(citro2d STATIC)
15+
set_target_properties(citro2d PROPERTIES DEBUG_POSTFIX "d")
16+
17+
# Add compiler flags
18+
target_compile_options(citro2d PRIVATE
19+
-Wall -Werror -DCITRO2D_BUILD
20+
)
21+
22+
# Add include directories
23+
target_include_directories(citro2d PRIVATE include)
24+
25+
target_sources(citro2d PRIVATE
26+
source/base.c
27+
source/font.c
28+
source/spritesheet.c
29+
source/text.c
30+
)
31+
32+
ctr_add_shader_library(render2d
33+
source/render2d.v.pica
34+
)
35+
36+
dkp_add_embedded_binary_library(c2d_shaders
37+
render2d
38+
)
39+
40+
target_link_libraries(citro2d PRIVATE c2d_shaders)
41+
42+
# Install the library
43+
install(
44+
TARGETS citro2d
45+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
46+
)
47+
48+
# Install headers
49+
install(
50+
DIRECTORY ${PROJECT_SOURCE_DIR}/include/
51+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
52+
FILES_MATCHING
53+
PATTERN "*.h"
54+
)

Catnip.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
catnip_package(citro2d DEFAULT all)
2+
3+
catnip_add_preset(release TOOLSET 3DS BUILD_TYPE Release)
4+
catnip_add_preset(debug TOOLSET 3DS BUILD_TYPE Debug)

Makefile

Lines changed: 0 additions & 192 deletions
This file was deleted.

0 commit comments

Comments
 (0)