@@ -9,49 +9,66 @@ project(RePiskel)
9
9
# Set CMake variables
10
10
set (CMAKE_CXX_STANDARD_REQUIRED ON )
11
11
set (CMAKE_CXX_EXTENSIONS OFF )
12
- set (CMAKE_CXX_STANDARD 23 )
12
+ set (CMAKE_CXX_STANDARD 26 )
13
13
set (CMAKE_CXX_STANDARD_REQUIRED ON )
14
14
15
15
16
16
# Main executable
17
+ string (APPEND CMAKE_CXX_FLAGS " -Wno-narrowing" )
17
18
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" )
18
- add_executable (RePiskel MACOSX_BUNDLE main.cpp buildfiles/icon.icns)
19
- else (CMAKE_SYSTEM_NAME STREQUAL "Windows" )
20
- add_executable (RePiskel WIN32 main.cpp buildfiles/wicon.rc)
19
+ add_executable (RePiskel MACOSX_BUNDLE src/main.cpp buildfiles/icon.icns)
20
+ elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows" )
21
+ add_executable (RePiskel src/main.cpp buildfiles/wicon.rc) # WIN32
22
+ else (CMAKE_SYSTEM_NAME STREQUAL "Linux" )
23
+ add_executable (RePiskel src/main.cpp)
21
24
endif ()
22
25
23
26
24
- target_compile_options (RePiskel PRIVATE -fpermissive)
25
-
26
-
27
27
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin" )
28
28
# Set macos executable rpath and result path
29
29
set_target_properties (RePiskel PROPERTIES INSTALL_RPATH "@executable_path/../Resources" BUILD_WITH_INSTALL_RPATH TRUE )
30
30
set_target_properties (RePiskel PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR} /build )
31
31
32
32
33
33
# Link libraries and include directories
34
- target_link_libraries (RePiskel PRIVATE ${CMAKE_SOURCE_DIR} /../Cached/libSDL3.0.dylib)
35
- target_link_libraries (RePiskel PRIVATE ${CMAKE_SOURCE_DIR} /../Cached/libSDL3_ttf.0.0.0.dylib)
36
- # target_link_libraries(RePiskel PRIVATE ${CMAKE_SOURCE_DIR}/../Cached/libgtk-4.1.dylib)
37
- target_include_directories (RePiskel PRIVATE /usr/local/include )
38
-
34
+ find_package (SDL3 REQUIRED CONFIG COMPONENTS SDL3-shared)
35
+ find_package (SDL3_ttf REQUIRED CONFIG COMPONENTS SDL3_ttf-shared)
36
+ target_link_libraries (RePiskel PRIVATE SDL3::SDL3)
37
+ target_link_libraries (RePiskel PRIVATE SDL3_ttf::SDL3_ttf)
39
38
40
39
# Make directories for macos app
41
- file (MAKE_DIRECTORY ${CMAKE_SOURCE_DIR} /build /RePiskel.app/Contents/MacOS)
42
- file (MAKE_DIRECTORY ${CMAKE_SOURCE_DIR} /build /RePiskel.app/Contents/Resources )
40
+ file (MAKE_DIRECTORY " ${CMAKE_SOURCE_DIR} /build/RePiskel.app/Contents/MacOS" )
41
+ file (COPY " ${CMAKE_SOURCE_DIR} /buildfiles/Resources" DESTINATION " ${CMAKE_SOURCE_DIR} / build/RePiskel.app/Contents" )
43
42
44
43
45
44
# Add basic files to macos app
46
- file (COPY ${CMAKE_SOURCE_DIR} /buildfiles/info.plist DESTINATION ${CMAKE_SOURCE_DIR} /build /RePiskel.app/Contents)
47
- file (COPY ${CMAKE_SOURCE_DIR} /buildfiles/icon.icns DESTINATION ${CMAKE_SOURCE_DIR} /build /RePiskel.app/Contents/Resources)
48
- file (COPY ${CMAKE_SOURCE_DIR} /buildfiles/Font.ttf DESTINATION ${CMAKE_SOURCE_DIR} /build /RePiskel.app/Contents/Resources)
49
- file (COPY ${CMAKE_SOURCE_DIR} /buildfiles/tools.bmp DESTINATION ${CMAKE_SOURCE_DIR} /build /RePiskel.app/Contents/Resources)
45
+ file (COPY ${CMAKE_SOURCE_DIR} /buildfiles/info.plist DESTINATION "${CMAKE_SOURCE_DIR} /build/RePiskel.app/Contents" )
46
+ file (COPY ${CMAKE_SOURCE_DIR} /buildfiles/icon.icns DESTINATION "${CMAKE_SOURCE_DIR} /build/RePiskel.app/Contents/Resources" )
50
47
51
48
52
49
# Add resources to macos app
53
- file (COPY ${CMAKE_SOURCE_DIR} /../Cached/libSDL3.0.dylib DESTINATION ${CMAKE_SOURCE_DIR} /build /RePiskel.app/contents/Resources)
54
- configure_file (${CMAKE_SOURCE_DIR} /../Cached/libSDL3_ttf.0.0.0.dylib ${CMAKE_SOURCE_DIR} /build /RePiskel.app/contents/Resources/libSDL3_ttf.0.dylib COPYONLY )
50
+ add_custom_command (TARGET CanvasView POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:SDL3::SDL3-shared> $<TARGET_FILE_DIR:CanvasView>/../Resources)
51
+ add_custom_command (TARGET CanvasView POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:SDL3_ttf::SDL3_ttf-shared> $<TARGET_FILE_DIR:CanvasView>/../Resources)
52
+ add_custom_command (TARGET CanvasView POST_BUILD COMMAND ${CMAKE_COMMAND} -E rename $<TARGET_FILE_DIR:CanvasView>/../Resources/libSDL3_ttf.0.0.0.dylib $<TARGET_FILE_DIR:CanvasView>/../Resources/libSDL3_ttf.0.dylib)
53
+
54
+
55
+ elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux" )
56
+ # Set linux result path
57
+ set_target_properties (RePiskel PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR} /build /RePiskel)
58
+ set_target_properties (RePiskel PROPERTIES INSTALL_RPATH "$ORIGIN/Resources" BUILD_WITH_INSTALL_RPATH TRUE )
59
+ find_package (SDL3 REQUIRED CONFIG COMPONENTS SDL3-shared)
60
+ find_package (SDL3_ttf REQUIRED CONFIG COMPONENTS SDL3_ttf-shared)
61
+ target_link_libraries (RePiskel PRIVATE SDL3::SDL3)
62
+ target_link_libraries (RePiskel PRIVATE SDL3_ttf::SDL3_ttf)
63
+
64
+ file (MAKE_DIRECTORY "${CMAKE_SOURCE_DIR} /build/RePiskel" )
65
+ file (COPY "${CMAKE_SOURCE_DIR} /buildfiles/Resources" DESTINATION "${CMAKE_SOURCE_DIR} /build/RePiskel" )
66
+
67
+ add_custom_command (TARGET RePiskel POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:SDL3::SDL3-shared> $<TARGET_FILE_DIR:RePiskel>/Resources)
68
+ add_custom_command (TARGET RePiskel POST_BUILD COMMAND ${CMAKE_COMMAND} -E rename $<TARGET_FILE_DIR:RePiskel>/Resources/libSDL3.so.0.2.5 $<TARGET_FILE_DIR:RePiskel>/Resources/libSDL3.so.0)
69
+ add_custom_command (TARGET RePiskel POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:SDL3_ttf::SDL3_ttf-shared> $<TARGET_FILE_DIR:RePiskel>/Resources)
70
+ add_custom_command (TARGET RePiskel POST_BUILD COMMAND ${CMAKE_COMMAND} -E rename $<TARGET_FILE_DIR:RePiskel>/Resources/libSDL3_ttf.so.0.1.2 $<TARGET_FILE_DIR:RePiskel>/Resources/libSDL3_ttf.so.0)
71
+
55
72
56
73
57
74
else (CMAKE_SYSTEM_NAME STREQUAL "Windows" )
@@ -66,8 +83,7 @@ else(CMAKE_SYSTEM_NAME STREQUAL "Windows")
66
83
67
84
68
85
# Add basic files to windows app
69
- file (COPY ${CMAKE_SOURCE_DIR} /buildfiles/tools.bmp DESTINATION ${CMAKE_SOURCE_DIR} /build /RePiskel)
70
- file (COPY ${CMAKE_SOURCE_DIR} /buildfiles/Font.ttf DESTINATION ${CMAKE_SOURCE_DIR} /build /RePiskel)
86
+ file (COPY ${CMAKE_SOURCE_DIR} /buildfiles/Resources DESTINATION "${CMAKE_SOURCE_DIR} /build/RePiskel" )
71
87
72
88
73
89
# Add resources to windows app
0 commit comments