diff options
-rw-r--r-- | CMakeLists.txt | 8 | ||||
-rw-r--r-- | demos/CMakeLists.txt | 2 | ||||
m--------- | lib/Catch2 | 0 | ||||
m--------- | lib/GSL | 0 | ||||
-rw-r--r-- | src/common/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/parse/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/platform/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/platform/bootstrap/Bootstrap.cpp | 8 | ||||
-rw-r--r-- | src/platform/bootstrap/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/platform/graphics/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/platform/graphics/cairo/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/platform/graphics/direct2d/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/platform/graphics/quartz/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/platform/gui/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/platform/gui/osx/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/platform/gui/win/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/platform/osx/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/platform/win/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/toml/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/ui/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/xml/CMakeLists.txt | 2 |
21 files changed, 38 insertions, 20 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 776f4638..d83e4b07 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,13 @@ cmake_minimum_required(VERSION 3.21) +set(CRU_DEFAULT_BUILD_SHARED_LIBS ON) +if (EMSCRIPTEN) + # Webassembly has no idea about static/dynamic libraries. + set(CRU_DEFAULT_BUILD_SHARED_LIBS OFF) +endif() + +option(BUILD_SHARED_LIBS "Try to build shared libraries as default" CRU_DEFAULT_BUILD_SHARED_LIBS) + set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_EXTENSIONS OFF) diff --git a/demos/CMakeLists.txt b/demos/CMakeLists.txt index 46da3544..e8b84472 100644 --- a/demos/CMakeLists.txt +++ b/demos/CMakeLists.txt @@ -18,6 +18,8 @@ elseif(APPLE) add_subdirectory(InputMethod) add_subdirectory(SvgPath) +elseif(EMSCRIPTEN) + elseif(UNIX) add_subdirectory(graphics) add_subdirectory(xcb) diff --git a/lib/Catch2 b/lib/Catch2 -Subproject 4adf0105490a9a8f14fba0f6d463a16bcafa61b +Subproject 4a7cefe60101c1e5ea7c7da33a1abe06fbc8e02 diff --git a/lib/GSL b/lib/GSL -Subproject 10df83d292bf5bbdc487e57dc8c2dc8c7a01f4d +Subproject 1683d87a3f45dff1817e858dbaf006e5ff84e78 diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 38af768a..119bbbee 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(CruBase SHARED +add_library(CruBase Base.cpp Exception.cpp Format.cpp @@ -17,7 +17,7 @@ target_compile_definitions(CruBase PRIVATE CRU_BASE_EXPORT_API) target_include_directories(CruBase PUBLIC ${CRU_INCLUDE_DIR}) target_compile_definitions(CruBase PUBLIC $<$<CONFIG:Debug>:CRU_DEBUG>) -if (UNIX) +if (UNIX AND NOT EMSCRIPTEN) target_sources(CruBase PRIVATE platform/unix/ErrnoException.cpp platform/unix/UnixFileStream.cpp @@ -55,6 +55,8 @@ if (WIN32) target_compile_definitions(CruBase PUBLIC CRU_PLATFORM_WINDOWS) elseif(APPLE) target_compile_definitions(CruBase PUBLIC CRU_PLATFORM_OSX) +elseif(EMSCRIPTEN) + target_compile_definitions(CruBase PUBLIC CRU_PLATFORM_EMSCRIPTEN) else() target_compile_definitions(CruBase PUBLIC CRU_PLATFORM_LINUX) endif() diff --git a/src/parse/CMakeLists.txt b/src/parse/CMakeLists.txt index c02b3b8b..3ef58baf 100644 --- a/src/parse/CMakeLists.txt +++ b/src/parse/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(CruParse SHARED +add_library(CruParse Grammar.cpp Nonterminal.cpp ParsingAlgorithm.cpp diff --git a/src/platform/CMakeLists.txt b/src/platform/CMakeLists.txt index bb9259ae..22c9faa3 100644 --- a/src/platform/CMakeLists.txt +++ b/src/platform/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(CruPlatformBase SHARED +add_library(CruPlatformBase ForDllExport.cpp Color.cpp GraphicsBase.cpp diff --git a/src/platform/bootstrap/Bootstrap.cpp b/src/platform/bootstrap/Bootstrap.cpp index 93c164d4..5c47e95c 100644 --- a/src/platform/bootstrap/Bootstrap.cpp +++ b/src/platform/bootstrap/Bootstrap.cpp @@ -6,6 +6,8 @@ #elif defined(CRU_PLATFORM_OSX) #include "cru/platform/graphics/quartz/Factory.h" #include "cru/platform/gui/osx/UiApplication.h" +#elif defined(CRU_PLATFORM_EMSCRIPTEN) +// TODO: Go fill this! #else #include "cru/platform/graphics/cairo/CairoGraphicsFactory.h" #endif @@ -14,7 +16,7 @@ namespace cru::platform::bootstrap { cru::platform::gui::IUiApplication* CreateUiApplication() { #ifdef CRU_PLATFORM_WINDOWS return new cru::platform::gui::win::WinUiApplication(); -#elif CRU_PLATFORM_OSX +#elif defined(CRU_PLATFORM_OSX) return new cru::platform::gui::osx::OsxUiApplication(); #else return nullptr; @@ -25,8 +27,10 @@ CRU_PLATFORM_BOOTSTRAP_API cru::platform::graphics::IGraphicsFactory* CreateGraphicsFactory() { #ifdef CRU_PLATFORM_WINDOWS return new cru::platform::graphics::direct2d::DirectGraphicsFactory(); -#elif CRU_PLATFORM_OSX +#elif defined(CRU_PLATFORM_OSX) return new cru::platform::graphics::quartz::QuartzGraphicsFactory(); +#elif defined(CRU_PLATFORM_EMSCRIPTEN) + return nullptr; // TODO: Change this. #else return new cru::platform::graphics::cairo::CairoGraphicsFactory(); #endif diff --git a/src/platform/bootstrap/CMakeLists.txt b/src/platform/bootstrap/CMakeLists.txt index f5d79cca..4092c677 100644 --- a/src/platform/bootstrap/CMakeLists.txt +++ b/src/platform/bootstrap/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(CruPlatformBootstrap SHARED +add_library(CruPlatformBootstrap Bootstrap.cpp ) @@ -6,6 +6,8 @@ if(WIN32) target_link_libraries(CruPlatformBootstrap PUBLIC CruPlatformGuiWin) elseif(APPLE) target_link_libraries(CruPlatformBootstrap PUBLIC CruPlatformGuiOsx) +elseif(EMSCRIPTEN) + target_link_libraries(CruPlatformBootstrap PUBLIC CruBase) # TODO: Remember to change this. else() target_link_libraries(CruPlatformBootstrap PUBLIC CruPlatformGraphicsCairo) endif() diff --git a/src/platform/graphics/CMakeLists.txt b/src/platform/graphics/CMakeLists.txt index da9bf61c..e9c6a9d1 100644 --- a/src/platform/graphics/CMakeLists.txt +++ b/src/platform/graphics/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(CruPlatformGraphics SHARED +add_library(CruPlatformGraphics ForDllExport.cpp Geometry.cpp Image.cpp diff --git a/src/platform/graphics/cairo/CMakeLists.txt b/src/platform/graphics/cairo/CMakeLists.txt index 206fa21c..5879e01c 100644 --- a/src/platform/graphics/cairo/CMakeLists.txt +++ b/src/platform/graphics/cairo/CMakeLists.txt @@ -1,4 +1,4 @@ -if (UNIX) +if (UNIX AND NOT EMSCRIPTEN) # It's so great to see emscripten is somewhat UNIX! foreach(PP IN LISTS CMAKE_SYSTEM_PREFIX_PATH) cmake_path(APPEND PP "lib" ${CMAKE_LIBRARY_ARCHITECTURE}) list(APPEND LIB_ARCH_DIR ${PP}) @@ -16,7 +16,7 @@ if (UNIX) find_library(LIB_PNG png REQUIRED) - add_library(CruPlatformGraphicsCairo SHARED + add_library(CruPlatformGraphicsCairo Base.cpp CairoBrush.cpp CairoGeometry.cpp diff --git a/src/platform/graphics/direct2d/CMakeLists.txt b/src/platform/graphics/direct2d/CMakeLists.txt index a9d5900b..4776e773 100644 --- a/src/platform/graphics/direct2d/CMakeLists.txt +++ b/src/platform/graphics/direct2d/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(CruPlatformGraphicsDirect2d SHARED +add_library(CruPlatformGraphicsDirect2d Brush.cpp Font.cpp Geometry.cpp diff --git a/src/platform/graphics/quartz/CMakeLists.txt b/src/platform/graphics/quartz/CMakeLists.txt index 1fcaff26..88050a07 100644 --- a/src/platform/graphics/quartz/CMakeLists.txt +++ b/src/platform/graphics/quartz/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(CruPlatformGraphicsQuartz SHARED +add_library(CruPlatformGraphicsQuartz Brush.cpp Convert.cpp Factory.cpp diff --git a/src/platform/gui/CMakeLists.txt b/src/platform/gui/CMakeLists.txt index eb7467cd..808caf9c 100644 --- a/src/platform/gui/CMakeLists.txt +++ b/src/platform/gui/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(CruPlatformGui SHARED +add_library(CruPlatformGui Keyboard.cpp Menu.cpp UiApplication.cpp diff --git a/src/platform/gui/osx/CMakeLists.txt b/src/platform/gui/osx/CMakeLists.txt index 5442ad15..87245cdb 100644 --- a/src/platform/gui/osx/CMakeLists.txt +++ b/src/platform/gui/osx/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(CruPlatformGuiOsx SHARED +add_library(CruPlatformGuiOsx Clipboard.mm Cursor.mm InputMethod.mm diff --git a/src/platform/gui/win/CMakeLists.txt b/src/platform/gui/win/CMakeLists.txt index 4a27ffb6..9f2263fd 100644 --- a/src/platform/gui/win/CMakeLists.txt +++ b/src/platform/gui/win/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(CruPlatformGuiWin SHARED +add_library(CruPlatformGuiWin Clipboard.cpp Cursor.cpp GodWindow.cpp diff --git a/src/platform/osx/CMakeLists.txt b/src/platform/osx/CMakeLists.txt index 9768a75c..43a0a22b 100644 --- a/src/platform/osx/CMakeLists.txt +++ b/src/platform/osx/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(CruPlatformBaseOsx SHARED +add_library(CruPlatformBaseOsx Resource.cpp ) diff --git a/src/platform/win/CMakeLists.txt b/src/platform/win/CMakeLists.txt index c561f96f..06406267 100644 --- a/src/platform/win/CMakeLists.txt +++ b/src/platform/win/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(CruWinBase SHARED +add_library(CruWinBase ForDllExport.cpp ) target_compile_definitions(CruWinBase PUBLIC UNICODE _UNICODE) # use unicode diff --git a/src/toml/CMakeLists.txt b/src/toml/CMakeLists.txt index 170509a4..33b31b8f 100644 --- a/src/toml/CMakeLists.txt +++ b/src/toml/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(CruToml SHARED +add_library(CruToml TomlDocument.cpp TomlParser.cpp ) diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index b3e57dd7..b6987c74 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(CruUi SHARED +add_library(CruUi DeleteLater.cpp Helper.cpp ThemeManager.cpp diff --git a/src/xml/CMakeLists.txt b/src/xml/CMakeLists.txt index 519b59f2..5431d53d 100644 --- a/src/xml/CMakeLists.txt +++ b/src/xml/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(CruXml SHARED +add_library(CruXml XmlNode.cpp XmlParser.cpp ) |