Skip to content
Draft
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
25 changes: 20 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ openvic_disable_rtti()

option(OPENVIC_USE_PCH "Precompile openvic-simulation/pch.hpp" ON)

add_subdirectory(deps)

file(GLOB_RECURSE sim_sources CONFIGURE_DEPENDS src/openvic-simulation/*.cpp)
list(REMOVE_ITEM sim_sources ${CMAKE_CURRENT_SOURCE_DIR}/src/openvic-simulation/pch.cpp)

Expand Down Expand Up @@ -88,12 +86,29 @@ target_link_libraries(
ov_foonathan_memory
)

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
# all unix non apple systems need tbb this way

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the style FakeByte used for comments to keep consistency.

if(UNIX AND NOT APPLE)
find_package(PkgConfig REQUIRED)
pkg_check_modules(TBB REQUIRED IMPORTED_TARGET tbb)
target_link_libraries(openvic-simulation PUBLIC PkgConfig::TBB)
pkg_check_modules(TBB_PC REQUIRED IMPORTED_TARGET GLOBAL tbb)
target_link_libraries(openvic-simulation PUBLIC PkgConfig::TBB_PC)
endif()

# if needed detect other platforms

Comment on lines +96 to +97

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the style FakeByte used for comments to keep consistency. Also remove the newline spacing.

if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
find_path(ICONV_INCLUDE_DIR iconv.h)
find_library(ICONV_LIBRARY NAMES iconv)

if(NOT ICONV_INCLUDE_DIR OR NOT ICONV_LIBRARY)
message(FATAL_ERROR "iconv not found, try installing it")
endif()

include_directories(${ICONV_INCLUDE_DIR})
link_libraries(${ICONV_LIBRARY})
endif()

add_subdirectory(deps)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was deps moved down here?

@benjaminmcq benjaminmcq Jul 23, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so the makefile it's jumping to knows about iconv


if(APPLE)
# clang emits the TLS init aliases (_ZTH*) for inline thread_local members
# as non-weak private-external symbols, one per TU that odr-uses them, and
Expand Down
41 changes: 41 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,20 @@
"CMAKE_CXX_COMPILER": "g++"
}
},
{
"name": "bsd-x64",
"inherits": "base",
"generator": "Ninja Multi-Config",
"condition": {
"type": "matches",
"string": "${hostSystemName}",
"regex": "^.*BSD.*$"
},
"cacheVariables": {
"CMAKE_CXX_COMPILER": "clang++",
"CMAKE_MAKE_PROGRAM": "ninja"
}
},
{
"name": "macos-universal",
"inherits": "base",
Expand Down Expand Up @@ -114,6 +128,21 @@
"configurePreset": "linux-x64",
"configuration": "RelWithDebInfo"
},
{
"name": "bsd-x64-release",
"configurePreset": "bsd-x64",
"configuration": "Release"
},
{
"name": "bsd-x64-debug",
"configurePreset": "bsd-x64",
"configuration": "Debug"
},
{
"name": "bsd-x64-relwithdebinfo",
"configurePreset": "bsd-x64",
"configuration": "RelWithDebInfo"
},
{
"name": "macos-universal-release",
"configurePreset": "macos-universal",
Expand Down Expand Up @@ -167,6 +196,18 @@
"configuration": "Release",
"output": { "outputOnFailure": true }
},
{
"name": "bsd-x64-debug",
"configurePreset": "bsd-x64",
"configuration": "Debug",
"output": { "outputOnFailure": true }
},
{
"name": "bsd-x64-release",
"configurePreset": "bsd-x64",
"configuration": "Release",
"output": { "outputOnFailure": true }
},
{
"name": "macos-universal-debug",
"configurePreset": "macos-universal",
Expand Down