Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
*.x86_64
*.hex


# Ignore the buildfiles that cmake generates in build/cmake/build
build/cmake/build

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
Expand Down
13 changes: 13 additions & 0 deletions build/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.22.2)

project(nfd_build)


message("Building For ${CMAKE_SYSTEM_NAME}")


include(nfd.cmake)
include(test_opendialog.cmake)
include(test_opendialogmultiple.cmake)
include(test_pickfolder.cmake)
include(test_savedialog.cmake)
44 changes: 44 additions & 0 deletions build/cmake/nfd.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
cmake_minimum_required(VERSION 3.10)

# Project declaration
project(nfd)

set(SOURCE_PATH ../../src)
# Set output directories for the build types
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ../../lib/${CMAKE_BUILD_TYPE}/)

# Set source files

if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(SOURCE_FILES
${SOURCE_PATH}/nfd_win.cpp
${SOURCE_PATH}/nfd_common.c
)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
message("Use Zenity: ${USE_ZENITY}")
if(USE_ZENITY)
set(SOURCE_FILES
../../src/nfd_zenity.c
../../src/nfd_common.c
)
else()
set(SOURCE_FILES
../../src/nfd_gtk.c
../../src/nfd_common.c
)
endif()

elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") # macOS is detected as "Darwin"
set(SOURCE_FILES
../../src/nfd_cocoa.m # Objective-C file for Cocoa
../../src/nfd_common.c
)
else()
message(FATAL_ERROR "Unsupported platform ${CMAKE_SYSTEM_NAME}")
endif()
# Include directories
include_directories( ${SOURCE_PATH}/include)


# Define the library target
add_library(nfd STATIC ${SOURCE_FILES})
8 changes: 8 additions & 0 deletions build/cmake/test_opendialog.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.22.2)

project( test_opendialog)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ../../bin/${CMAKE_BUILD_TYPE}/)

add_executable(test_opendialog ../../test/test_opendialog.c)
target_link_libraries(test_opendialog nfd)
8 changes: 8 additions & 0 deletions build/cmake/test_opendialogmultiple.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.22.2)

project( test_opendialogmultiple)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ../../bin/${CMAKE_BUILD_TYPE}/)

add_executable(test_opendialogmultiple ../../test/test_opendialogmultiple.c)
target_link_libraries(test_opendialogmultiple nfd)
8 changes: 8 additions & 0 deletions build/cmake/test_pickfolder.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.22.2)

project( test_pickfolder)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ../../bin/${CMAKE_BUILD_TYPE}/)

add_executable(test_pickfolder ../../test/test_pickfolder.c)
target_link_libraries(test_pickfolder nfd)
8 changes: 8 additions & 0 deletions build/cmake/test_savedialog.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.22.2)

project( test_savedialog)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ../../bin/${CMAKE_BUILD_TYPE}/)

add_executable(test_savedialog ../../test/test_savedialog.c)
target_link_libraries(test_savedialog nfd)